File tree Expand file tree Collapse file tree 2 files changed +12
-3
lines changed
drivers/net/ethernet/netronome/nfp Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change 47
47
#include <linux/netdevice.h>
48
48
#include <linux/pci.h>
49
49
#include <linux/io-64-nonatomic-hi-lo.h>
50
+ #include <net/xdp.h>
50
51
51
52
#include "nfp_net_ctrl.h"
52
53
@@ -350,6 +351,7 @@ struct nfp_net_rx_buf {
350
351
* @rxds: Virtual address of FL/RX ring in host memory
351
352
* @dma: DMA address of the FL/RX ring
352
353
* @size: Size, in bytes, of the FL/RX ring (needed to free)
354
+ * @xdp_rxq: RX-ring info avail for XDP
353
355
*/
354
356
struct nfp_net_rx_ring {
355
357
struct nfp_net_r_vector * r_vec ;
@@ -361,13 +363,14 @@ struct nfp_net_rx_ring {
361
363
u32 idx ;
362
364
363
365
int fl_qcidx ;
366
+ unsigned int size ;
364
367
u8 __iomem * qcp_fl ;
365
368
366
369
struct nfp_net_rx_buf * rxbufs ;
367
370
struct nfp_net_rx_desc * rxds ;
368
371
369
372
dma_addr_t dma ;
370
- unsigned int size ;
373
+ struct xdp_rxq_info xdp_rxq ;
371
374
} ____cacheline_aligned ;
372
375
373
376
/**
Original file line number Diff line number Diff line change @@ -1608,11 +1608,13 @@ static int nfp_net_rx(struct nfp_net_rx_ring *rx_ring, int budget)
1608
1608
unsigned int true_bufsz ;
1609
1609
struct sk_buff * skb ;
1610
1610
int pkts_polled = 0 ;
1611
+ struct xdp_buff xdp ;
1611
1612
int idx ;
1612
1613
1613
1614
rcu_read_lock ();
1614
1615
xdp_prog = READ_ONCE (dp -> xdp_prog );
1615
1616
true_bufsz = xdp_prog ? PAGE_SIZE : dp -> fl_bufsz ;
1617
+ xdp .rxq = & rx_ring -> xdp_rxq ;
1616
1618
tx_ring = r_vec -> xdp_ring ;
1617
1619
1618
1620
while (pkts_polled < budget ) {
@@ -1703,7 +1705,6 @@ static int nfp_net_rx(struct nfp_net_rx_ring *rx_ring, int budget)
1703
1705
dp -> bpf_offload_xdp ) && !meta .portid ) {
1704
1706
void * orig_data = rxbuf -> frag + pkt_off ;
1705
1707
unsigned int dma_off ;
1706
- struct xdp_buff xdp ;
1707
1708
int act ;
1708
1709
1709
1710
xdp .data_hard_start = rxbuf -> frag + NFP_NET_RX_BUF_HEADROOM ;
@@ -2252,6 +2253,7 @@ static void nfp_net_rx_ring_free(struct nfp_net_rx_ring *rx_ring)
2252
2253
struct nfp_net_r_vector * r_vec = rx_ring -> r_vec ;
2253
2254
struct nfp_net_dp * dp = & r_vec -> nfp_net -> dp ;
2254
2255
2256
+ xdp_rxq_info_unreg (& rx_ring -> xdp_rxq );
2255
2257
kfree (rx_ring -> rxbufs );
2256
2258
2257
2259
if (rx_ring -> rxds )
@@ -2275,7 +2277,11 @@ static void nfp_net_rx_ring_free(struct nfp_net_rx_ring *rx_ring)
2275
2277
static int
2276
2278
nfp_net_rx_ring_alloc (struct nfp_net_dp * dp , struct nfp_net_rx_ring * rx_ring )
2277
2279
{
2278
- int sz ;
2280
+ int sz , err ;
2281
+
2282
+ err = xdp_rxq_info_reg (& rx_ring -> xdp_rxq , dp -> netdev , rx_ring -> idx );
2283
+ if (err < 0 )
2284
+ return err ;
2279
2285
2280
2286
rx_ring -> cnt = dp -> rxd_cnt ;
2281
2287
rx_ring -> size = sizeof (* rx_ring -> rxds ) * rx_ring -> cnt ;
You can’t perform that action at this time.
0 commit comments