@@ -96,50 +96,25 @@ nfp_repr_phy_port_get_stats64(struct nfp_port *port,
96
96
}
97
97
98
98
static void
99
- nfp_repr_vf_get_stats64 ( const struct nfp_app * app , u8 vf ,
100
- struct rtnl_link_stats64 * stats )
99
+ nfp_repr_vnic_get_stats64 ( struct nfp_port * port ,
100
+ struct rtnl_link_stats64 * stats )
101
101
{
102
- u8 __iomem * mem ;
103
-
104
- mem = app -> pf -> vf_cfg_mem + vf * NFP_NET_CFG_BAR_SZ ;
105
-
106
102
/* TX and RX stats are flipped as we are returning the stats as seen
107
103
* at the switch port corresponding to the VF.
108
104
*/
109
- stats -> tx_packets = readq (mem + NFP_NET_CFG_STATS_RX_FRAMES );
110
- stats -> tx_bytes = readq (mem + NFP_NET_CFG_STATS_RX_OCTETS );
111
- stats -> tx_dropped = readq (mem + NFP_NET_CFG_STATS_RX_DISCARDS );
105
+ stats -> tx_packets = readq (port -> vnic + NFP_NET_CFG_STATS_RX_FRAMES );
106
+ stats -> tx_bytes = readq (port -> vnic + NFP_NET_CFG_STATS_RX_OCTETS );
107
+ stats -> tx_dropped = readq (port -> vnic + NFP_NET_CFG_STATS_RX_DISCARDS );
112
108
113
- stats -> rx_packets = readq (mem + NFP_NET_CFG_STATS_TX_FRAMES );
114
- stats -> rx_bytes = readq (mem + NFP_NET_CFG_STATS_TX_OCTETS );
115
- stats -> rx_dropped = readq (mem + NFP_NET_CFG_STATS_TX_DISCARDS );
116
- }
117
-
118
- static void
119
- nfp_repr_pf_get_stats64 (const struct nfp_app * app , u8 pf ,
120
- struct rtnl_link_stats64 * stats )
121
- {
122
- u8 __iomem * mem ;
123
-
124
- if (pf )
125
- return ;
126
-
127
- mem = nfp_cpp_area_iomem (app -> pf -> data_vnic_bar );
128
-
129
- stats -> tx_packets = readq (mem + NFP_NET_CFG_STATS_RX_FRAMES );
130
- stats -> tx_bytes = readq (mem + NFP_NET_CFG_STATS_RX_OCTETS );
131
- stats -> tx_dropped = readq (mem + NFP_NET_CFG_STATS_RX_DISCARDS );
132
-
133
- stats -> rx_packets = readq (mem + NFP_NET_CFG_STATS_TX_FRAMES );
134
- stats -> rx_bytes = readq (mem + NFP_NET_CFG_STATS_TX_OCTETS );
135
- stats -> rx_dropped = readq (mem + NFP_NET_CFG_STATS_TX_DISCARDS );
109
+ stats -> rx_packets = readq (port -> vnic + NFP_NET_CFG_STATS_TX_FRAMES );
110
+ stats -> rx_bytes = readq (port -> vnic + NFP_NET_CFG_STATS_TX_OCTETS );
111
+ stats -> rx_dropped = readq (port -> vnic + NFP_NET_CFG_STATS_TX_DISCARDS );
136
112
}
137
113
138
114
static void
139
115
nfp_repr_get_stats64 (struct net_device * netdev , struct rtnl_link_stats64 * stats )
140
116
{
141
117
struct nfp_repr * repr = netdev_priv (netdev );
142
- struct nfp_app * app = repr -> app ;
143
118
144
119
if (WARN_ON (!repr -> port ))
145
120
return ;
@@ -151,10 +126,8 @@ nfp_repr_get_stats64(struct net_device *netdev, struct rtnl_link_stats64 *stats)
151
126
nfp_repr_phy_port_get_stats64 (repr -> port , stats );
152
127
break ;
153
128
case NFP_PORT_PF_PORT :
154
- nfp_repr_pf_get_stats64 (app , repr -> port -> pf_id , stats );
155
- break ;
156
129
case NFP_PORT_VF_PORT :
157
- nfp_repr_vf_get_stats64 ( app , repr -> port -> vf_id , stats );
130
+ nfp_repr_vnic_get_stats64 ( repr -> port , stats );
158
131
default :
159
132
break ;
160
133
}
0 commit comments