Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

net: bridge: replace struct br_vlan_stats with pcpu_sw_netstats

Struct br_vlan_stats duplicates pcpu_sw_netstats (apart from
br_vlan_stats not defining an alignment requirement), therefore
switch to using the latter one.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Link: https://lore.kernel.org/r/04d25c3d-c5f6-3611-6d37-c2f40243dae2@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Heiner Kallweit and committed by
Jakub Kicinski
281cc284 280bb3f9

+12 -19
+1 -1
net/bridge/br_netlink.c
··· 1724 1724 pvid = br_get_pvid(vg); 1725 1725 list_for_each_entry(v, &vg->vlan_list, vlist) { 1726 1726 struct bridge_vlan_xstats vxi; 1727 - struct br_vlan_stats stats; 1727 + struct pcpu_sw_netstats stats; 1728 1728 1729 1729 if (++vl_idx < *prividx) 1730 1730 continue;
+3 -11
net/bridge/br_private.h
··· 89 89 }; 90 90 #endif 91 91 92 - struct br_vlan_stats { 93 - u64 rx_bytes; 94 - u64 rx_packets; 95 - u64 tx_bytes; 96 - u64 tx_packets; 97 - struct u64_stats_sync syncp; 98 - }; 99 - 100 92 struct br_tunnel_info { 101 93 __be64 tunnel_id; 102 94 struct metadata_dst *tunnel_dst; ··· 129 137 u16 flags; 130 138 u16 priv_flags; 131 139 u8 state; 132 - struct br_vlan_stats __percpu *stats; 140 + struct pcpu_sw_netstats __percpu *stats; 133 141 union { 134 142 struct net_bridge *br; 135 143 struct net_bridge_port *port; ··· 1085 1093 int nbp_vlan_init(struct net_bridge_port *port, struct netlink_ext_ack *extack); 1086 1094 int nbp_get_num_vlan_infos(struct net_bridge_port *p, u32 filter_mask); 1087 1095 void br_vlan_get_stats(const struct net_bridge_vlan *v, 1088 - struct br_vlan_stats *stats); 1096 + struct pcpu_sw_netstats *stats); 1089 1097 void br_vlan_port_event(struct net_bridge_port *p, unsigned long event); 1090 1098 int br_vlan_bridge_event(struct net_device *dev, unsigned long event, 1091 1099 void *ptr); ··· 1281 1289 } 1282 1290 1283 1291 static inline void br_vlan_get_stats(const struct net_bridge_vlan *v, 1284 - struct br_vlan_stats *stats) 1292 + struct pcpu_sw_netstats *stats) 1285 1293 { 1286 1294 } 1287 1295
+8 -7
net/bridge/br_vlan.c
··· 270 270 goto out_filt; 271 271 v->brvlan = masterv; 272 272 if (br_opt_get(br, BROPT_VLAN_STATS_PER_PORT)) { 273 - v->stats = netdev_alloc_pcpu_stats(struct br_vlan_stats); 273 + v->stats = 274 + netdev_alloc_pcpu_stats(struct pcpu_sw_netstats); 274 275 if (!v->stats) { 275 276 err = -ENOMEM; 276 277 goto out_filt; ··· 422 421 struct net_bridge_vlan_group *vg, 423 422 struct sk_buff *skb) 424 423 { 425 - struct br_vlan_stats *stats; 424 + struct pcpu_sw_netstats *stats; 426 425 struct net_bridge_vlan *v; 427 426 u16 vid; 428 427 ··· 475 474 struct sk_buff *skb, u16 *vid, 476 475 u8 *state) 477 476 { 478 - struct br_vlan_stats *stats; 477 + struct pcpu_sw_netstats *stats; 479 478 struct net_bridge_vlan *v; 480 479 bool tagged; 481 480 ··· 709 708 if (!vlan) 710 709 return -ENOMEM; 711 710 712 - vlan->stats = netdev_alloc_pcpu_stats(struct br_vlan_stats); 711 + vlan->stats = netdev_alloc_pcpu_stats(struct pcpu_sw_netstats); 713 712 if (!vlan->stats) { 714 713 kfree(vlan); 715 714 return -ENOMEM; ··· 1263 1262 } 1264 1263 1265 1264 void br_vlan_get_stats(const struct net_bridge_vlan *v, 1266 - struct br_vlan_stats *stats) 1265 + struct pcpu_sw_netstats *stats) 1267 1266 { 1268 1267 int i; 1269 1268 1270 1269 memset(stats, 0, sizeof(*stats)); 1271 1270 for_each_possible_cpu(i) { 1272 1271 u64 rxpackets, rxbytes, txpackets, txbytes; 1273 - struct br_vlan_stats *cpu_stats; 1272 + struct pcpu_sw_netstats *cpu_stats; 1274 1273 unsigned int start; 1275 1274 1276 1275 cpu_stats = per_cpu_ptr(v->stats, i); ··· 1586 1585 static bool br_vlan_stats_fill(struct sk_buff *skb, 1587 1586 const struct net_bridge_vlan *v) 1588 1587 { 1589 - struct br_vlan_stats stats; 1588 + struct pcpu_sw_netstats stats; 1590 1589 struct nlattr *nest; 1591 1590 1592 1591 nest = nla_nest_start(skb, BRIDGE_VLANDB_ENTRY_STATS);