[v2,for-4.9,30/32] brcmfmac: Use net_device_stats from struct net_device

Message ID 1491388344-13521-31-git-send-email-amit.pundir@linaro.org
State New
Headers show
Series
  • Stable commits picked up from lede project
Related show

Commit Message

Amit Pundir April 5, 2017, 10:32 a.m.
From: Tobias Klauser <tklauser@distanz.ch>


Instead of using a private copy of struct net_device_stats in struct
brcm_if, use stats from struct net_device.  Also remove the now
unnecessary .ndo_get_stats function.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>

Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>

Signed-off-by: Kalle Valo <kvalo@codeaurora.org>

(cherry picked from commit 91b632803ee4e47c5a5c4dc3d8bf5abf9c16107a)
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>

---
 .../wireless/broadcom/brcm80211/brcmfmac/core.c    | 26 +++++++---------------
 .../wireless/broadcom/brcm80211/brcmfmac/core.h    |  2 --
 2 files changed, 8 insertions(+), 20 deletions(-)

-- 
2.7.4

Comments

Greg Kroah-Hartman April 12, 2017, 1:18 p.m. | #1
On Wed, Apr 05, 2017 at 04:02:22PM +0530, Amit Pundir wrote:
> From: Tobias Klauser <tklauser@distanz.ch>

> 

> Instead of using a private copy of struct net_device_stats in struct

> brcm_if, use stats from struct net_device.  Also remove the now

> unnecessary .ndo_get_stats function.

> 

> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>

> Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>

> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>

> (cherry picked from commit 91b632803ee4e47c5a5c4dc3d8bf5abf9c16107a)

> Signed-off-by: Amit Pundir <amit.pundir@linaro.org>

> ---

>  .../wireless/broadcom/brcm80211/brcmfmac/core.c    | 26 +++++++---------------

>  .../wireless/broadcom/brcm80211/brcmfmac/core.h    |  2 --

>  2 files changed, 8 insertions(+), 20 deletions(-)


Again, how is this a proper stable patch?
Tobias Klauser April 12, 2017, 1:46 p.m. | #2
On 2017-04-12 at 15:18:06 +0200, Greg KH <gregkh@linuxfoundation.org> wrote:
> On Wed, Apr 05, 2017 at 04:02:22PM +0530, Amit Pundir wrote:

> > From: Tobias Klauser <tklauser@distanz.ch>

> > 

> > Instead of using a private copy of struct net_device_stats in struct

> > brcm_if, use stats from struct net_device.  Also remove the now

> > unnecessary .ndo_get_stats function.

> > 

> > Signed-off-by: Tobias Klauser <tklauser@distanz.ch>

> > Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>

> > Signed-off-by: Kalle Valo <kvalo@codeaurora.org>

> > (cherry picked from commit 91b632803ee4e47c5a5c4dc3d8bf5abf9c16107a)

> > Signed-off-by: Amit Pundir <amit.pundir@linaro.org>

> > ---

> >  .../wireless/broadcom/brcm80211/brcmfmac/core.c    | 26 +++++++---------------

> >  .../wireless/broadcom/brcm80211/brcmfmac/core.h    |  2 --

> >  2 files changed, 8 insertions(+), 20 deletions(-)

> 

> Again, how is this a proper stable patch?


I don't know how this ended up being submitted for inclusion in stable,
but from by perspective this patch clearly doesn't qualify for
inclusion.
Kalle Valo April 12, 2017, 1:52 p.m. | #3
+ arend

Greg KH <gregkh@linuxfoundation.org> writes:

> On Wed, Apr 05, 2017 at 04:02:22PM +0530, Amit Pundir wrote:

>> From: Tobias Klauser <tklauser@distanz.ch>

>> 

>> Instead of using a private copy of struct net_device_stats in struct

>> brcm_if, use stats from struct net_device.  Also remove the now

>> unnecessary .ndo_get_stats function.

>> 

>> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>

>> Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>

>> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>

>> (cherry picked from commit 91b632803ee4e47c5a5c4dc3d8bf5abf9c16107a)

>> Signed-off-by: Amit Pundir <amit.pundir@linaro.org>

>> ---

>>  .../wireless/broadcom/brcm80211/brcmfmac/core.c    | 26 +++++++---------------

>>  .../wireless/broadcom/brcm80211/brcmfmac/core.h    |  2 --

>>  2 files changed, 8 insertions(+), 20 deletions(-)

>

> Again, how is this a proper stable patch?


I have no idea. At least me nor Arend didn't tag it for stable.

-- 
Kalle Valo
Amit Pundir April 12, 2017, 2:29 p.m. | #4
On 12 April 2017 at 19:22, Kalle Valo <kvalo@codeaurora.org> wrote:
> + arend

>

> Greg KH <gregkh@linuxfoundation.org> writes:

>

>> On Wed, Apr 05, 2017 at 04:02:22PM +0530, Amit Pundir wrote:

>>> From: Tobias Klauser <tklauser@distanz.ch>

>>>

>>> Instead of using a private copy of struct net_device_stats in struct

>>> brcm_if, use stats from struct net_device.  Also remove the now

>>> unnecessary .ndo_get_stats function.

>>>

>>> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>

