Skip to contentSkip to conversation

ath6kl: make net_device_ops const

PATCH Applied Stephen Hemminger 4 participants 8 messages Jan 5, 2012 – Jan 9, 2012 2 messages not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH 1/3 ath6kl: make net_device_ops const

drivers/net/wireless/ath/ath6kl/main.c +1 -1
@@ -1456,7 +1456,7 @@ static struct net_device_stats *ath6kl_g
 	return &ar->net_stats;
 }
 
-static struct net_device_ops ath6kl_netdev_ops = {
+static const struct net_device_ops ath6kl_netdev_ops = {
 	.ndo_open               = ath6kl_open,
 	.ndo_stop               = ath6kl_close,
 	.ndo_start_xmit         = ath6kl_data_tx,
#3 lore raw

PATCH 1/2 brcmf: make net_device_ops const

In reply to a message not in the archive
drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c +1 -1
@@ -1123,7 +1123,7 @@ int brcmf_bus_start(struct brcmf_pub *dr
 	return 0;
 }
 
-static struct net_device_ops brcmf_netdev_ops_pri = {
+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,

A message that is not in the archive (sent off-list or not yet received): [email protected]

#5 lore raw

Re: [PATCH 2/2] brcmfmac: use existing net_device_stats

Quoted 2 lines · Stephen Hemminger

Minor space savings. Compile tested only.

This is actually not going to work. The struct brcmf_if represents individual interfaces which each have their own device statistics.

Quoted 14 lines
drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c +0 -1
@@ -56,7 +56,6 @@ struct brcmf_if {
 	struct brcmf_info *info;	/* back pointer to brcmf_info */
 	/* OS/stack specifics */
 	struct net_device *ndev;
-	struct net_device_stats stats;
 	int idx;		/* iface idx in dongle */
 	int state;		/* interface state */
 	u8 mac_addr[ETH_ALEN];	/* assigned MAC address */

drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c static struct net_device_stats *brcmf_ne · line 529

Quoted 6 lines
drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c +0 -1
@@ -526,7 +525,6 @@ static struct net_device_stats *brcmf_ne
 {
 	struct brcmf_info *drvr_priv = *(struct brcmf_info **)
 					netdev_priv(ndev);
-	struct brcmf_if *ifp;
 	int ifidx;
 

Gr. AvS

#6 lore raw

Re: [PATCH 2/2] brcmfmac: use existing net_device_stats

Quoted 21 lines · On Thu, 5 Jan 2012 20:12:12 +0100 "Arend van Spriel" <[email protected]> wrote:
Quoted 2 lines · Stephen Hemminger

Minor space savings. Compile tested only.

This is actually not going to work. The struct brcmf_if represents individual interfaces which each have their own device statistics.

Quoted 14 lines
drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c +0 -1
@@ -56,7 +56,6 @@ struct brcmf_if {
 	struct brcmf_info *info;	/* back pointer to brcmf_info */
 	/* OS/stack specifics */
 	struct net_device *ndev;
-	struct net_device_stats stats;
 	int idx;		/* iface idx in dongle */
 	int state;		/* interface state */
 	u8 mac_addr[ETH_ALEN];	/* assigned MAC address */
@@ -526,7 +525,6 @@ static struct net_device_stats *brcmf_ne
Quoted 9 lines

drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c static struct net_device_stats *brcmf_ne · line 529

Quoted 6 lines
drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c +0 -1
 {
 	struct brcmf_info *drvr_priv = *(struct brcmf_info **)
 					netdev_priv(ndev);
-	struct brcmf_if *ifp;
 	int ifidx;
 

Gr. AvS

Why not, if you look it is only used during the aggregation and return of netdevice stats.

#7 lore raw

Re: [PATCH 2/2] brcmfmac: use existing net_device_stats

Quoted 7 lines · Stephen Hemminger
Quoted 4 lines · On Thu, 5 Jan 2012 20:12:12 +0100 "Arend van Spriel"<[email protected]> wrote:
Quoted 2 lines · Stephen Hemminger

Minor space savings. Compile tested only.

Quoted 7 lines
Quoted 3 lines

This is actually not going to work. The struct brcmf_if represents individual interfaces which each have their own device statistics.

Why not, if you look it is only used during the aggregation and return of netdevice stats.

We only support one primary interface at the moment. But we have plan to add P2P support using virtual interfaces. It would be better to have individual stats for different interfaces.

Thanks,
Franky

#8 lore raw

Re: [PATCH 2/2] brcmfmac: use existing net_device_stats

Quoted 16 lines · On Thu, 5 Jan 2012 11:39:34 -0800 "Franky Lin" <[email protected]> wrote:
Quoted 7 lines · Stephen Hemminger
Quoted 4 lines · On Thu, 5 Jan 2012 20:12:12 +0100 "Arend van Spriel"<[email protected]> wrote:
Quoted 2 lines · Stephen Hemminger

Minor space savings. Compile tested only.

Quoted 7 lines
Quoted 3 lines

This is actually not going to work. The struct brcmf_if represents individual interfaces which each have their own device statistics.

Why not, if you look it is only used during the aggregation and return of netdevice stats.

Quoted 7 lines

We only support one primary interface at the moment. But we have plan to add P2P support using virtual interfaces. It would be better to have individual stats for different interfaces.

Thanks,
Franky

You are confused. The only place the data in question is used is:
static struct net_device_stats *brcmf_netdev_get_stats

This is a per-network device standard API and it returns per-network device statistics. Several releases ago, structure element was added to the network_device struct for common usage by drivers. All this patch does is use that instead of the private device scratch pad.

If you really want to be more clever, the device should be convert to the new getstats64 API, but that requires more work (like wrapping updates with the u64_stats_sync() macros.

#9 lore raw

Re: [PATCH 2/2] brcmfmac: use existing net_device_stats

Quoted 12 lines · Stephen Hemminger

You are confused. The only place the data in question is used is:
static struct net_device_stats *brcmf_netdev_get_stats

This is a per-network device standard API and it returns per-network device statistics. Several releases ago, structure element was added to the network_device struct for common usage by drivers. All this patch does is use that instead of the private device scratch pad.

If you really want to be more clever, the device should be convert to the new getstats64 API, but that requires more work (like wrapping updates with the u64_stats_sync() macros.

I misunderstood since the first mail I got of this thread is Arend's reply. But I did receive the "brcmf: make net_device_ops const" patch. Something wrong with the mail server?

Franky