* [PATCH 1/3] wireless: add support for ethtool_ops->{get, set}_ringparam @ 2011-03-09 16:21 John W. Linville 2011-03-09 16:21 ` [PATCH 2/3] mac80211: implement support for cfg80211_ops->{get, set}_ringparam John W. Linville ` (3 more replies) 0 siblings, 4 replies; 7+ messages in thread From: John W. Linville @ 2011-03-09 16:21 UTC (permalink / raw) To: linux-wireless; +Cc: me, bloat-devel, mickflemm Signed-off-by: John W. Linville <linville@tuxdriver.com> --- include/net/cfg80211.h | 4 ++++ net/wireless/ethtool.c | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 0 deletions(-) diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index 1ac5786..25f546f 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h @@ -1364,6 +1364,10 @@ struct cfg80211_ops { int (*set_antenna)(struct wiphy *wiphy, u32 tx_ant, u32 rx_ant); int (*get_antenna)(struct wiphy *wiphy, u32 *tx_ant, u32 *rx_ant); + + int (*set_ringparam)(struct wiphy *wiphy, u32 tx, u32 rx); + void (*get_ringparam)(struct wiphy *wiphy, + u32 *tx, u32 *tx_max, u32 *rx, u32 *rx_max); }; /* diff --git a/net/wireless/ethtool.c b/net/wireless/ethtool.c index ca4c825..9bde4d1 100644 --- a/net/wireless/ethtool.c +++ b/net/wireless/ethtool.c @@ -1,5 +1,6 @@ #include <linux/utsname.h> #include <net/cfg80211.h> +#include "core.h" #include "ethtool.h" static void cfg80211_get_drvinfo(struct net_device *dev, @@ -37,9 +38,41 @@ static void cfg80211_get_regs(struct net_device *dev, struct ethtool_regs *regs, regs->len = 0; } +static void cfg80211_get_ringparam(struct net_device *dev, + struct ethtool_ringparam *rp) +{ + struct wireless_dev *wdev = dev->ieee80211_ptr; + struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); + + memset(rp, 0, sizeof(*rp)); + + if (rdev->ops->get_ringparam) + rdev->ops->get_ringparam(wdev->wiphy, + &rp->tx_pending, &rp->tx_max_pending, + &rp->rx_pending, &rp->rx_max_pending); +} + +static int cfg80211_set_ringparam(struct net_device *dev, + struct ethtool_ringparam *rp) +{ + struct wireless_dev *wdev = dev->ieee80211_ptr; + struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); + + if (rp->rx_mini_pending != 0 || rp->rx_jumbo_pending != 0) + return -EINVAL; + + if (rdev->ops->set_ringparam) + return rdev->ops->set_ringparam(wdev->wiphy, + rp->tx_pending, rp->rx_pending); + + return -ENOTSUPP; +} + const struct ethtool_ops cfg80211_ethtool_ops = { .get_drvinfo = cfg80211_get_drvinfo, .get_regs_len = cfg80211_get_regs_len, .get_regs = cfg80211_get_regs, .get_link = ethtool_op_get_link, + .get_ringparam = cfg80211_get_ringparam, + .set_ringparam = cfg80211_set_ringparam, }; -- 1.7.4 ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 2/3] mac80211: implement support for cfg80211_ops->{get, set}_ringparam 2011-03-09 16:21 [PATCH 1/3] wireless: add support for ethtool_ops->{get, set}_ringparam John W. Linville @ 2011-03-09 16:21 ` John W. Linville 2011-03-09 20:23 ` [PATCH v2 " John W. Linville 2011-03-09 16:21 ` [PATCH 3/3] ath5k: implement ieee80211_ops->{get,set}_ringparam John W. Linville ` (2 subsequent siblings) 3 siblings, 1 reply; 7+ messages in thread From: John W. Linville @ 2011-03-09 16:21 UTC (permalink / raw) To: linux-wireless; +Cc: me, bloat-devel, mickflemm Signed-off-by: John W. Linville <linville@tuxdriver.com> --- include/net/mac80211.h | 3 ++ net/mac80211/cfg.c | 17 ++++++++++++++ net/mac80211/driver-ops.h | 26 +++++++++++++++++++++ net/mac80211/driver-trace.h | 52 +++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 98 insertions(+), 0 deletions(-) diff --git a/include/net/mac80211.h b/include/net/mac80211.h index 2b072fa..b602c66 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h @@ -1888,6 +1888,9 @@ struct ieee80211_ops { enum nl80211_channel_type channel_type, unsigned int wait); int (*offchannel_tx_cancel_wait)(struct ieee80211_hw *hw); + int (*set_ringparam)(struct ieee80211_hw *hw, u32 tx, u32 rx); + void (*get_ringparam)(struct ieee80211_hw *hw, + u32 *tx, u32 *tx_max, u32 *rx, u32 *rx_max); }; /** diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index 7b701dc..bd1791c 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c @@ -2008,6 +2008,21 @@ static int ieee80211_get_antenna(struct wiphy *wiphy, u32 *tx_ant, u32 *rx_ant) return drv_get_antenna(local, tx_ant, rx_ant); } +static int ieee80211_set_ringparam(struct wiphy *wiphy, u32 tx, u32 rx) +{ + struct ieee80211_local *local = wiphy_priv(wiphy); + + return drv_set_ringparam(local, tx, rx); +} + +static void ieee80211_get_ringparam(struct wiphy *wiphy, + u32 *tx, u32 *tx_max, u32 *rx, u32 *rx_max) +{ + struct ieee80211_local *local = wiphy_priv(wiphy); + + drv_get_ringparam(local, tx, tx_max, rx, rx_max); +} + struct cfg80211_ops mac80211_config_ops = { .add_virtual_intf = ieee80211_add_iface, .del_virtual_intf = ieee80211_del_iface, @@ -2065,4 +2080,6 @@ struct cfg80211_ops mac80211_config_ops = { .mgmt_frame_register = ieee80211_mgmt_frame_register, .set_antenna = ieee80211_set_antenna, .get_antenna = ieee80211_get_antenna, + .set_ringparam = ieee80211_set_ringparam, + .get_ringparam = ieee80211_get_ringparam, }; diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h index 3729296..9c0d62b 100644 --- a/net/mac80211/driver-ops.h +++ b/net/mac80211/driver-ops.h @@ -526,4 +526,30 @@ static inline int drv_offchannel_tx_cancel_wait(struct ieee80211_local *local) return ret; } +static inline int drv_set_ringparam(struct ieee80211_local *local, + u32 tx, u32 rx) +{ + int ret = -ENOTSUPP; + + might_sleep(); + + trace_drv_set_ringparam(local, tx, rx); + if (local->ops->set_ringparam) + ret = local->ops->set_ringparam(&local->hw, tx, rx); + trace_drv_return_int(local, ret); + + return ret; +} + +static inline void drv_get_ringparam(struct ieee80211_local *local, + u32 *tx, u32 *tx_max, u32 *rx, u32 *rx_max) +{ + might_sleep(); + + trace_drv_get_ringparam(local, tx, tx_max, rx, rx_max); + if (local->ops->get_ringparam) + local->ops->get_ringparam(&local->hw, tx, tx_max, rx, rx_max); + trace_drv_return_void(local); +} + #endif /* __MAC80211_DRIVER_OPS */ diff --git a/net/mac80211/driver-trace.h b/net/mac80211/driver-trace.h index 520fe24..f50ae2c 100644 --- a/net/mac80211/driver-trace.h +++ b/net/mac80211/driver-trace.h @@ -912,6 +912,58 @@ TRACE_EVENT(drv_offchannel_tx, ) ); +TRACE_EVENT(drv_set_ringparam, + TP_PROTO(struct ieee80211_local *local, u32 tx, u32 rx), + + TP_ARGS(local, tx, rx), + + TP_STRUCT__entry( + LOCAL_ENTRY + __field(u32, tx) + __field(u32, rx) + ), + + TP_fast_assign( + LOCAL_ASSIGN; + __entry->tx = tx; + __entry->rx = rx; + ), + + TP_printk( + LOCAL_PR_FMT " tx:%d rx %d", + LOCAL_PR_ARG, __entry->tx, __entry->rx, + ) +); + +TRACE_EVENT(drv_get_ringparam, + TP_PROTO(struct ieee80211_local *local, u32 *tx, u32 *tx_max, + u32 *rx, u32 *rx_max), + + TP_ARGS(local, tx, tx_max, rx, rx_max), + + TP_STRUCT__entry( + LOCAL_ENTRY + __field(u32, tx) + __field(u32, tx_max) + __field(u32, rx) + __field(u32, rx_max) + ), + + TP_fast_assign( + LOCAL_ASSIGN; + __entry->tx = *tx; + __entry->tx_max = *tx_max; + __entry->rx = *rx; + __entry->rx_max = *rx_max; + ), + + TP_printk( + LOCAL_PR_FMT " tx:%d tx_max %d rx %d rx_max %d", + LOCAL_PR_ARG, + __entry->tx, __entry->tx_max, __entry->rx, __entry->rx_max, + ) +); + DEFINE_EVENT(local_only_evt, drv_offchannel_tx_cancel_wait, TP_PROTO(struct ieee80211_local *local), TP_ARGS(local) -- 1.7.4 ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v2 2/3] mac80211: implement support for cfg80211_ops->{get, set}_ringparam 2011-03-09 16:21 ` [PATCH 2/3] mac80211: implement support for cfg80211_ops->{get, set}_ringparam John W. Linville @ 2011-03-09 20:23 ` John W. Linville 0 siblings, 0 replies; 7+ messages in thread From: John W. Linville @ 2011-03-09 20:23 UTC (permalink / raw) To: linux-wireless; +Cc: me, johannes, bloat-devel, mickflemm Signed-off-by: John W. Linville <linville@tuxdriver.com> --- include/net/mac80211.h | 7 +++++ net/mac80211/cfg.c | 17 ++++++++++++++ net/mac80211/driver-ops.h | 26 +++++++++++++++++++++ net/mac80211/driver-trace.h | 52 +++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 102 insertions(+), 0 deletions(-) diff --git a/include/net/mac80211.h b/include/net/mac80211.h index 2b072fa..8650e7b 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h @@ -1804,6 +1804,10 @@ enum ieee80211_ampdu_mlme_action { * return value is 1, then the @remain_on_channel will be used with a * regular transmission (if supported.) * @offchannel_tx_cancel_wait: cancel wait associated with offchannel TX + * + * @set_ringparam: Set tx and rx ring sizes. + * + * @get_ringparam: Get tx and rx ring current and maximum sizes. */ struct ieee80211_ops { void (*tx)(struct ieee80211_hw *hw, struct sk_buff *skb); @@ -1888,6 +1892,9 @@ struct ieee80211_ops { enum nl80211_channel_type channel_type, unsigned int wait); int (*offchannel_tx_cancel_wait)(struct ieee80211_hw *hw); + int (*set_ringparam)(struct ieee80211_hw *hw, u32 tx, u32 rx); + void (*get_ringparam)(struct ieee80211_hw *hw, + u32 *tx, u32 *tx_max, u32 *rx, u32 *rx_max); }; /** diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index 7b701dc..bd1791c 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c @@ -2008,6 +2008,21 @@ static int ieee80211_get_antenna(struct wiphy *wiphy, u32 *tx_ant, u32 *rx_ant) return drv_get_antenna(local, tx_ant, rx_ant); } +static int ieee80211_set_ringparam(struct wiphy *wiphy, u32 tx, u32 rx) +{ + struct ieee80211_local *local = wiphy_priv(wiphy); + + return drv_set_ringparam(local, tx, rx); +} + +static void ieee80211_get_ringparam(struct wiphy *wiphy, + u32 *tx, u32 *tx_max, u32 *rx, u32 *rx_max) +{ + struct ieee80211_local *local = wiphy_priv(wiphy); + + drv_get_ringparam(local, tx, tx_max, rx, rx_max); +} + struct cfg80211_ops mac80211_config_ops = { .add_virtual_intf = ieee80211_add_iface, .del_virtual_intf = ieee80211_del_iface, @@ -2065,4 +2080,6 @@ struct cfg80211_ops mac80211_config_ops = { .mgmt_frame_register = ieee80211_mgmt_frame_register, .set_antenna = ieee80211_set_antenna, .get_antenna = ieee80211_get_antenna, + .set_ringparam = ieee80211_set_ringparam, + .get_ringparam = ieee80211_get_ringparam, }; diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h index 3729296..9c0d62b 100644 --- a/net/mac80211/driver-ops.h +++ b/net/mac80211/driver-ops.h @@ -526,4 +526,30 @@ static inline int drv_offchannel_tx_cancel_wait(struct ieee80211_local *local) return ret; } +static inline int drv_set_ringparam(struct ieee80211_local *local, + u32 tx, u32 rx) +{ + int ret = -ENOTSUPP; + + might_sleep(); + + trace_drv_set_ringparam(local, tx, rx); + if (local->ops->set_ringparam) + ret = local->ops->set_ringparam(&local->hw, tx, rx); + trace_drv_return_int(local, ret); + + return ret; +} + +static inline void drv_get_ringparam(struct ieee80211_local *local, + u32 *tx, u32 *tx_max, u32 *rx, u32 *rx_max) +{ + might_sleep(); + + trace_drv_get_ringparam(local, tx, tx_max, rx, rx_max); + if (local->ops->get_ringparam) + local->ops->get_ringparam(&local->hw, tx, tx_max, rx, rx_max); + trace_drv_return_void(local); +} + #endif /* __MAC80211_DRIVER_OPS */ diff --git a/net/mac80211/driver-trace.h b/net/mac80211/driver-trace.h index 520fe24..f50ae2c 100644 --- a/net/mac80211/driver-trace.h +++ b/net/mac80211/driver-trace.h @@ -912,6 +912,58 @@ TRACE_EVENT(drv_offchannel_tx, ) ); +TRACE_EVENT(drv_set_ringparam, + TP_PROTO(struct ieee80211_local *local, u32 tx, u32 rx), + + TP_ARGS(local, tx, rx), + + TP_STRUCT__entry( + LOCAL_ENTRY + __field(u32, tx) + __field(u32, rx) + ), + + TP_fast_assign( + LOCAL_ASSIGN; + __entry->tx = tx; + __entry->rx = rx; + ), + + TP_printk( + LOCAL_PR_FMT " tx:%d rx %d", + LOCAL_PR_ARG, __entry->tx, __entry->rx, + ) +); + +TRACE_EVENT(drv_get_ringparam, + TP_PROTO(struct ieee80211_local *local, u32 *tx, u32 *tx_max, + u32 *rx, u32 *rx_max), + + TP_ARGS(local, tx, tx_max, rx, rx_max), + + TP_STRUCT__entry( + LOCAL_ENTRY + __field(u32, tx) + __field(u32, tx_max) + __field(u32, rx) + __field(u32, rx_max) + ), + + TP_fast_assign( + LOCAL_ASSIGN; + __entry->tx = *tx; + __entry->tx_max = *tx_max; + __entry->rx = *rx; + __entry->rx_max = *rx_max; + ), + + TP_printk( + LOCAL_PR_FMT " tx:%d tx_max %d rx %d rx_max %d", + LOCAL_PR_ARG, + __entry->tx, __entry->tx_max, __entry->rx, __entry->rx_max, + ) +); + DEFINE_EVENT(local_only_evt, drv_offchannel_tx_cancel_wait, TP_PROTO(struct ieee80211_local *local), TP_ARGS(local) -- 1.7.4 ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 3/3] ath5k: implement ieee80211_ops->{get,set}_ringparam 2011-03-09 16:21 [PATCH 1/3] wireless: add support for ethtool_ops->{get, set}_ringparam John W. Linville 2011-03-09 16:21 ` [PATCH 2/3] mac80211: implement support for cfg80211_ops->{get, set}_ringparam John W. Linville @ 2011-03-09 16:21 ` John W. Linville 2011-03-09 20:34 ` Sedat Dilek 2011-03-09 16:46 ` [PATCH 1/3] wireless: add support for ethtool_ops->{get,set}_ringparam Johannes Berg 2011-03-09 20:23 ` [PATCH v2 1/3] wireless: add support for ethtool_ops->{get, set}_ringparam John W. Linville 3 siblings, 1 reply; 7+ messages in thread From: John W. Linville @ 2011-03-09 16:21 UTC (permalink / raw) To: linux-wireless; +Cc: me, bloat-devel, mickflemm set_ringparam only allows changes to tx ring at this time. Signed-off-by: John W. Linville <linville@tuxdriver.com> --- drivers/net/wireless/ath/ath5k/base.c | 3 +- drivers/net/wireless/ath/ath5k/base.h | 1 + drivers/net/wireless/ath/ath5k/mac80211-ops.c | 43 +++++++++++++++++++++++++ 3 files changed, 46 insertions(+), 1 deletions(-) diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c index e6ff62e..4d7f21e 100644 --- a/drivers/net/wireless/ath/ath5k/base.c +++ b/drivers/net/wireless/ath/ath5k/base.c @@ -943,6 +943,7 @@ ath5k_txq_setup(struct ath5k_softc *sc, spin_lock_init(&txq->lock); txq->setup = true; txq->txq_len = 0; + txq->txq_max = ATH5K_TXQ_LEN_MAX; txq->txq_poll_mark = false; txq->txq_stuck = 0; } @@ -1534,7 +1535,7 @@ ath5k_tx_queue(struct ieee80211_hw *hw, struct sk_buff *skb, goto drop_packet; } - if (txq->txq_len >= ATH5K_TXQ_LEN_MAX) + if (txq->txq_len >= txq->txq_max) ieee80211_stop_queue(hw, txq->qnum); spin_lock_irqsave(&sc->txbuflock, flags); diff --git a/drivers/net/wireless/ath/ath5k/base.h b/drivers/net/wireless/ath/ath5k/base.h index 8d1df1f..978f1f4 100644 --- a/drivers/net/wireless/ath/ath5k/base.h +++ b/drivers/net/wireless/ath/ath5k/base.h @@ -86,6 +86,7 @@ struct ath5k_txq { spinlock_t lock; /* lock on q and link */ bool setup; int txq_len; /* number of queued buffers */ + int txq_max; /* max allowed num of queued buffers */ bool txq_poll_mark; unsigned int txq_stuck; /* informational counter */ }; diff --git a/drivers/net/wireless/ath/ath5k/mac80211-ops.c b/drivers/net/wireless/ath/ath5k/mac80211-ops.c index c9b0b67..9be29b7 100644 --- a/drivers/net/wireless/ath/ath5k/mac80211-ops.c +++ b/drivers/net/wireless/ath/ath5k/mac80211-ops.c @@ -740,6 +740,47 @@ ath5k_get_antenna(struct ieee80211_hw *hw, u32 *tx_ant, u32 *rx_ant) } +static void ath5k_get_ringparam(struct ieee80211_hw *hw, + u32 *tx, u32 *tx_max, u32 *rx, u32 *rx_max) +{ + struct ath5k_softc *sc = hw->priv; + + *tx = sc->txqs[AR5K_TX_QUEUE_ID_DATA_MIN].txq_max; + + *tx_max = ATH5K_TXQ_LEN_MAX; + *rx = *rx_max = ATH_RXBUF; +} + + +static int ath5k_set_ringparam(struct ieee80211_hw *hw, u32 tx, u32 rx) +{ + struct ath5k_softc *sc = hw->priv; + u16 qnum; + + /* only support setting tx ring size for now */ + if (rx != ATH_RXBUF) + return -EINVAL; + + /* restrict tx ring size min/max */ + if (!tx || tx > ATH5K_TXQ_LEN_MAX) + return -EINVAL; + + for (qnum = 0; qnum < ARRAY_SIZE(sc->txqs); qnum++) { + if (!sc->txqs[qnum].setup) + continue; + if (sc->txqs[qnum].qnum < AR5K_TX_QUEUE_ID_DATA_MIN || + sc->txqs[qnum].qnum > AR5K_TX_QUEUE_ID_DATA_MAX) + continue; + + sc->txqs[qnum].txq_max = tx; + if (sc->txqs[qnum].txq_len >= sc->txqs[qnum].txq_max) + ieee80211_stop_queue(hw, sc->txqs[qnum].qnum); + } + + return 0; +} + + const struct ieee80211_ops ath5k_hw_ops = { .tx = ath5k_tx, .start = ath5k_start, @@ -778,4 +819,6 @@ const struct ieee80211_ops ath5k_hw_ops = { /* .napi_poll = not implemented */ .set_antenna = ath5k_set_antenna, .get_antenna = ath5k_get_antenna, + .set_ringparam = ath5k_set_ringparam, + .get_ringparam = ath5k_get_ringparam, }; -- 1.7.4 ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 3/3] ath5k: implement ieee80211_ops->{get,set}_ringparam 2011-03-09 16:21 ` [PATCH 3/3] ath5k: implement ieee80211_ops->{get,set}_ringparam John W. Linville @ 2011-03-09 20:34 ` Sedat Dilek 0 siblings, 0 replies; 7+ messages in thread From: Sedat Dilek @ 2011-03-09 20:34 UTC (permalink / raw) To: John W. Linville; +Cc: bloat-devel, me, linux-wireless, mickflemm On Wed, Mar 9, 2011 at 5:21 PM, John W. Linville <linville@tuxdriver.com> wrote: > set_ringparam only allows changes to tx ring at this time. > > Signed-off-by: John W. Linville <linville@tuxdriver.com> > --- Yay, a step forward what concerns ath5k and debloat-testing! Tested against linux-next (next-20110309) with [1] and [2,3,4]. - Sedat - [1] https://patchwork.kernel.org/patch/619631/ [2] https://patchwork.kernel.org/patch/621791/ [3] https://patchwork.kernel.org/patch/621771/ [4] https://patchwork.kernel.org/patch/621781/ P.S.: My investigations... # lspci -nnvv | grep -i ath 02:02.0 Ethernet controller [0200]: Atheros Communications Inc. AR5212 802.11abg NIC [168c:1014] (rev 01) Kernel driver in use: ath5k # ethtool -G wlan0 tx 1 # ethtool -g wlan0 Ring parameters for wlan0: Pre-set maximums: RX: 40 RX Mini: 0 RX Jumbo: 0 TX: 50 Current hardware settings: RX: 40 RX Mini: 0 RX Jumbo: 0 TX: 1 - EOT - ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/3] wireless: add support for ethtool_ops->{get,set}_ringparam 2011-03-09 16:21 [PATCH 1/3] wireless: add support for ethtool_ops->{get, set}_ringparam John W. Linville 2011-03-09 16:21 ` [PATCH 2/3] mac80211: implement support for cfg80211_ops->{get, set}_ringparam John W. Linville 2011-03-09 16:21 ` [PATCH 3/3] ath5k: implement ieee80211_ops->{get,set}_ringparam John W. Linville @ 2011-03-09 16:46 ` Johannes Berg 2011-03-09 20:23 ` [PATCH v2 1/3] wireless: add support for ethtool_ops->{get, set}_ringparam John W. Linville 3 siblings, 0 replies; 7+ messages in thread From: Johannes Berg @ 2011-03-09 16:46 UTC (permalink / raw) To: John W. Linville; +Cc: bloat-devel, me, linux-wireless, mickflemm On Wed, 2011-03-09 at 11:21 -0500, John W. Linville wrote: > Signed-off-by: John W. Linville <linville@tuxdriver.com> > --- > include/net/cfg80211.h | 4 ++++ > net/wireless/ethtool.c | 33 +++++++++++++++++++++++++++++++++ > 2 files changed, 37 insertions(+), 0 deletions(-) > > diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h > index 1ac5786..25f546f 100644 > --- a/include/net/cfg80211.h > +++ b/include/net/cfg80211.h > @@ -1364,6 +1364,10 @@ struct cfg80211_ops { > > int (*set_antenna)(struct wiphy *wiphy, u32 tx_ant, u32 rx_ant); > int (*get_antenna)(struct wiphy *wiphy, u32 *tx_ant, u32 *rx_ant); > + > + int (*set_ringparam)(struct wiphy *wiphy, u32 tx, u32 rx); > + void (*get_ringparam)(struct wiphy *wiphy, > + u32 *tx, u32 *tx_max, u32 *rx, u32 *rx_max); Can you add docs here and in mac80211 please? johannes ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v2 1/3] wireless: add support for ethtool_ops->{get, set}_ringparam 2011-03-09 16:21 [PATCH 1/3] wireless: add support for ethtool_ops->{get, set}_ringparam John W. Linville ` (2 preceding siblings ...) 2011-03-09 16:46 ` [PATCH 1/3] wireless: add support for ethtool_ops->{get,set}_ringparam Johannes Berg @ 2011-03-09 20:23 ` John W. Linville 3 siblings, 0 replies; 7+ messages in thread From: John W. Linville @ 2011-03-09 20:23 UTC (permalink / raw) To: linux-wireless; +Cc: me, johannes, bloat-devel, mickflemm Signed-off-by: John W. Linville <linville@tuxdriver.com> --- include/net/cfg80211.h | 8 ++++++++ net/wireless/ethtool.c | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 0 deletions(-) diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index 1ac5786..60f7876 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h @@ -1197,6 +1197,10 @@ struct cfg80211_pmksa { * (also see nl80211.h @NL80211_ATTR_WIPHY_ANTENNA_TX). * * @get_antenna: Get current antenna configuration from device (tx_ant, rx_ant). + * + * @set_ringparam: Set tx and rx ring sizes. + * + * @get_ringparam: Get tx and rx ring current and maximum sizes. */ struct cfg80211_ops { int (*suspend)(struct wiphy *wiphy); @@ -1364,6 +1368,10 @@ struct cfg80211_ops { int (*set_antenna)(struct wiphy *wiphy, u32 tx_ant, u32 rx_ant); int (*get_antenna)(struct wiphy *wiphy, u32 *tx_ant, u32 *rx_ant); + + int (*set_ringparam)(struct wiphy *wiphy, u32 tx, u32 rx); + void (*get_ringparam)(struct wiphy *wiphy, + u32 *tx, u32 *tx_max, u32 *rx, u32 *rx_max); }; /* diff --git a/net/wireless/ethtool.c b/net/wireless/ethtool.c index ca4c825..9bde4d1 100644 --- a/net/wireless/ethtool.c +++ b/net/wireless/ethtool.c @@ -1,5 +1,6 @@ #include <linux/utsname.h> #include <net/cfg80211.h> +#include "core.h" #include "ethtool.h" static void cfg80211_get_drvinfo(struct net_device *dev, @@ -37,9 +38,41 @@ static void cfg80211_get_regs(struct net_device *dev, struct ethtool_regs *regs, regs->len = 0; } +static void cfg80211_get_ringparam(struct net_device *dev, + struct ethtool_ringparam *rp) +{ + struct wireless_dev *wdev = dev->ieee80211_ptr; + struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); + + memset(rp, 0, sizeof(*rp)); + + if (rdev->ops->get_ringparam) + rdev->ops->get_ringparam(wdev->wiphy, + &rp->tx_pending, &rp->tx_max_pending, + &rp->rx_pending, &rp->rx_max_pending); +} + +static int cfg80211_set_ringparam(struct net_device *dev, + struct ethtool_ringparam *rp) +{ + struct wireless_dev *wdev = dev->ieee80211_ptr; + struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); + + if (rp->rx_mini_pending != 0 || rp->rx_jumbo_pending != 0) + return -EINVAL; + + if (rdev->ops->set_ringparam) + return rdev->ops->set_ringparam(wdev->wiphy, + rp->tx_pending, rp->rx_pending); + + return -ENOTSUPP; +} + const struct ethtool_ops cfg80211_ethtool_ops = { .get_drvinfo = cfg80211_get_drvinfo, .get_regs_len = cfg80211_get_regs_len, .get_regs = cfg80211_get_regs, .get_link = ethtool_op_get_link, + .get_ringparam = cfg80211_get_ringparam, + .set_ringparam = cfg80211_set_ringparam, }; -- 1.7.4 ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2011-03-09 20:35 UTC | newest] Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2011-03-09 16:21 [PATCH 1/3] wireless: add support for ethtool_ops->{get, set}_ringparam John W. Linville 2011-03-09 16:21 ` [PATCH 2/3] mac80211: implement support for cfg80211_ops->{get, set}_ringparam John W. Linville 2011-03-09 20:23 ` [PATCH v2 " John W. Linville 2011-03-09 16:21 ` [PATCH 3/3] ath5k: implement ieee80211_ops->{get,set}_ringparam John W. Linville 2011-03-09 20:34 ` Sedat Dilek 2011-03-09 16:46 ` [PATCH 1/3] wireless: add support for ethtool_ops->{get,set}_ringparam Johannes Berg 2011-03-09 20:23 ` [PATCH v2 1/3] wireless: add support for ethtool_ops->{get, set}_ringparam John W. Linville
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox