aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2012-03-28 05:04:24 -0400
committerJohn W. Linville <linville@tuxdriver.com>2012-04-10 14:54:09 -0400
commita3304b0a17495183a2270d4a25978795226597a4 (patch)
tree1b1f91ab191e77833b84232ba5a61d6a584b3cd6
parentd748b4642a53cd1ead303f9e2b008295391466b7 (diff)
cfg80211/nl80211: clarify TX queue API
With the plan to change mac80211's queue API to not map ACs to queues 1:1, it seems necessary to clarify some APIs that act on ACs rather than on queues to spell that out explicitly. Do this. Also verify that the AC number given is valid. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--include/linux/nl80211.h22
-rw-r--r--include/net/cfg80211.h4
-rw-r--r--include/net/mac80211.h2
-rw-r--r--net/mac80211/cfg.c10
-rw-r--r--net/mac80211/driver-ops.h6
-rw-r--r--net/mac80211/driver-trace.h13
-rw-r--r--net/wireless/nl80211.c7
7 files changed, 37 insertions, 27 deletions
diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h
index e474f6e780cc..1f6e44680fb7 100644
--- a/include/linux/nl80211.h
+++ b/include/linux/nl80211.h
@@ -2223,7 +2223,7 @@ enum nl80211_mesh_setup_params {
2223/** 2223/**
2224 * enum nl80211_txq_attr - TX queue parameter attributes 2224 * enum nl80211_txq_attr - TX queue parameter attributes
2225 * @__NL80211_TXQ_ATTR_INVALID: Attribute number 0 is reserved 2225 * @__NL80211_TXQ_ATTR_INVALID: Attribute number 0 is reserved
2226 * @NL80211_TXQ_ATTR_QUEUE: TX queue identifier (NL80211_TXQ_Q_*) 2226 * @NL80211_TXQ_ATTR_AC: AC identifier (NL80211_AC_*)
2227 * @NL80211_TXQ_ATTR_TXOP: Maximum burst time in units of 32 usecs, 0 meaning 2227 * @NL80211_TXQ_ATTR_TXOP: Maximum burst time in units of 32 usecs, 0 meaning
2228 * disabled 2228 * disabled
2229 * @NL80211_TXQ_ATTR_CWMIN: Minimum contention window [a value of the form 2229 * @NL80211_TXQ_ATTR_CWMIN: Minimum contention window [a value of the form
@@ -2236,7 +2236,7 @@ enum nl80211_mesh_setup_params {
2236 */ 2236 */
2237enum nl80211_txq_attr { 2237enum nl80211_txq_attr {
2238 __NL80211_TXQ_ATTR_INVALID, 2238 __NL80211_TXQ_ATTR_INVALID,
2239 NL80211_TXQ_ATTR_QUEUE, 2239 NL80211_TXQ_ATTR_AC,
2240 NL80211_TXQ_ATTR_TXOP, 2240 NL80211_TXQ_ATTR_TXOP,
2241 NL80211_TXQ_ATTR_CWMIN, 2241 NL80211_TXQ_ATTR_CWMIN,
2242 NL80211_TXQ_ATTR_CWMAX, 2242 NL80211_TXQ_ATTR_CWMAX,
@@ -2247,13 +2247,21 @@ enum nl80211_txq_attr {
2247 NL80211_TXQ_ATTR_MAX = __NL80211_TXQ_ATTR_AFTER_LAST - 1 2247 NL80211_TXQ_ATTR_MAX = __NL80211_TXQ_ATTR_AFTER_LAST - 1
2248}; 2248};
2249 2249
2250enum nl80211_txq_q { 2250enum nl80211_ac {
2251 NL80211_TXQ_Q_VO, 2251 NL80211_AC_VO,
2252 NL80211_TXQ_Q_VI, 2252 NL80211_AC_VI,
2253 NL80211_TXQ_Q_BE, 2253 NL80211_AC_BE,
2254 NL80211_TXQ_Q_BK 2254 NL80211_AC_BK,
2255 NL80211_NUM_ACS
2255}; 2256};
2256 2257
2258/* backward compat */
2259#define NL80211_TXQ_ATTR_QUEUE NL80211_TXQ_ATTR_AC
2260#define NL80211_TXQ_Q_VO NL80211_AC_VO
2261#define NL80211_TXQ_Q_VI NL80211_AC_VI
2262#define NL80211_TXQ_Q_BE NL80211_AC_BE
2263#define NL80211_TXQ_Q_BK NL80211_AC_BK
2264
2257enum nl80211_channel_type { 2265enum nl80211_channel_type {
2258 NL80211_CHAN_NO_HT, 2266 NL80211_CHAN_NO_HT,
2259 NL80211_CHAN_HT20, 2267 NL80211_CHAN_HT20,
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 83d800c31e3c..ac9147778a81 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -845,7 +845,7 @@ struct mesh_setup {
845 845
846/** 846/**
847 * struct ieee80211_txq_params - TX queue parameters 847 * struct ieee80211_txq_params - TX queue parameters
848 * @queue: TX queue identifier (NL80211_TXQ_Q_*) 848 * @ac: AC identifier
849 * @txop: Maximum burst time in units of 32 usecs, 0 meaning disabled 849 * @txop: Maximum burst time in units of 32 usecs, 0 meaning disabled
850 * @cwmin: Minimum contention window [a value of the form 2^n-1 in the range 850 * @cwmin: Minimum contention window [a value of the form 2^n-1 in the range
851 * 1..32767] 851 * 1..32767]
@@ -854,7 +854,7 @@ struct mesh_setup {
854 * @aifs: Arbitration interframe space [0..255] 854 * @aifs: Arbitration interframe space [0..255]
855 */ 855 */
856struct ieee80211_txq_params { 856struct ieee80211_txq_params {
857 enum nl80211_txq_q queue; 857 enum nl80211_ac ac;
858 u16 txop; 858 u16 txop;
859 u16 cwmin; 859 u16 cwmin;
860 u16 cwmax; 860 u16 cwmax;
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index a0e79d13fa8b..43f4609ab5f0 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -2222,7 +2222,7 @@ struct ieee80211_ops {
2222 struct ieee80211_sta *sta, 2222 struct ieee80211_sta *sta,
2223 u32 changed); 2223 u32 changed);
2224 int (*conf_tx)(struct ieee80211_hw *hw, 2224 int (*conf_tx)(struct ieee80211_hw *hw,
2225 struct ieee80211_vif *vif, u16 queue, 2225 struct ieee80211_vif *vif, u16 ac,
2226 const struct ieee80211_tx_queue_params *params); 2226 const struct ieee80211_tx_queue_params *params);
2227 u64 (*get_tsf)(struct ieee80211_hw *hw, struct ieee80211_vif *vif); 2227 u64 (*get_tsf)(struct ieee80211_hw *hw, struct ieee80211_vif *vif);
2228 void (*set_tsf)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 2228 void (*set_tsf)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 677d65929780..ef40db5ab3c7 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -1449,14 +1449,14 @@ static int ieee80211_set_txq_params(struct wiphy *wiphy,
1449 */ 1449 */
1450 p.uapsd = false; 1450 p.uapsd = false;
1451 1451
1452 if (params->queue >= local->hw.queues) 1452 if (params->ac >= local->hw.queues)
1453 return -EINVAL; 1453 return -EINVAL;
1454 1454
1455 sdata->tx_conf[params->queue] = p; 1455 sdata->tx_conf[params->ac] = p;
1456 if (drv_conf_tx(local, sdata, params->queue, &p)) { 1456 if (drv_conf_tx(local, sdata, params->ac, &p)) {
1457 wiphy_debug(local->hw.wiphy, 1457 wiphy_debug(local->hw.wiphy,
1458 "failed to set TX queue parameters for queue %d\n", 1458 "failed to set TX queue parameters for AC %d\n",
1459 params->queue); 1459 params->ac);
1460 return -EINVAL; 1460 return -EINVAL;
1461 } 1461 }
1462 1462
diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h
index 0eb2bc003058..8ad40f68f2c3 100644
--- a/net/mac80211/driver-ops.h
+++ b/net/mac80211/driver-ops.h
@@ -492,7 +492,7 @@ static inline void drv_sta_rc_update(struct ieee80211_local *local,
492} 492}
493 493
494static inline int drv_conf_tx(struct ieee80211_local *local, 494static inline int drv_conf_tx(struct ieee80211_local *local,
495 struct ieee80211_sub_if_data *sdata, u16 queue, 495 struct ieee80211_sub_if_data *sdata, u16 ac,
496 const struct ieee80211_tx_queue_params *params) 496 const struct ieee80211_tx_queue_params *params)
497{ 497{
498 int ret = -EOPNOTSUPP; 498 int ret = -EOPNOTSUPP;
@@ -501,10 +501,10 @@ static inline int drv_conf_tx(struct ieee80211_local *local,
501 501
502 check_sdata_in_driver(sdata); 502 check_sdata_in_driver(sdata);
503 503
504 trace_drv_conf_tx(local, sdata, queue, params); 504 trace_drv_conf_tx(local, sdata, ac, params);
505 if (local->ops->conf_tx) 505 if (local->ops->conf_tx)
506 ret = local->ops->conf_tx(&local->hw, &sdata->vif, 506 ret = local->ops->conf_tx(&local->hw, &sdata->vif,
507 queue, params); 507 ac, params);
508 trace_drv_return_int(local, ret); 508 trace_drv_return_int(local, ret);
509 return ret; 509 return ret;
510} 510}
diff --git a/net/mac80211/driver-trace.h b/net/mac80211/driver-trace.h
index 7ea544d86436..d1f017a11988 100644
--- a/net/mac80211/driver-trace.h
+++ b/net/mac80211/driver-trace.h
@@ -705,15 +705,14 @@ TRACE_EVENT(drv_sta_remove,
705TRACE_EVENT(drv_conf_tx, 705TRACE_EVENT(drv_conf_tx,
706 TP_PROTO(struct ieee80211_local *local, 706 TP_PROTO(struct ieee80211_local *local,
707 struct ieee80211_sub_if_data *sdata, 707 struct ieee80211_sub_if_data *sdata,
708 u16 queue, 708 u16 ac, const struct ieee80211_tx_queue_params *params),
709 const struct ieee80211_tx_queue_params *params),
710 709
711 TP_ARGS(local, sdata, queue, params), 710 TP_ARGS(local, sdata, ac, params),
712 711
713 TP_STRUCT__entry( 712 TP_STRUCT__entry(
714 LOCAL_ENTRY 713 LOCAL_ENTRY
715 VIF_ENTRY 714 VIF_ENTRY
716 __field(u16, queue) 715 __field(u16, ac)
717 __field(u16, txop) 716 __field(u16, txop)
718 __field(u16, cw_min) 717 __field(u16, cw_min)
719 __field(u16, cw_max) 718 __field(u16, cw_max)
@@ -724,7 +723,7 @@ TRACE_EVENT(drv_conf_tx,
724 TP_fast_assign( 723 TP_fast_assign(
725 LOCAL_ASSIGN; 724 LOCAL_ASSIGN;
726 VIF_ASSIGN; 725 VIF_ASSIGN;
727 __entry->queue = queue; 726 __entry->ac = ac;
728 __entry->txop = params->txop; 727 __entry->txop = params->txop;
729 __entry->cw_max = params->cw_max; 728 __entry->cw_max = params->cw_max;
730 __entry->cw_min = params->cw_min; 729 __entry->cw_min = params->cw_min;
@@ -733,8 +732,8 @@ TRACE_EVENT(drv_conf_tx,
733 ), 732 ),
734 733
735 TP_printk( 734 TP_printk(
736 LOCAL_PR_FMT VIF_PR_FMT " queue:%d", 735 LOCAL_PR_FMT VIF_PR_FMT " AC:%d",
737 LOCAL_PR_ARG, VIF_PR_ARG, __entry->queue 736 LOCAL_PR_ARG, VIF_PR_ARG, __entry->ac
738 ) 737 )
739); 738);
740 739
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index e49da2797022..344697df1177 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -1104,17 +1104,20 @@ static const struct nla_policy txq_params_policy[NL80211_TXQ_ATTR_MAX + 1] = {
1104static int parse_txq_params(struct nlattr *tb[], 1104static int parse_txq_params(struct nlattr *tb[],
1105 struct ieee80211_txq_params *txq_params) 1105 struct ieee80211_txq_params *txq_params)
1106{ 1106{
1107 if (!tb[NL80211_TXQ_ATTR_QUEUE] || !tb[NL80211_TXQ_ATTR_TXOP] || 1107 if (!tb[NL80211_TXQ_ATTR_AC] || !tb[NL80211_TXQ_ATTR_TXOP] ||
1108 !tb[NL80211_TXQ_ATTR_CWMIN] || !tb[NL80211_TXQ_ATTR_CWMAX] || 1108 !tb[NL80211_TXQ_ATTR_CWMIN] || !tb[NL80211_TXQ_ATTR_CWMAX] ||
1109 !tb[NL80211_TXQ_ATTR_AIFS]) 1109 !tb[NL80211_TXQ_ATTR_AIFS])
1110 return -EINVAL; 1110 return -EINVAL;
1111 1111
1112 txq_params->queue = nla_get_u8(tb[NL80211_TXQ_ATTR_QUEUE]); 1112 txq_params->ac = nla_get_u8(tb[NL80211_TXQ_ATTR_AC]);
1113 txq_params->txop = nla_get_u16(tb[NL80211_TXQ_ATTR_TXOP]); 1113 txq_params->txop = nla_get_u16(tb[NL80211_TXQ_ATTR_TXOP]);
1114 txq_params->cwmin = nla_get_u16(tb[NL80211_TXQ_ATTR_CWMIN]); 1114 txq_params->cwmin = nla_get_u16(tb[NL80211_TXQ_ATTR_CWMIN]);
1115 txq_params->cwmax = nla_get_u16(tb[NL80211_TXQ_ATTR_CWMAX]); 1115 txq_params->cwmax = nla_get_u16(tb[NL80211_TXQ_ATTR_CWMAX]);
1116 txq_params->aifs = nla_get_u8(tb[NL80211_TXQ_ATTR_AIFS]); 1116 txq_params->aifs = nla_get_u8(tb[NL80211_TXQ_ATTR_AIFS]);
1117 1117
1118 if (txq_params->ac >= NL80211_NUM_ACS)
1119 return -EINVAL;
1120
1118 return 0; 1121 return 0;
1119} 1122}
1120 1123