>>> Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>

>>> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>

>>> (cherry picked from commit 91b632803ee4e47c5a5c4dc3d8bf5abf9c16107a)

>>> Signed-off-by: Amit Pundir <amit.pundir@linaro.org>

>>> ---

>>>  .../wireless/broadcom/brcm80211/brcmfmac/core.c    | 26 +++++++---------------

>>>  .../wireless/broadcom/brcm80211/brcmfmac/core.h    |  2 --

>>>  2 files changed, 8 insertions(+), 20 deletions(-)

>>

>> Again, how is this a proper stable patch?

>

> I have no idea. At least me nor Arend didn't tag it for stable.


I picked it up along with few other patches from LEDE 4.9 stable
source and sent them @ stable. I'll review the series again. My
apologies for the confusion.

Regards,
Amit Pundir

>

> --

> Kalle Valo

Patch

diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
index 5eaac13..cf1ae5a 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
@@ -243,10 +243,10 @@  static netdev_tx_t brcmf_netdev_start_xmit(struct sk_buff *skb,
 
 done:
 	if (ret) {
-		ifp->stats.tx_dropped++;
+		ndev->stats.tx_dropped++;
 	} else {
-		ifp->stats.tx_packets++;
-		ifp->stats.tx_bytes += skb->len;
+		ndev->stats.tx_packets++;
+		ndev->stats.tx_bytes += skb->len;
 	}
 
 	/* Return ok: we always eat the packet */
@@ -290,15 +290,15 @@  void brcmf_txflowblock(struct device *dev, bool state)
 void brcmf_netif_rx(struct brcmf_if *ifp, struct sk_buff *skb)
 {
 	if (skb->pkt_type == PACKET_MULTICAST)
-		ifp->stats.multicast++;
+		ifp->ndev->stats.multicast++;
 
 	if (!(ifp->ndev->flags & IFF_UP)) {
 		brcmu_pkt_buf_free_skb(skb);
 		return;
 	}
 
-	ifp->stats.rx_bytes += skb->len;
-	ifp->stats.rx_packets++;
+	ifp->ndev->stats.rx_bytes += skb->len;
+	ifp->ndev->stats.rx_packets++;
 
 	brcmf_dbg(DATA, "rx proto=0x%X\n", ntohs(skb->protocol));
 	if (in_interrupt())
@@ -321,7 +321,7 @@  static int brcmf_rx_hdrpull(struct brcmf_pub *drvr, struct sk_buff *skb,
 
 	if (ret || !(*ifp) || !(*ifp)->ndev) {
 		if (ret != -ENODATA && *ifp)
-			(*ifp)->stats.rx_errors++;
+			(*ifp)->ndev->stats.rx_errors++;
 		brcmu_pkt_buf_free_skb(skb);
 		return -ENODATA;
 	}
@@ -382,7 +382,7 @@  void brcmf_txfinalize(struct brcmf_if *ifp, struct sk_buff *txp, bool success)
 	}
 
 	if (!success)
-		ifp->stats.tx_errors++;
+		ifp->ndev->stats.tx_errors++;
 
 	brcmu_pkt_buf_free_skb(txp);
 }
@@ -405,15 +405,6 @@  void brcmf_txcomplete(struct device *dev, struct sk_buff *txp, bool success)
 	}
 }
 
-static struct net_device_stats *brcmf_netdev_get_stats(struct net_device *ndev)
-{
-	struct brcmf_if *ifp = netdev_priv(ndev);
-
-	brcmf_dbg(TRACE, "Enter, bsscfgidx=%d\n", ifp->bsscfgidx);
-
-	return &ifp->stats;
-}
-
 static void brcmf_ethtool_get_drvinfo(struct net_device *ndev,
 				    struct ethtool_drvinfo *info)
 {
@@ -486,7 +477,6 @@  static int brcmf_netdev_open(struct net_device *ndev)
 static const struct net_device_ops brcmf_netdev_ops_pri = {
 	.ndo_open = brcmf_netdev_open,
 	.ndo_stop = brcmf_netdev_stop,
-	.ndo_get_stats = brcmf_netdev_get_stats,
 	.ndo_start_xmit = brcmf_netdev_start_xmit,
 	.ndo_set_mac_address = brcmf_netdev_set_mac_address,
 	.ndo_set_rx_mode = brcmf_netdev_set_multicast_list
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
index c94dcab..397c912 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
@@ -171,7 +171,6 @@  enum brcmf_netif_stop_reason {
  * @drvr: points to device related information.
  * @vif: points to cfg80211 specific interface information.
  * @ndev: associated network device.
- * @stats: interface specific network statistics.
  * @multicast_work: worker object for multicast provisioning.
  * @ndoffload_work: worker object for neighbor discovery offload configuration.
  * @fws_desc: interface specific firmware-signalling descriptor.
@@ -187,7 +186,6 @@  struct brcmf_if {
 	struct brcmf_pub *drvr;
 	struct brcmf_cfg80211_vif *vif;
 	struct net_device *ndev;
-	struct net_device_stats stats;
 	struct work_struct multicast_work;
 	struct work_struct ndoffload_work;
 	struct brcmf_fws_mac_descriptor *fws_desc;