@@ -46,8 +46,9 @@ static int ionic_start_queues(struct ionic_lif *lif);
46
46
static void ionic_stop_queues (struct ionic_lif * lif );
47
47
static void ionic_lif_queue_identify (struct ionic_lif * lif );
48
48
49
- static int ionic_xdp_rxqs_update (struct ionic_lif * lif );
50
- static void ionic_xdp_unregister_rxq_info (struct ionic_queue * q );
49
+ static void ionic_xdp_rxqs_prog_update (struct ionic_lif * lif );
50
+ static void ionic_unregister_rxq_info (struct ionic_queue * q );
51
+ static int ionic_register_rxq_info (struct ionic_queue * q , unsigned int napi_id );
51
52
52
53
static void ionic_dim_work (struct work_struct * work )
53
54
{
@@ -380,6 +381,7 @@ static void ionic_lif_qcq_deinit(struct ionic_lif *lif, struct ionic_qcq *qcq)
380
381
if (!(qcq -> flags & IONIC_QCQ_F_INITED ))
381
382
return ;
382
383
384
+ ionic_unregister_rxq_info (& qcq -> q );
383
385
if (qcq -> flags & IONIC_QCQ_F_INTR ) {
384
386
ionic_intr_mask (idev -> intr_ctrl , qcq -> intr .index ,
385
387
IONIC_INTR_MASK_SET );
@@ -437,9 +439,7 @@ static void ionic_qcq_free(struct ionic_lif *lif, struct ionic_qcq *qcq)
437
439
qcq -> sg_base_pa = 0 ;
438
440
}
439
441
440
- ionic_xdp_unregister_rxq_info (& qcq -> q );
441
442
ionic_qcq_intr_free (lif , qcq );
442
-
443
443
vfree (qcq -> q .info );
444
444
qcq -> q .info = NULL ;
445
445
}
@@ -925,6 +925,11 @@ static int ionic_lif_rxq_init(struct ionic_lif *lif, struct ionic_qcq *qcq)
925
925
netif_napi_add (lif -> netdev , & qcq -> napi , ionic_rx_napi );
926
926
else
927
927
netif_napi_add (lif -> netdev , & qcq -> napi , ionic_txrx_napi );
928
+ err = ionic_register_rxq_info (q , qcq -> napi .napi_id );
929
+ if (err ) {
930
+ netif_napi_del (& qcq -> napi );
931
+ return err ;
932
+ }
928
933
929
934
qcq -> flags |= IONIC_QCQ_F_INITED ;
930
935
@@ -2143,9 +2148,7 @@ static int ionic_txrx_enable(struct ionic_lif *lif)
2143
2148
int derr = 0 ;
2144
2149
int i , err ;
2145
2150
2146
- err = ionic_xdp_rxqs_update (lif );
2147
- if (err )
2148
- return err ;
2151
+ ionic_xdp_rxqs_prog_update (lif );
2149
2152
2150
2153
for (i = 0 ; i < lif -> nxqs ; i ++ ) {
2151
2154
if (!(lif -> rxqcqs [i ] && lif -> txqcqs [i ])) {
@@ -2192,7 +2195,7 @@ static int ionic_txrx_enable(struct ionic_lif *lif)
2192
2195
derr = ionic_qcq_disable (lif , lif -> rxqcqs [i ], derr );
2193
2196
}
2194
2197
2195
- ionic_xdp_rxqs_update (lif );
2198
+ ionic_xdp_rxqs_prog_update (lif );
2196
2199
2197
2200
return err ;
2198
2201
}
@@ -2651,7 +2654,7 @@ static void ionic_vf_attr_replay(struct ionic_lif *lif)
2651
2654
ionic_vf_start (ionic );
2652
2655
}
2653
2656
2654
- static void ionic_xdp_unregister_rxq_info (struct ionic_queue * q )
2657
+ static void ionic_unregister_rxq_info (struct ionic_queue * q )
2655
2658
{
2656
2659
struct xdp_rxq_info * xi ;
2657
2660
@@ -2665,7 +2668,7 @@ static void ionic_xdp_unregister_rxq_info(struct ionic_queue *q)
2665
2668
kfree (xi );
2666
2669
}
2667
2670
2668
- static int ionic_xdp_register_rxq_info (struct ionic_queue * q , unsigned int napi_id )
2671
+ static int ionic_register_rxq_info (struct ionic_queue * q , unsigned int napi_id )
2669
2672
{
2670
2673
struct xdp_rxq_info * rxq_info ;
2671
2674
int err ;
@@ -2698,44 +2701,20 @@ static int ionic_xdp_register_rxq_info(struct ionic_queue *q, unsigned int napi_
2698
2701
return err ;
2699
2702
}
2700
2703
2701
- static int ionic_xdp_rxqs_update (struct ionic_lif * lif )
2704
+ static void ionic_xdp_rxqs_prog_update (struct ionic_lif * lif )
2702
2705
{
2703
2706
struct bpf_prog * xdp_prog ;
2704
2707
unsigned int i ;
2705
- int err ;
2706
2708
2707
2709
if (!lif -> rxqcqs )
2708
- return 0 ;
2710
+ return ;
2709
2711
2710
2712
xdp_prog = READ_ONCE (lif -> xdp_prog );
2711
2713
for (i = 0 ; i < lif -> ionic -> nrxqs_per_lif && lif -> rxqcqs [i ]; i ++ ) {
2712
2714
struct ionic_queue * q = & lif -> rxqcqs [i ]-> q ;
2713
2715
2714
- if (q -> xdp_prog ) {
2715
- ionic_xdp_unregister_rxq_info (q );
2716
- q -> xdp_prog = NULL ;
2717
- }
2718
-
2719
- if (xdp_prog ) {
2720
- unsigned int napi_id = lif -> rxqcqs [i ]-> napi .napi_id ;
2721
-
2722
- err = ionic_xdp_register_rxq_info (q , napi_id );
2723
- if (err ) {
2724
- dev_err (lif -> ionic -> dev , "failed to register RX queue %d info for XDP, err %d\n" ,
2725
- i , err );
2726
- goto err_out ;
2727
- }
2728
- }
2729
2716
q -> xdp_prog = xdp_prog ;
2730
2717
}
2731
-
2732
- return 0 ;
2733
-
2734
- err_out :
2735
- for (i = 0 ; i < lif -> ionic -> nrxqs_per_lif && lif -> rxqcqs [i ]; i ++ )
2736
- ionic_xdp_unregister_rxq_info (& lif -> rxqcqs [i ]-> q );
2737
-
2738
- return err ;
2739
2718
}
2740
2719
2741
2720
static int ionic_xdp_config (struct net_device * netdev , struct netdev_bpf * bpf )
0 commit comments