dpaa2-eth: add XDP_REDIRECT support
Implement support for the XDP_REDIRECT action. The redirected frame is transmitted and confirmed on the regular Tx/Tx conf queues. Frame is marked with the "XDP" type in the software annotation, since it requires special treatment. We don't have good hardware support for TX batching, so the XDP_XMIT_FLUSH flag doesn't make a difference for now; ndo_xdp_xmit performs the actual Tx operation on the spot. Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com> Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
e3fdf6ba09
commit
d678be1dc1
@@ -95,6 +95,7 @@
|
||||
enum dpaa2_eth_swa_type {
|
||||
DPAA2_ETH_SWA_SINGLE,
|
||||
DPAA2_ETH_SWA_SG,
|
||||
DPAA2_ETH_SWA_XDP,
|
||||
};
|
||||
|
||||
/* Must keep this struct smaller than DPAA2_ETH_SWA_SIZE */
|
||||
@@ -110,6 +111,10 @@ struct dpaa2_eth_swa {
|
||||
int num_sg;
|
||||
int sgt_size;
|
||||
} sg;
|
||||
struct {
|
||||
int dma_size;
|
||||
struct xdp_frame *xdpf;
|
||||
} xdp;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -273,6 +278,7 @@ struct dpaa2_eth_ch_stats {
|
||||
__u64 xdp_drop;
|
||||
__u64 xdp_tx;
|
||||
__u64 xdp_tx_err;
|
||||
__u64 xdp_redirect;
|
||||
};
|
||||
|
||||
/* Maximum number of queues associated with a DPNI */
|
||||
@@ -312,6 +318,7 @@ struct dpaa2_eth_ch_xdp {
|
||||
struct bpf_prog *prog;
|
||||
u64 drop_bufs[DPAA2_ETH_BUFS_PER_CMD];
|
||||
int drop_cnt;
|
||||
unsigned int res;
|
||||
};
|
||||
|
||||
struct dpaa2_eth_channel {
|
||||
@@ -326,6 +333,7 @@ struct dpaa2_eth_channel {
|
||||
int buf_count;
|
||||
struct dpaa2_eth_ch_stats stats;
|
||||
struct dpaa2_eth_ch_xdp xdp;
|
||||
struct xdp_rxq_info xdp_rxq;
|
||||
};
|
||||
|
||||
struct dpaa2_eth_dist_fields {
|
||||
@@ -446,6 +454,12 @@ unsigned int dpaa2_eth_needed_headroom(struct dpaa2_eth_priv *priv,
|
||||
{
|
||||
unsigned int headroom = DPAA2_ETH_SWA_SIZE;
|
||||
|
||||
/* If we don't have an skb (e.g. XDP buffer), we only need space for
|
||||
* the software annotation area
|
||||
*/
|
||||
if (!skb)
|
||||
return headroom;
|
||||
|
||||
/* For non-linear skbs we have no headroom requirement, as we build a
|
||||
* SG frame with a newly allocated SGT buffer
|
||||
*/
|
||||
|
Reference in New Issue
Block a user