linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] mac80211: add support to set_coalesce
@ 2015-10-24 18:50 Olav Haugan
  2015-10-24 18:50 ` [PATCH 2/2] ath9k: implement set_coalesce callback Olav Haugan
  2015-10-30  9:59 ` [PATCH 1/2] mac80211: add support to set_coalesce Johannes Berg
  0 siblings, 2 replies; 7+ messages in thread
From: Olav Haugan @ 2015-10-24 18:50 UTC (permalink / raw)
  To: johannes, linux-wireless; +Cc: davem, kvalo, ath9k-devel, Olav Haugan

Add ops in mac80211 and corresponding driver calls.
Add trace event for set_coalesce.

Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
---
 include/net/mac80211.h    |  4 ++++
 net/mac80211/cfg.c        |  9 +++++++++
 net/mac80211/driver-ops.h | 12 ++++++++++++
 net/mac80211/trace.h      |  5 +++++
 4 files changed, 30 insertions(+)

diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index bfc5694..8bd7ccb 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -3232,6 +3232,8 @@ enum ieee80211_reconfig_type {
  *	the function call.
  *
  * @wake_tx_queue: Called when new packets have been added to the queue.
+ *
+ * @set_coalesce: Set coalesce parameters.
  */
 struct ieee80211_ops {
 	void (*tx)(struct ieee80211_hw *hw,
@@ -3467,6 +3469,8 @@ struct ieee80211_ops {
 
 	void (*wake_tx_queue)(struct ieee80211_hw *hw,
 			      struct ieee80211_txq *txq);
+	int (*set_coalesce)(struct ieee80211_hw *hw,
+			    struct cfg80211_coalesce *coalesce);
 };
 
 /**
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 7a77a14..affd8ab 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -3810,6 +3810,14 @@ static int ieee80211_del_tx_ts(struct wiphy *wiphy, struct net_device *dev,
 	return -ENOENT;
 }
 
+static int ieee80211_set_coalesce(struct wiphy *wiphy,
+				  struct cfg80211_coalesce *coalesce)
+{
+	struct ieee80211_local *local = wiphy_priv(wiphy);
+
+	return drv_set_coalesce(local, coalesce);
+}
+
 const struct cfg80211_ops mac80211_config_ops = {
 	.add_virtual_intf = ieee80211_add_iface,
 	.del_virtual_intf = ieee80211_del_iface,
@@ -3894,4 +3902,5 @@ const struct cfg80211_ops mac80211_config_ops = {
 	.set_ap_chanwidth = ieee80211_set_ap_chanwidth,
 	.add_tx_ts = ieee80211_add_tx_ts,
 	.del_tx_ts = ieee80211_del_tx_ts,
+	.set_coalesce = ieee80211_set_coalesce,
 };
diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h
index 02d9133..49856e1 100644
--- a/net/mac80211/driver-ops.h
+++ b/net/mac80211/driver-ops.h
@@ -1355,4 +1355,16 @@ static inline void drv_wake_tx_queue(struct ieee80211_local *local,
 	local->ops->wake_tx_queue(&local->hw, &txq->txq);
 }
 
+static inline int drv_set_coalesce(struct ieee80211_local *local,
+				   struct cfg80211_coalesce *coalesce)
+{
+	u32 ret = 0;
+
+	trace_drv_set_coalesce(local);
+	if (local->ops->set_coalesce)
+		ret = local->ops->set_coalesce(&local->hw, coalesce);
+	trace_drv_return_u32(local, ret);
+	return ret;
+}
+
 #endif /* __MAC80211_DRIVER_OPS */
diff --git a/net/mac80211/trace.h b/net/mac80211/trace.h
index 6f14591..ff1173b 100644
--- a/net/mac80211/trace.h
+++ b/net/mac80211/trace.h
@@ -1655,6 +1655,11 @@ TRACE_EVENT(drv_get_expected_throughput,
 	)
 );
 
+DEFINE_EVENT(local_only_evt, drv_set_coalesce,
+	     TP_PROTO(struct ieee80211_local *local),
+	     TP_ARGS(local)
+);
+
 /*
  * Tracing for API calls that drivers call.
  */
-- 
2.6.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/2] ath9k: implement set_coalesce callback
  2015-10-24 18:50 [PATCH 1/2] mac80211: add support to set_coalesce Olav Haugan
@ 2015-10-24 18:50 ` Olav Haugan
  2015-10-30 10:00   ` Johannes Berg
  2015-10-30  9:59 ` [PATCH 1/2] mac80211: add support to set_coalesce Johannes Berg
  1 sibling, 1 reply; 7+ messages in thread
From: Olav Haugan @ 2015-10-24 18:50 UTC (permalink / raw)
  To: johannes, linux-wireless; +Cc: davem, kvalo, ath9k-devel, Olav Haugan

implement set_coalesce ieee80211_ops callback. Add default
wiphy_coalesce_support rules for 9k. These rules are not being used by 9k
since 9k can just toggle coalesce as on/off.

Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
---
 drivers/net/wireless/ath/ath9k/init.c | 19 +++++++++++++++++++
 drivers/net/wireless/ath/ath9k/main.c | 19 +++++++++++++++++++
 2 files changed, 38 insertions(+)

diff --git a/drivers/net/wireless/ath/ath9k/init.c b/drivers/net/wireless/ath/ath9k/init.c
index 57f95f2..10637f5 100644
--- a/drivers/net/wireless/ath/ath9k/init.c
+++ b/drivers/net/wireless/ath/ath9k/init.c
@@ -86,6 +86,24 @@ static const struct ieee80211_tpt_blink ath9k_tpt_blink[] = {
 };
 #endif
 
+/* 9k coalesce is binary (on/off) the below rules are
+ * not being used. Only there to give default values to
+ * wiphy_coalesce_support struct fields
+ */
+#define ATH9K_COALESCE_MAX_RULES     1
+#define ATH9K_COALESCE_MAX_FILTERS   1
+#define ATH9K_MAX_COALESCING_DELAY   1     /* in msecs */
+#define ATH9K_MAX_PATTERN_LEN        1
+#define ATH9K_MAX_OFFSET_LEN         1
+static const struct wiphy_coalesce_support ath9k_coalesce_support = {
+	.n_rules = ATH9K_COALESCE_MAX_RULES,
+	.max_delay = ATH9K_MAX_COALESCING_DELAY,
+	.n_patterns = ATH9K_COALESCE_MAX_FILTERS,
+	.pattern_min_len = 1,
+	.pattern_max_len = ATH9K_MAX_PATTERN_LEN,
+	.max_pkt_offset = ATH9K_MAX_OFFSET_LEN,
+};
+
 static void ath9k_deinit_softc(struct ath_softc *sc);
 
 static void ath9k_op_ps_wakeup(struct ath_common *common)
@@ -898,6 +916,7 @@ static void ath9k_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw)
 		hw->wiphy->bands[IEEE80211_BAND_5GHZ] =
 			&common->sbands[IEEE80211_BAND_5GHZ];
 
+	hw->wiphy->coalesce = &ath9k_coalesce_support;
 #ifdef CONFIG_ATH9K_CHANNEL_CONTEXT
 	ath9k_set_mcc_capab(sc, hw);
 #endif
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index c27143b..7595d5d 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -2611,6 +2611,24 @@ static int ath9k_get_txpower(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
 	return 0;
 }
 
+/* ath9k coalesce support */
+static int ath9k_set_coalesce(struct ieee80211_hw *hw,
+			      struct cfg80211_coalesce *coalesce)
+{
+	struct ath_softc *sc = hw->priv;
+	struct ath_hw *ah = sc->sc_ah;
+
+	if (!coalesce) {
+		ah->config.rx_intr_mitigation = false;
+		ath9k_hw_set_interrupts(ah);
+	} else {
+		ah->config.rx_intr_mitigation = true;
+		ath9k_hw_set_interrupts(ah);
+	}
+
+	return 0;
+}
+
 struct ieee80211_ops ath9k_ops = {
 	.tx 		    = ath9k_tx,
 	.start 		    = ath9k_start,
@@ -2639,6 +2657,7 @@ struct ieee80211_ops ath9k_ops = {
 	.get_stats	    = ath9k_get_stats,
 	.set_antenna	    = ath9k_set_antenna,
 	.get_antenna	    = ath9k_get_antenna,
+	.set_coalesce       = ath9k_set_coalesce,
 
 #ifdef CONFIG_ATH9K_WOW
 	.suspend	    = ath9k_suspend,
-- 
2.6.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/2] mac80211: add support to set_coalesce
  2015-10-24 18:50 [PATCH 1/2] mac80211: add support to set_coalesce Olav Haugan
  2015-10-24 18:50 ` [PATCH 2/2] ath9k: implement set_coalesce callback Olav Haugan
@ 2015-10-30  9:59 ` Johannes Berg
  2015-11-23  4:02   ` Olav Haugan
  1 sibling, 1 reply; 7+ messages in thread
From: Johannes Berg @ 2015-10-30  9:59 UTC (permalink / raw)
  To: Olav Haugan, linux-wireless; +Cc: davem, kvalo, ath9k-devel


> +++ b/net/mac80211/driver-ops.h
> @@ -1355,4 +1355,16 @@ static inline void drv_wake_tx_queue(struct 
> ieee80211_local *local,
>  	local->ops->wake_tx_queue(&local->hw, &txq->txq);
>  }
>  
> +static inline int drv_set_coalesce(struct ieee80211_local *local,
> +				   struct cfg80211_coalesce 
> *coalesce)
> +{
> +	u32 ret = 0;
> 
This doesn't seem right - now you're accepting any call even if it's
not really done by the driver?

johannes


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/2] ath9k: implement set_coalesce callback
  2015-10-24 18:50 ` [PATCH 2/2] ath9k: implement set_coalesce callback Olav Haugan
@ 2015-10-30 10:00   ` Johannes Berg
  2015-11-23  4:12     ` Olav Haugan
  0 siblings, 1 reply; 7+ messages in thread
From: Johannes Berg @ 2015-10-30 10:00 UTC (permalink / raw)
  To: Olav Haugan, linux-wireless; +Cc: davem, kvalo, ath9k-devel

On Sat, 2015-10-24 at 11:50 -0700, Olav Haugan wrote:
> implement set_coalesce ieee80211_ops callback. Add default
> wiphy_coalesce_support rules for 9k. These rules are not being used 
> by 9k since 9k can just toggle coalesce as on/off.
> 
This seems extremely strange to me - like you're trying to abuse
set_coalesce, intended for coalescing certain classes of low-importance
packets, for a completely different purpose (interrupt coalescing)?

johannes

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/2] mac80211: add support to set_coalesce
  2015-10-30  9:59 ` [PATCH 1/2] mac80211: add support to set_coalesce Johannes Berg
@ 2015-11-23  4:02   ` Olav Haugan
  0 siblings, 0 replies; 7+ messages in thread
From: Olav Haugan @ 2015-11-23  4:02 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless, davem, kvalo, ath9k-devel

On 15-10-30 10:59:41, Johannes Berg wrote:
> 
> > +++ b/net/mac80211/driver-ops.h
> > @@ -1355,4 +1355,16 @@ static inline void drv_wake_tx_queue(struct 
> > ieee80211_local *local,
> >  	local->ops->wake_tx_queue(&local->hw, &txq->txq);
> >  }
> >  
> > +static inline int drv_set_coalesce(struct ieee80211_local *local,
> > +				   struct cfg80211_coalesce 
> > *coalesce)
> > +{
> > +	u32 ret = 0;
> > 
> This doesn't seem right - now you're accepting any call even if it's
> not really done by the driver?
> 

I assume you mean we need the following check:

if (!local->ops->set_coalesce)
	return -EOPNOTSUPP

-- 
.Olav

The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/2] ath9k: implement set_coalesce callback
  2015-10-30 10:00   ` Johannes Berg
@ 2015-11-23  4:12     ` Olav Haugan
  2015-11-23  8:52       ` Johannes Berg
  0 siblings, 1 reply; 7+ messages in thread
From: Olav Haugan @ 2015-11-23  4:12 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless, davem, kvalo, ath9k-devel

On 15-10-30 11:00:51, Johannes Berg wrote:
> On Sat, 2015-10-24 at 11:50 -0700, Olav Haugan wrote:
> > implement set_coalesce ieee80211_ops callback. Add default
> > wiphy_coalesce_support rules for 9k. These rules are not being used 
> > by 9k since 9k can just toggle coalesce as on/off.
> > 
> This seems extremely strange to me - like you're trying to abuse
> set_coalesce, intended for coalescing certain classes of low-importance
> packets, for a completely different purpose (interrupt coalescing)?
> 
Hmm, yes. We misunderstood how this API is used. Do you have any
suggestion for how to accomplish what we are trying to do? We can't just
add a new public user space API for this functionality.

-- 
.Olav

The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/2] ath9k: implement set_coalesce callback
  2015-11-23  4:12     ` Olav Haugan
@ 2015-11-23  8:52       ` Johannes Berg
  0 siblings, 0 replies; 7+ messages in thread
