driver-ops.h
Go to the documentation of this file.
00001 #ifndef __MAC80211_DRIVER_OPS
00002 #define __MAC80211_DRIVER_OPS
00003 
00004 #include <net/mac80211.h>
00005 #include "ieee80211_i.h"
00006 #include "driver-trace.h"
00007 
00008 static inline void check_sdata_in_driver(struct ieee80211_sub_if_data *sdata)
00009 {
00010         WARN(!(sdata->flags & IEEE80211_SDATA_IN_DRIVER),
00011              "%s:  Failed check-sdata-in-driver check, flags: 0x%x\n",
00012              sdata->dev->name, sdata->flags);
00013 }
00014 
00015 static inline struct ieee80211_sub_if_data *
00016 get_bss_sdata(struct ieee80211_sub_if_data *sdata)
00017 {
00018         if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN)
00019                 sdata = container_of(sdata->bss, struct ieee80211_sub_if_data,
00020                                      u.ap);
00021 
00022         return sdata;
00023 }
00024 
00025 static inline void drv_tx(struct ieee80211_local *local, struct sk_buff *skb)
00026 {
00027         local->ops->tx(&local->hw, skb);
00028 }
00029 
00030 static inline void drv_tx_frags(struct ieee80211_local *local,
00031                                 struct ieee80211_vif *vif,
00032                                 struct ieee80211_sta *sta,
00033                                 struct sk_buff_head *skbs)
00034 {
00035         local->ops->tx_frags(&local->hw, vif, sta, skbs);
00036 }
00037 
00038 static inline void drv_get_et_strings(struct ieee80211_sub_if_data *sdata,
00039                                       u32 sset, u8 *data)
00040 {
00041         struct ieee80211_local *local = sdata->local;
00042         if (local->ops->get_et_strings) {
00043                 trace_drv_get_et_strings(local, sset);
00044                 local->ops->get_et_strings(&local->hw, &sdata->vif, sset, data);
00045                 trace_drv_return_void(local);
00046         }
00047 }
00048 
00049 static inline void drv_get_et_stats(struct ieee80211_sub_if_data *sdata,
00050                                     struct ethtool_stats *stats,
00051                                     u64 *data)
00052 {
00053         struct ieee80211_local *local = sdata->local;
00054         if (local->ops->get_et_stats) {
00055                 trace_drv_get_et_stats(local);
00056                 local->ops->get_et_stats(&local->hw, &sdata->vif, stats, data);
00057                 trace_drv_return_void(local);
00058         }
00059 }
00060 
00061 static inline int drv_get_et_sset_count(struct ieee80211_sub_if_data *sdata,
00062                                         int sset)
00063 {
00064         struct ieee80211_local *local = sdata->local;
00065         int rv = 0;
00066         if (local->ops->get_et_sset_count) {
00067                 trace_drv_get_et_sset_count(local, sset);
00068                 rv = local->ops->get_et_sset_count(&local->hw, &sdata->vif,
00069                                                    sset);
00070                 trace_drv_return_int(local, rv);
00071         }
00072         return rv;
00073 }
00074 
00075 static inline int drv_start(struct ieee80211_local *local)
00076 {
00077         int ret;
00078 
00079         might_sleep();
00080 
00081         trace_drv_start(local);
00082         local->started = true;
00083         smp_mb();
00084         ret = local->ops->start(&local->hw);
00085         trace_drv_return_int(local, ret);
00086         return ret;
00087 }
00088 
00089 static inline void drv_stop(struct ieee80211_local *local)
00090 {
00091         might_sleep();
00092 
00093         trace_drv_stop(local);
00094         local->ops->stop(&local->hw);
00095         trace_drv_return_void(local);
00096 
00097         /* sync away all work on the tasklet before clearing started */
00098         tasklet_disable(&local->tasklet);
00099         tasklet_enable(&local->tasklet);
00100 
00101         barrier();
00102 
00103         local->started = false;
00104 }
00105 
00106 #ifdef CONFIG_PM
00107 static inline int drv_suspend(struct ieee80211_local *local,
00108                               struct cfg80211_wowlan *wowlan)
00109 {
00110         int ret;
00111 
00112         might_sleep();
00113 
00114         trace_drv_suspend(local);
00115         ret = local->ops->suspend(&local->hw, wowlan);
00116         trace_drv_return_int(local, ret);
00117         return ret;
00118 }
00119 
00120 static inline int drv_resume(struct ieee80211_local *local)
00121 {
00122         int ret;
00123 
00124         might_sleep();
00125 
00126         trace_drv_resume(local);
00127         ret = local->ops->resume(&local->hw);
00128         trace_drv_return_int(local, ret);
00129         return ret;
00130 }
00131 
00132 static inline void drv_set_wakeup(struct ieee80211_local *local,
00133                                   bool enabled)
00134 {
00135         might_sleep();
00136 
00137         if (!local->ops->set_wakeup)
00138                 return;
00139 
00140         trace_drv_set_wakeup(local, enabled);
00141         local->ops->set_wakeup(&local->hw, enabled);
00142         trace_drv_return_void(local);
00143 }
00144 #endif
00145 
00146 static inline int drv_add_interface(struct ieee80211_local *local,
00147                                     struct ieee80211_sub_if_data *sdata)
00148 {
00149         int ret;
00150 
00151         might_sleep();
00152 
00153         if (WARN_ON(sdata->vif.type == NL80211_IFTYPE_AP_VLAN ||
00154                     (sdata->vif.type == NL80211_IFTYPE_MONITOR &&
00155                      !(local->hw.flags & IEEE80211_HW_WANT_MONITOR_VIF))))
00156                 return -EINVAL;
00157 
00158         trace_drv_add_interface(local, sdata);
00159         ret = local->ops->add_interface(&local->hw, &sdata->vif);
00160         trace_drv_return_int(local, ret);
00161 
00162         if (ret == 0)
00163                 sdata->flags |= IEEE80211_SDATA_IN_DRIVER;
00164 
00165         return ret;
00166 }
00167 
00168 static inline int drv_change_interface(struct ieee80211_local *local,
00169                                        struct ieee80211_sub_if_data *sdata,
00170                                        enum nl80211_iftype type, bool p2p)
00171 {
00172         int ret;
00173 
00174         might_sleep();
00175 
00176         check_sdata_in_driver(sdata);
00177 
00178         trace_drv_change_interface(local, sdata, type, p2p);
00179         ret = local->ops->change_interface(&local->hw, &sdata->vif, type, p2p);
00180         trace_drv_return_int(local, ret);
00181         return ret;
00182 }
00183 
00184 static inline void drv_remove_interface(struct ieee80211_local *local,
00185                                         struct ieee80211_sub_if_data *sdata)
00186 {
00187         might_sleep();
00188 
00189         check_sdata_in_driver(sdata);
00190 
00191         trace_drv_remove_interface(local, sdata);
00192         local->ops->remove_interface(&local->hw, &sdata->vif);
00193         sdata->flags &= ~IEEE80211_SDATA_IN_DRIVER;
00194         trace_drv_return_void(local);
00195 }
00196 
00197 static inline int drv_config(struct ieee80211_local *local, u32 changed)
00198 {
00199         int ret;
00200 
00201         might_sleep();
00202 
00203         trace_drv_config(local, changed);
00204         ret = local->ops->config(&local->hw, changed);
00205         trace_drv_return_int(local, ret);
00206         return ret;
00207 }
00208 
00209 static inline void drv_bss_info_changed(struct ieee80211_local *local,
00210                                         struct ieee80211_sub_if_data *sdata,
00211                                         struct ieee80211_bss_conf *info,
00212                                         u32 changed)
00213 {
00214         might_sleep();
00215 
00216         check_sdata_in_driver(sdata);
00217 
00218         trace_drv_bss_info_changed(local, sdata, info, changed);
00219         if (local->ops->bss_info_changed)
00220                 local->ops->bss_info_changed(&local->hw, &sdata->vif, info, changed);
00221         trace_drv_return_void(local);
00222 }
00223 
00224 static inline u64 drv_prepare_multicast(struct ieee80211_local *local,
00225                                         struct netdev_hw_addr_list *mc_list)
00226 {
00227         u64 ret = 0;
00228 
00229         trace_drv_prepare_multicast(local, mc_list->count);
00230 
00231         if (local->ops->prepare_multicast)
00232                 ret = local->ops->prepare_multicast(&local->hw, mc_list);
00233 
00234         trace_drv_return_u64(local, ret);
00235 
00236         return ret;
00237 }
00238 
00239 static inline void drv_configure_filter(struct ieee80211_local *local,
00240                                         unsigned int changed_flags,
00241                                         unsigned int *total_flags,
00242                                         u64 multicast)
00243 {
00244         might_sleep();
00245 
00246         trace_drv_configure_filter(local, changed_flags, total_flags,
00247                                    multicast);
00248         local->ops->configure_filter(&local->hw, changed_flags, total_flags,
00249                                      multicast);
00250         trace_drv_return_void(local);
00251 }
00252 
00253 static inline int drv_set_tim(struct ieee80211_local *local,
00254                               struct ieee80211_sta *sta, bool set)
00255 {
00256         int ret = 0;
00257         trace_drv_set_tim(local, sta, set);
00258         if (local->ops->set_tim)
00259                 ret = local->ops->set_tim(&local->hw, sta, set);
00260         trace_drv_return_int(local, ret);
00261         return ret;
00262 }
00263 
00264 static inline int drv_set_key(struct ieee80211_local *local,
00265                               enum set_key_cmd cmd,
00266                               struct ieee80211_sub_if_data *sdata,
00267                               struct ieee80211_sta *sta,
00268                               struct ieee80211_key_conf *key)
00269 {
00270         int ret;
00271 
00272         might_sleep();
00273 
00274         sdata = get_bss_sdata(sdata);
00275         check_sdata_in_driver(sdata);
00276 
00277         trace_drv_set_key(local, cmd, sdata, sta, key);
00278         ret = local->ops->set_key(&local->hw, cmd, &sdata->vif, sta, key);
00279         trace_drv_return_int(local, ret);
00280         return ret;
00281 }
00282 
00283 static inline void drv_update_tkip_key(struct ieee80211_local *local,
00284                                        struct ieee80211_sub_if_data *sdata,
00285                                        struct ieee80211_key_conf *conf,
00286                                        struct sta_info *sta, u32 iv32,
00287                                        u16 *phase1key)
00288 {
00289         struct ieee80211_sta *ista = NULL;
00290 
00291         if (sta)
00292                 ista = &sta->sta;
00293 
00294         sdata = get_bss_sdata(sdata);
00295         check_sdata_in_driver(sdata);
00296 
00297         trace_drv_update_tkip_key(local, sdata, conf, ista, iv32);
00298         if (local->ops->update_tkip_key)
00299                 local->ops->update_tkip_key(&local->hw, &sdata->vif, conf,
00300                                             ista, iv32, phase1key);
00301         trace_drv_return_void(local);
00302 }
00303 
00304 static inline int drv_hw_scan(struct ieee80211_local *local,
00305                               struct ieee80211_sub_if_data *sdata,
00306                               struct cfg80211_scan_request *req)
00307 {
00308         int ret;
00309 
00310         might_sleep();
00311 
00312         check_sdata_in_driver(sdata);
00313 
00314         trace_drv_hw_scan(local, sdata);
00315         ret = local->ops->hw_scan(&local->hw, &sdata->vif, req);
00316         trace_drv_return_int(local, ret);
00317         return ret;
00318 }
00319 
00320 static inline void drv_cancel_hw_scan(struct ieee80211_local *local,
00321                                       struct ieee80211_sub_if_data *sdata)
00322 {
00323         might_sleep();
00324 
00325         check_sdata_in_driver(sdata);
00326 
00327         trace_drv_cancel_hw_scan(local, sdata);
00328         local->ops->cancel_hw_scan(&local->hw, &sdata->vif);
00329         trace_drv_return_void(local);
00330 }
00331 
00332 static inline int
00333 drv_sched_scan_start(struct ieee80211_local *local,
00334                      struct ieee80211_sub_if_data *sdata,
00335                      struct cfg80211_sched_scan_request *req,
00336                      struct ieee80211_sched_scan_ies *ies)
00337 {
00338         int ret;
00339 
00340         might_sleep();
00341 
00342         check_sdata_in_driver(sdata);
00343 
00344         trace_drv_sched_scan_start(local, sdata);
00345         ret = local->ops->sched_scan_start(&local->hw, &sdata->vif,
00346                                               req, ies);
00347         trace_drv_return_int(local, ret);
00348         return ret;
00349 }
00350 
00351 static inline void drv_sched_scan_stop(struct ieee80211_local *local,
00352                                        struct ieee80211_sub_if_data *sdata)
00353 {
00354         might_sleep();
00355 
00356         check_sdata_in_driver(sdata);
00357 
00358         trace_drv_sched_scan_stop(local, sdata);
00359         local->ops->sched_scan_stop(&local->hw, &sdata->vif);
00360         trace_drv_return_void(local);
00361 }
00362 
00363 static inline void drv_sw_scan_start(struct ieee80211_local *local)
00364 {
00365         might_sleep();
00366 
00367         trace_drv_sw_scan_start(local);
00368         if (local->ops->sw_scan_start)
00369                 local->ops->sw_scan_start(&local->hw);
00370         trace_drv_return_void(local);
00371 }
00372 
00373 static inline void drv_sw_scan_complete(struct ieee80211_local *local)
00374 {
00375         might_sleep();
00376 
00377         trace_drv_sw_scan_complete(local);
00378         if (local->ops->sw_scan_complete)
00379                 local->ops->sw_scan_complete(&local->hw);
00380         trace_drv_return_void(local);
00381 }
00382 
00383 static inline int drv_get_stats(struct ieee80211_local *local,
00384                                 struct ieee80211_low_level_stats *stats)
00385 {
00386         int ret = -EOPNOTSUPP;
00387 
00388         might_sleep();
00389 
00390         if (local->ops->get_stats)
00391                 ret = local->ops->get_stats(&local->hw, stats);
00392         trace_drv_get_stats(local, stats, ret);
00393 
00394         return ret;
00395 }
00396 
00397 static inline void drv_get_tkip_seq(struct ieee80211_local *local,
00398                                     u8 hw_key_idx, u32 *iv32, u16 *iv16)
00399 {
00400         if (local->ops->get_tkip_seq)
00401                 local->ops->get_tkip_seq(&local->hw, hw_key_idx, iv32, iv16);
00402         trace_drv_get_tkip_seq(local, hw_key_idx, iv32, iv16);
00403 }
00404 
00405 static inline int drv_set_frag_threshold(struct ieee80211_local *local,
00406                                         u32 value)
00407 {
00408         int ret = 0;
00409 
00410         might_sleep();
00411 
00412         trace_drv_set_frag_threshold(local, value);
00413         if (local->ops->set_frag_threshold)
00414                 ret = local->ops->set_frag_threshold(&local->hw, value);
00415         trace_drv_return_int(local, ret);
00416         return ret;
00417 }
00418 
00419 static inline int drv_set_rts_threshold(struct ieee80211_local *local,
00420                                         u32 value)
00421 {
00422         int ret = 0;
00423 
00424         might_sleep();
00425 
00426         trace_drv_set_rts_threshold(local, value);
00427         if (local->ops->set_rts_threshold)
00428                 ret = local->ops->set_rts_threshold(&local->hw, value);
00429         trace_drv_return_int(local, ret);
00430         return ret;
00431 }
00432 
00433 static inline int drv_set_coverage_class(struct ieee80211_local *local,
00434                                          u8 value)
00435 {
00436         int ret = 0;
00437         might_sleep();
00438 
00439         trace_drv_set_coverage_class(local, value);
00440         if (local->ops->set_coverage_class)
00441                 local->ops->set_coverage_class(&local->hw, value);
00442         else
00443                 ret = -EOPNOTSUPP;
00444 
00445         trace_drv_return_int(local, ret);
00446         return ret;
00447 }
00448 
00449 static inline void drv_sta_notify(struct ieee80211_local *local,
00450                                   struct ieee80211_sub_if_data *sdata,
00451                                   enum sta_notify_cmd cmd,
00452                                   struct ieee80211_sta *sta)
00453 {
00454         sdata = get_bss_sdata(sdata);
00455         check_sdata_in_driver(sdata);
00456 
00457         trace_drv_sta_notify(local, sdata, cmd, sta);
00458         if (local->ops->sta_notify)
00459                 local->ops->sta_notify(&local->hw, &sdata->vif, cmd, sta);
00460         trace_drv_return_void(local);
00461 }
00462 
00463 static inline int drv_sta_add(struct ieee80211_local *local,
00464                               struct ieee80211_sub_if_data *sdata,
00465                               struct ieee80211_sta *sta)
00466 {
00467         int ret = 0;
00468 
00469         might_sleep();
00470 
00471         sdata = get_bss_sdata(sdata);
00472         check_sdata_in_driver(sdata);
00473 
00474         trace_drv_sta_add(local, sdata, sta);
00475         if (local->ops->sta_add)
00476                 ret = local->ops->sta_add(&local->hw, &sdata->vif, sta);
00477 
00478         trace_drv_return_int(local, ret);
00479 
00480         return ret;
00481 }
00482 
00483 static inline void drv_sta_remove(struct ieee80211_local *local,
00484                                   struct ieee80211_sub_if_data *sdata,
00485                                   struct ieee80211_sta *sta)
00486 {
00487         might_sleep();
00488 
00489         sdata = get_bss_sdata(sdata);
00490         check_sdata_in_driver(sdata);
00491 
00492         trace_drv_sta_remove(local, sdata, sta);
00493         if (local->ops->sta_remove)
00494                 local->ops->sta_remove(&local->hw, &sdata->vif, sta);
00495 
00496         trace_drv_return_void(local);
00497 }
00498 
00499 static inline __must_check
00500 int drv_sta_state(struct ieee80211_local *local,
00501                   struct ieee80211_sub_if_data *sdata,
00502                   struct sta_info *sta,
00503                   enum ieee80211_sta_state old_state,
00504                   enum ieee80211_sta_state new_state)
00505 {
00506         int ret = 0;
00507 
00508         might_sleep();
00509 
00510         sdata = get_bss_sdata(sdata);
00511         check_sdata_in_driver(sdata);
00512 
00513         trace_drv_sta_state(local, sdata, &sta->sta, old_state, new_state);
00514         if (local->ops->sta_state) {
00515                 ret = local->ops->sta_state(&local->hw, &sdata->vif, &sta->sta,
00516                                             old_state, new_state);
00517         } else if (old_state == IEEE80211_STA_AUTH &&
00518                    new_state == IEEE80211_STA_ASSOC) {
00519                 ret = drv_sta_add(local, sdata, &sta->sta);
00520                 if (ret == 0)
00521                         sta->uploaded = true;
00522         } else if (old_state == IEEE80211_STA_ASSOC &&
00523                    new_state == IEEE80211_STA_AUTH) {
00524                 drv_sta_remove(local, sdata, &sta->sta);
00525         }
00526         trace_drv_return_int(local, ret);
00527         return ret;
00528 }
00529 
00530 static inline void drv_sta_rc_update(struct ieee80211_local *local,
00531                                      struct ieee80211_sub_if_data *sdata,
00532                                      struct ieee80211_sta *sta, u32 changed)
00533 {
00534         sdata = get_bss_sdata(sdata);
00535         check_sdata_in_driver(sdata);
00536 
00537         trace_drv_sta_rc_update(local, sdata, sta, changed);
00538         if (local->ops->sta_rc_update)
00539                 local->ops->sta_rc_update(&local->hw, &sdata->vif,
00540                                           sta, changed);
00541 
00542         trace_drv_return_void(local);
00543 }
00544 
00545 static inline int drv_conf_tx(struct ieee80211_local *local,
00546                               struct ieee80211_sub_if_data *sdata, u16 ac,
00547                               const struct ieee80211_tx_queue_params *params)
00548 {
00549         int ret = -EOPNOTSUPP;
00550 
00551         might_sleep();
00552 
00553         check_sdata_in_driver(sdata);
00554 
00555         trace_drv_conf_tx(local, sdata, ac, params);
00556         if (local->ops->conf_tx)
00557                 ret = local->ops->conf_tx(&local->hw, &sdata->vif,
00558                                           ac, params);
00559         trace_drv_return_int(local, ret);
00560         return ret;
00561 }
00562 
00563 static inline u64 drv_get_tsf(struct ieee80211_local *local,
00564                               struct ieee80211_sub_if_data *sdata)
00565 {
00566         u64 ret = -1ULL;
00567 
00568         might_sleep();
00569 
00570         check_sdata_in_driver(sdata);
00571 
00572         trace_drv_get_tsf(local, sdata);
00573         if (local->ops->get_tsf)
00574                 ret = local->ops->get_tsf(&local->hw, &sdata->vif);
00575         trace_drv_return_u64(local, ret);
00576         return ret;
00577 }
00578 
00579 static inline void drv_set_tsf(struct ieee80211_local *local,
00580                                struct ieee80211_sub_if_data *sdata,
00581                                u64 tsf)
00582 {
00583         might_sleep();
00584 
00585         check_sdata_in_driver(sdata);
00586 
00587         trace_drv_set_tsf(local, sdata, tsf);
00588         if (local->ops->set_tsf)
00589                 local->ops->set_tsf(&local->hw, &sdata->vif, tsf);
00590         trace_drv_return_void(local);
00591 }
00592 
00593 static inline void drv_reset_tsf(struct ieee80211_local *local,
00594                                  struct ieee80211_sub_if_data *sdata)
00595 {
00596         might_sleep();
00597 
00598         check_sdata_in_driver(sdata);
00599 
00600         trace_drv_reset_tsf(local, sdata);
00601         if (local->ops->reset_tsf)
00602                 local->ops->reset_tsf(&local->hw, &sdata->vif);
00603         trace_drv_return_void(local);
00604 }
00605 
00606 static inline int drv_tx_last_beacon(struct ieee80211_local *local)
00607 {
00608         int ret = 0; /* default unsuported op for less congestion */
00609 
00610         might_sleep();
00611 
00612         trace_drv_tx_last_beacon(local);
00613         if (local->ops->tx_last_beacon)
00614                 ret = local->ops->tx_last_beacon(&local->hw);
00615         trace_drv_return_int(local, ret);
00616         return ret;
00617 }
00618 
00619 static inline int drv_ampdu_action(struct ieee80211_local *local,
00620                                    struct ieee80211_sub_if_data *sdata,
00621                                    enum ieee80211_ampdu_mlme_action action,
00622                                    struct ieee80211_sta *sta, u16 tid,
00623                                    u16 *ssn, u8 buf_size)
00624 {
00625         int ret = -EOPNOTSUPP;
00626 
00627         might_sleep();
00628 
00629         sdata = get_bss_sdata(sdata);
00630         check_sdata_in_driver(sdata);
00631 
00632         trace_drv_ampdu_action(local, sdata, action, sta, tid, ssn, buf_size);
00633 
00634         if (local->ops->ampdu_action)
00635                 ret = local->ops->ampdu_action(&local->hw, &sdata->vif, action,
00636                                                sta, tid, ssn, buf_size);
00637 
00638         trace_drv_return_int(local, ret);
00639 
00640         return ret;
00641 }
00642 
00643 static inline int drv_get_survey(struct ieee80211_local *local, int idx,
00644                                 struct survey_info *survey)
00645 {
00646         int ret = -EOPNOTSUPP;
00647 
00648         trace_drv_get_survey(local, idx, survey);
00649 
00650         if (local->ops->get_survey)
00651                 ret = local->ops->get_survey(&local->hw, idx, survey);
00652 
00653         trace_drv_return_int(local, ret);
00654 
00655         return ret;
00656 }
00657 
00658 static inline void drv_rfkill_poll(struct ieee80211_local *local)
00659 {
00660         might_sleep();
00661 
00662         if (local->ops->rfkill_poll)
00663                 local->ops->rfkill_poll(&local->hw);
00664 }
00665 
00666 static inline void drv_flush(struct ieee80211_local *local, bool drop)
00667 {
00668         might_sleep();
00669 
00670         trace_drv_flush(local, drop);
00671         if (local->ops->flush)
00672                 local->ops->flush(&local->hw, drop);
00673         trace_drv_return_void(local);
00674 }
00675 
00676 static inline void drv_channel_switch(struct ieee80211_local *local,
00677                                      struct ieee80211_channel_switch *ch_switch)
00678 {
00679         might_sleep();
00680 
00681         trace_drv_channel_switch(local, ch_switch);
00682         local->ops->channel_switch(&local->hw, ch_switch);
00683         trace_drv_return_void(local);
00684 }
00685 
00686 
00687 static inline int drv_set_antenna(struct ieee80211_local *local,
00688                                   u32 tx_ant, u32 rx_ant)
00689 {
00690         int ret = -EOPNOTSUPP;
00691         might_sleep();
00692         if (local->ops->set_antenna)
00693                 ret = local->ops->set_antenna(&local->hw, tx_ant, rx_ant);
00694         trace_drv_set_antenna(local, tx_ant, rx_ant, ret);
00695         return ret;
00696 }
00697 
00698 static inline int drv_get_antenna(struct ieee80211_local *local,
00699                                   u32 *tx_ant, u32 *rx_ant)
00700 {
00701         int ret = -EOPNOTSUPP;
00702         might_sleep();
00703         if (local->ops->get_antenna)
00704                 ret = local->ops->get_antenna(&local->hw, tx_ant, rx_ant);
00705         trace_drv_get_antenna(local, *tx_ant, *rx_ant, ret);
00706         return ret;
00707 }
00708 
00709 static inline int drv_remain_on_channel(struct ieee80211_local *local,
00710                                         struct ieee80211_channel *chan,
00711                                         enum nl80211_channel_type chantype,
00712                                         unsigned int duration)
00713 {
00714         int ret;
00715 
00716         might_sleep();
00717 
00718         trace_drv_remain_on_channel(local, chan, chantype, duration);
00719         ret = local->ops->remain_on_channel(&local->hw, chan, chantype,
00720                                             duration);
00721         trace_drv_return_int(local, ret);
00722 
00723         return ret;
00724 }
00725 
00726 static inline int drv_cancel_remain_on_channel(struct ieee80211_local *local)
00727 {
00728         int ret;
00729 
00730         might_sleep();
00731 
00732         trace_drv_cancel_remain_on_channel(local);
00733         ret = local->ops->cancel_remain_on_channel(&local->hw);
00734         trace_drv_return_int(local, ret);
00735 
00736         return ret;
00737 }
00738 
00739 static inline int drv_set_ringparam(struct ieee80211_local *local,
00740                                     u32 tx, u32 rx)
00741 {
00742         int ret = -ENOTSUPP;
00743 
00744         might_sleep();
00745 
00746         trace_drv_set_ringparam(local, tx, rx);
00747         if (local->ops->set_ringparam)
00748                 ret = local->ops->set_ringparam(&local->hw, tx, rx);
00749         trace_drv_return_int(local, ret);
00750 
00751         return ret;
00752 }
00753 
00754 static inline void drv_get_ringparam(struct ieee80211_local *local,
00755                                      u32 *tx, u32 *tx_max, u32 *rx, u32 *rx_max)
00756 {
00757         might_sleep();
00758 
00759         trace_drv_get_ringparam(local, tx, tx_max, rx, rx_max);
00760         if (local->ops->get_ringparam)
00761                 local->ops->get_ringparam(&local->hw, tx, tx_max, rx, rx_max);
00762         trace_drv_return_void(local);
00763 }
00764 
00765 static inline bool drv_tx_frames_pending(struct ieee80211_local *local)
00766 {
00767         bool ret = false;
00768 
00769         might_sleep();
00770 
00771         trace_drv_tx_frames_pending(local);
00772         if (local->ops->tx_frames_pending)
00773                 ret = local->ops->tx_frames_pending(&local->hw);
00774         trace_drv_return_bool(local, ret);
00775 
00776         return ret;
00777 }
00778 
00779 static inline int drv_set_bitrate_mask(struct ieee80211_local *local,
00780                                        struct ieee80211_sub_if_data *sdata,
00781                                        const struct cfg80211_bitrate_mask *mask)
00782 {
00783         int ret = -EOPNOTSUPP;
00784 
00785         might_sleep();
00786 
00787         check_sdata_in_driver(sdata);
00788 
00789         trace_drv_set_bitrate_mask(local, sdata, mask);
00790         if (local->ops->set_bitrate_mask)
00791                 ret = local->ops->set_bitrate_mask(&local->hw,
00792                                                    &sdata->vif, mask);
00793         trace_drv_return_int(local, ret);
00794 
00795         return ret;
00796 }
00797 
00798 static inline void drv_set_rekey_data(struct ieee80211_local *local,
00799                                       struct ieee80211_sub_if_data *sdata,
00800                                       struct cfg80211_gtk_rekey_data *data)
00801 {
00802         check_sdata_in_driver(sdata);
00803 
00804         trace_drv_set_rekey_data(local, sdata, data);
00805         if (local->ops->set_rekey_data)
00806                 local->ops->set_rekey_data(&local->hw, &sdata->vif, data);
00807         trace_drv_return_void(local);
00808 }
00809 
00810 static inline void drv_rssi_callback(struct ieee80211_local *local,
00811                                      const enum ieee80211_rssi_event event)
00812 {
00813         trace_drv_rssi_callback(local, event);
00814         if (local->ops->rssi_callback)
00815                 local->ops->rssi_callback(&local->hw, event);
00816         trace_drv_return_void(local);
00817 }
00818 
00819 static inline void
00820 drv_release_buffered_frames(struct ieee80211_local *local,
00821                             struct sta_info *sta, u16 tids, int num_frames,
00822                             enum ieee80211_frame_release_type reason,
00823                             bool more_data)
00824 {
00825         trace_drv_release_buffered_frames(local, &sta->sta, tids, num_frames,
00826                                           reason, more_data);
00827         if (local->ops->release_buffered_frames)
00828                 local->ops->release_buffered_frames(&local->hw, &sta->sta, tids,
00829                                                     num_frames, reason,
00830                                                     more_data);
00831         trace_drv_return_void(local);
00832 }
00833 
00834 static inline void
00835 drv_allow_buffered_frames(struct ieee80211_local *local,
00836                           struct sta_info *sta, u16 tids, int num_frames,
00837                           enum ieee80211_frame_release_type reason,
00838                           bool more_data)
00839 {
00840         trace_drv_allow_buffered_frames(local, &sta->sta, tids, num_frames,
00841                                         reason, more_data);
00842         if (local->ops->allow_buffered_frames)
00843                 local->ops->allow_buffered_frames(&local->hw, &sta->sta,
00844                                                   tids, num_frames, reason,
00845                                                   more_data);
00846         trace_drv_return_void(local);
00847 }
00848 #endif /* __MAC80211_DRIVER_OPS */


ros_rt_wmp
Author(s): Danilo Tardioli, dantard@unizar.es
autogenerated on Mon Oct 6 2014 08:27:09