Commit 58275410 authored by David S. Miller's avatar David S. Miller

Merge branch 'dpaa2-eth-Introduce-XDP-support'

Ioana Ciocoi Radulescu says:

====================
dpaa2-eth: Introduce XDP support

Add support for XDP programs. Only XDP_PASS, XDP_DROP and XDP_TX
actions are supported for now. Frame header changes are also
allowed.

v2: - count the XDP packets in the rx/tx inteface stats
    - add message with the maximum supported MTU value for XDP
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 86d1d8b7 a4a7b762
...@@ -139,7 +139,9 @@ struct dpaa2_faead { ...@@ -139,7 +139,9 @@ struct dpaa2_faead {
}; };
#define DPAA2_FAEAD_A2V 0x20000000 #define DPAA2_FAEAD_A2V 0x20000000
#define DPAA2_FAEAD_A4V 0x08000000
#define DPAA2_FAEAD_UPDV 0x00001000 #define DPAA2_FAEAD_UPDV 0x00001000
#define DPAA2_FAEAD_EBDDV 0x00002000
#define DPAA2_FAEAD_UPD 0x00000010 #define DPAA2_FAEAD_UPD 0x00000010
/* Accessors for the hardware annotation fields that we use */ /* Accessors for the hardware annotation fields that we use */
...@@ -243,12 +245,14 @@ struct dpaa2_eth_fq_stats { ...@@ -243,12 +245,14 @@ struct dpaa2_eth_fq_stats {
struct dpaa2_eth_ch_stats { struct dpaa2_eth_ch_stats {
/* Volatile dequeues retried due to portal busy */ /* Volatile dequeues retried due to portal busy */
__u64 dequeue_portal_busy; __u64 dequeue_portal_busy;
/* Number of CDANs; useful to estimate avg NAPI len */
__u64 cdan;
/* Number of frames received on queues from this channel */
__u64 frames;
/* Pull errors */ /* Pull errors */
__u64 pull_err; __u64 pull_err;
/* Number of CDANs; useful to estimate avg NAPI len */
__u64 cdan;
/* XDP counters */
__u64 xdp_drop;
__u64 xdp_tx;
__u64 xdp_tx_err;
}; };
/* Maximum number of queues associated with a DPNI */ /* Maximum number of queues associated with a DPNI */
...@@ -283,6 +287,12 @@ struct dpaa2_eth_fq { ...@@ -283,6 +287,12 @@ struct dpaa2_eth_fq {
struct dpaa2_eth_fq_stats stats; struct dpaa2_eth_fq_stats stats;
}; };
struct dpaa2_eth_ch_xdp {
struct bpf_prog *prog;
u64 drop_bufs[DPAA2_ETH_BUFS_PER_CMD];
int drop_cnt;
};
struct dpaa2_eth_channel { struct dpaa2_eth_channel {
struct dpaa2_io_notification_ctx nctx; struct dpaa2_io_notification_ctx nctx;
struct fsl_mc_device *dpcon; struct fsl_mc_device *dpcon;
...@@ -294,6 +304,7 @@ struct dpaa2_eth_channel { ...@@ -294,6 +304,7 @@ struct dpaa2_eth_channel {
struct dpaa2_eth_priv *priv; struct dpaa2_eth_priv *priv;
int buf_count; int buf_count;
struct dpaa2_eth_ch_stats stats; struct dpaa2_eth_ch_stats stats;
struct dpaa2_eth_ch_xdp xdp;
}; };
struct dpaa2_eth_dist_fields { struct dpaa2_eth_dist_fields {
...@@ -353,6 +364,7 @@ struct dpaa2_eth_priv { ...@@ -353,6 +364,7 @@ struct dpaa2_eth_priv {
u64 rx_hash_fields; u64 rx_hash_fields;
struct dpaa2_eth_cls_rule *cls_rules; struct dpaa2_eth_cls_rule *cls_rules;
u8 rx_cls_enabled; u8 rx_cls_enabled;
struct bpf_prog *xdp_prog;
}; };
#define DPAA2_RXH_SUPPORTED (RXH_L2DA | RXH_VLAN | RXH_L3_PROTO \ #define DPAA2_RXH_SUPPORTED (RXH_L2DA | RXH_VLAN | RXH_L3_PROTO \
......
...@@ -45,6 +45,9 @@ static char dpaa2_ethtool_extras[][ETH_GSTRING_LEN] = { ...@@ -45,6 +45,9 @@ static char dpaa2_ethtool_extras[][ETH_GSTRING_LEN] = {
"[drv] dequeue portal busy", "[drv] dequeue portal busy",
"[drv] channel pull errors", "[drv] channel pull errors",
"[drv] cdan", "[drv] cdan",
"[drv] xdp drop",
"[drv] xdp tx",
"[drv] xdp tx errors",
}; };
#define DPAA2_ETH_NUM_EXTRA_STATS ARRAY_SIZE(dpaa2_ethtool_extras) #define DPAA2_ETH_NUM_EXTRA_STATS ARRAY_SIZE(dpaa2_ethtool_extras)
...@@ -174,8 +177,6 @@ static void dpaa2_eth_get_ethtool_stats(struct net_device *net_dev, ...@@ -174,8 +177,6 @@ static void dpaa2_eth_get_ethtool_stats(struct net_device *net_dev,
int j, k, err; int j, k, err;
int num_cnt; int num_cnt;
union dpni_statistics dpni_stats; union dpni_statistics dpni_stats;
u64 cdan = 0;
u64 portal_busy = 0, pull_err = 0;
struct dpaa2_eth_priv *priv = netdev_priv(net_dev); struct dpaa2_eth_priv *priv = netdev_priv(net_dev);
struct dpaa2_eth_drv_stats *extras; struct dpaa2_eth_drv_stats *extras;
struct dpaa2_eth_ch_stats *ch_stats; struct dpaa2_eth_ch_stats *ch_stats;
...@@ -212,16 +213,12 @@ static void dpaa2_eth_get_ethtool_stats(struct net_device *net_dev, ...@@ -212,16 +213,12 @@ static void dpaa2_eth_get_ethtool_stats(struct net_device *net_dev,
} }
i += j; i += j;
for (j = 0; j < priv->num_channels; j++) { /* Per-channel stats */
ch_stats = &priv->channel[j]->stats; for (k = 0; k < priv->num_channels; k++) {
cdan += ch_stats->cdan; ch_stats = &priv->channel[k]->stats;
portal_busy += ch_stats->dequeue_portal_busy; for (j = 0; j < sizeof(*ch_stats) / sizeof(__u64); j++)
pull_err += ch_stats->pull_err; *((__u64 *)data + i + j) += *((__u64 *)ch_stats + j);
} }
*(data + i++) = portal_busy;
*(data + i++) = pull_err;
*(data + i++) = cdan;
} }
static int prep_eth_rule(struct ethhdr *eth_value, struct ethhdr *eth_mask, static int prep_eth_rule(struct ethhdr *eth_value, struct ethhdr *eth_mask,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment