@@ -219,6 +219,8 @@ static const struct net_device_ops ef100_netdev_ops = {
.ndo_start_xmit = ef100_hard_start_xmit,
.ndo_tx_timeout = efx_watchdog,
.ndo_get_stats64 = efx_net_stats,
+ .ndo_get_xdp_stats_nch = efx_get_xdp_stats_nch,
+ .ndo_get_xdp_stats = efx_get_xdp_stats,
.ndo_change_mtu = efx_change_mtu,
.ndo_validate_addr = eth_validate_addr,
.ndo_set_mac_address = efx_set_mac_address,
@@ -588,6 +588,8 @@ static const struct net_device_ops efx_netdev_ops = {
.ndo_open = efx_net_open,
.ndo_stop = efx_net_stop,
.ndo_get_stats64 = efx_net_stats,
+ .ndo_get_xdp_stats_nch = efx_get_xdp_stats_nch,
+ .ndo_get_xdp_stats = efx_get_xdp_stats,
.ndo_tx_timeout = efx_watchdog,
.ndo_start_xmit = efx_hard_start_xmit,
.ndo_validate_addr = eth_validate_addr,
@@ -606,6 +606,48 @@ void efx_net_stats(struct net_device *net_dev, struct rtnl_link_stats64 *stats)
spin_unlock_bh(&efx->stats_lock);
}
+int efx_get_xdp_stats_nch(const struct net_device *net_dev, u32 attr_id)
+{
+ const struct efx_nic *efx = netdev_priv(net_dev);
+
+ switch (attr_id) {
+ case IFLA_XDP_XSTATS_TYPE_XDP:
+ return efx->n_channels;
+ default:
+ return -EOPNOTSUPP;
+ }
+}
+
+int efx_get_xdp_stats(const struct net_device *net_dev, u32 attr_id,
+ void *attr_data)
+{
+ struct ifla_xdp_stats *xdp_stats = attr_data;
+ struct efx_nic *efx = netdev_priv(net_dev);
+ const struct efx_channel *channel;
+
+ switch (attr_id) {
+ case IFLA_XDP_XSTATS_TYPE_XDP:
+ break;
+ default:
+ return -EOPNOTSUPP;
+ }
+
+ spin_lock_bh(&efx->stats_lock);
+
+ efx_for_each_channel(channel, efx) {
+ xdp_stats->drop = channel->n_rx_xdp_drops;
+ xdp_stats->errors = channel->n_rx_xdp_bad_drops;
+ xdp_stats->redirect = channel->n_rx_xdp_redirect;
+ xdp_stats->tx = channel->n_rx_xdp_tx;
+
+ xdp_stats++;
+ }
+
+ spin_unlock_bh(&efx->stats_lock);
+
+ return 0;
+}
+
/* Push loopback/power/transmit disable settings to the PHY, and reconfigure
* the MAC appropriately. All other PHY configuration changes are pushed
* through phy_op->set_settings(), and pushed asynchronously to the MAC
@@ -32,6 +32,9 @@ void efx_start_all(struct efx_nic *efx);
void efx_stop_all(struct efx_nic *efx);
void efx_net_stats(struct net_device *net_dev, struct rtnl_link_stats64 *stats);
+int efx_get_xdp_stats_nch(const struct net_device *net_dev, u32 attr_id);
+int efx_get_xdp_stats(const struct net_device *net_dev, u32 attr_id,
+ void *attr_data);
int efx_create_reset_workqueue(void);
void efx_queue_reset_work(struct efx_nic *efx);