From: Johannes Berg @ 2015-11-23  8:52 UTC (permalink / raw)
  To: Olav Haugan; +Cc: linux-wireless, davem, kvalo, ath9k-devel

On Sun, 2015-11-22 at 20:12 -0800, Olav Haugan wrote:
> On 15-10-30 11:00:51, Johannes Berg wrote:
> > On Sat, 2015-10-24 at 11:50 -0700, Olav Haugan wrote:
> > > implement set_coalesce ieee80211_ops callback. Add default
> > > wiphy_coalesce_support rules for 9k. These rules are not being
> > > used 
> > > by 9k since 9k can just toggle coalesce as on/off.
> > > 
> > This seems extremely strange to me - like you're trying to abuse
> > set_coalesce, intended for coalescing certain classes of low-
> > importance
> > packets, for a completely different purpose (interrupt coalescing)?
> > 
> Hmm, yes. We misunderstood how this API is used. Do you have any
> suggestion for how to accomplish what we are trying to do? We can't
> just add a new public user space API for this functionality.

ethtool usually has interrupt coalescing parameters.

johannes

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2015-11-23  8:52 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-24 18:50 [PATCH 1/2] mac80211: add support to set_coalesce Olav Haugan
2015-10-24 18:50 ` [PATCH 2/2] ath9k: implement set_coalesce callback Olav Haugan
2015-10-30 10:00   ` Johannes Berg
2015-11-23  4:12     ` Olav Haugan
2015-11-23  8:52       ` Johannes Berg
2015-10-30  9:59 ` [PATCH 1/2] mac80211: add support to set_coalesce Johannes Berg
2015-11-23  4:02   ` Olav Haugan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).