@@ -4800,7 +4800,6 @@ static void bnxt_clear_ring_indices(struct bnxt *bp)
4800
4800
4801
4801
static void bnxt_free_ntp_fltrs (struct bnxt * bp , bool all )
4802
4802
{
4803
- #ifdef CONFIG_RFS_ACCEL
4804
4803
int i ;
4805
4804
4806
4805
/* Under rtnl_lock and all our NAPIs have been disabled. It's
@@ -4828,12 +4827,10 @@ static void bnxt_free_ntp_fltrs(struct bnxt *bp, bool all)
4828
4827
bitmap_free (bp -> ntp_fltr_bmap );
4829
4828
bp -> ntp_fltr_bmap = NULL ;
4830
4829
bp -> ntp_fltr_count = 0 ;
4831
- #endif
4832
4830
}
4833
4831
4834
4832
static int bnxt_alloc_ntp_fltrs (struct bnxt * bp )
4835
4833
{
4836
- #ifdef CONFIG_RFS_ACCEL
4837
4834
int i , rc = 0 ;
4838
4835
4839
4836
if (!(bp -> flags & BNXT_FLAG_RFS ) || bp -> ntp_fltr_bmap )
@@ -4849,9 +4846,6 @@ static int bnxt_alloc_ntp_fltrs(struct bnxt *bp)
4849
4846
rc = - ENOMEM ;
4850
4847
4851
4848
return rc ;
4852
- #else
4853
- return 0 ;
4854
- #endif
4855
4849
}
4856
4850
4857
4851
static void bnxt_free_l2_filters (struct bnxt * bp , bool all )
@@ -5615,7 +5609,6 @@ int bnxt_hwrm_l2_filter_alloc(struct bnxt *bp, struct bnxt_l2_filter *fltr)
5615
5609
return rc ;
5616
5610
}
5617
5611
5618
- #ifdef CONFIG_RFS_ACCEL
5619
5612
static int bnxt_hwrm_cfa_ntuple_filter_free (struct bnxt * bp ,
5620
5613
struct bnxt_ntuple_filter * fltr )
5621
5614
{
@@ -5719,7 +5712,6 @@ static int bnxt_hwrm_cfa_ntuple_filter_alloc(struct bnxt *bp,
5719
5712
hwrm_req_drop (bp , req );
5720
5713
return rc ;
5721
5714
}
5722
- #endif
5723
5715
5724
5716
static int bnxt_hwrm_set_vnic_filter (struct bnxt * bp , u16 vnic_id , u16 idx ,
5725
5717
const u8 * mac_addr )
@@ -9677,7 +9669,6 @@ static int bnxt_setup_vnic(struct bnxt *bp, u16 vnic_id)
9677
9669
9678
9670
static int bnxt_alloc_rfs_vnics (struct bnxt * bp )
9679
9671
{
9680
- #ifdef CONFIG_RFS_ACCEL
9681
9672
int i , rc = 0 ;
9682
9673
9683
9674
if (bp -> flags & BNXT_FLAG_CHIP_P5_PLUS )
@@ -9706,9 +9697,6 @@ static int bnxt_alloc_rfs_vnics(struct bnxt *bp)
9706
9697
break ;
9707
9698
}
9708
9699
return rc ;
9709
- #else
9710
- return 0 ;
9711
- #endif
9712
9700
}
9713
9701
9714
9702
/* Allow PF, trusted VFs and VFs with default VLAN to be in promiscuous mode */
@@ -10036,7 +10024,6 @@ static int bnxt_setup_int_mode(struct bnxt *bp)
10036
10024
return rc ;
10037
10025
}
10038
10026
10039
- #ifdef CONFIG_RFS_ACCEL
10040
10027
static unsigned int bnxt_get_max_func_rss_ctxs (struct bnxt * bp )
10041
10028
{
10042
10029
return bp -> hw_resc .max_rsscos_ctxs ;
@@ -10046,7 +10033,6 @@ static unsigned int bnxt_get_max_func_vnics(struct bnxt *bp)
10046
10033
{
10047
10034
return bp -> hw_resc .max_vnics ;
10048
10035
}
10049
- #endif
10050
10036
10051
10037
unsigned int bnxt_get_max_func_stat_ctxs (struct bnxt * bp )
10052
10038
{
@@ -12160,7 +12146,6 @@ static bool bnxt_rfs_supported(struct bnxt *bp)
12160
12146
/* If runtime conditions support RFS */
12161
12147
static bool bnxt_rfs_capable (struct bnxt * bp )
12162
12148
{
12163
- #ifdef CONFIG_RFS_ACCEL
12164
12149
int vnics , max_vnics , max_rss_ctxs ;
12165
12150
12166
12151
if (bp -> flags & BNXT_FLAG_CHIP_P5_PLUS )
@@ -12196,9 +12181,6 @@ static bool bnxt_rfs_capable(struct bnxt *bp)
12196
12181
netdev_warn (bp -> dev , "Unable to reserve resources to support NTUPLE filters.\n" );
12197
12182
bnxt_hwrm_reserve_rings (bp , 0 , 0 , 0 , 0 , 0 , 1 );
12198
12183
return false;
12199
- #else
12200
- return false;
12201
- #endif
12202
12184
}
12203
12185
12204
12186
static netdev_features_t bnxt_fix_features (struct net_device * dev ,
@@ -13861,8 +13843,8 @@ static int bnxt_setup_tc(struct net_device *dev, enum tc_setup_type type,
13861
13843
}
13862
13844
}
13863
13845
13864
- static u32 bnxt_get_ntp_filter_idx (struct bnxt * bp , struct flow_keys * fkeys ,
13865
- const struct sk_buff * skb )
13846
+ u32 bnxt_get_ntp_filter_idx (struct bnxt * bp , struct flow_keys * fkeys ,
13847
+ const struct sk_buff * skb )
13866
13848
{
13867
13849
struct bnxt_vnic_info * vnic ;
13868
13850
@@ -13873,7 +13855,30 @@ static u32 bnxt_get_ntp_filter_idx(struct bnxt *bp, struct flow_keys *fkeys,
13873
13855
return bnxt_toeplitz (bp , fkeys , (void * )vnic -> rss_hash_key );
13874
13856
}
13875
13857
13876
- #ifdef CONFIG_RFS_ACCEL
13858
+ int bnxt_insert_ntp_filter (struct bnxt * bp , struct bnxt_ntuple_filter * fltr ,
13859
+ u32 idx )
13860
+ {
13861
+ struct hlist_head * head ;
13862
+ int bit_id ;
13863
+
13864
+ spin_lock_bh (& bp -> ntp_fltr_lock );
13865
+ bit_id = bitmap_find_free_region (bp -> ntp_fltr_bmap , BNXT_MAX_FLTR , 0 );
13866
+ if (bit_id < 0 ) {
13867
+ spin_unlock_bh (& bp -> ntp_fltr_lock );
13868
+ return - ENOMEM ;
13869
+ }
13870
+
13871
+ fltr -> base .sw_id = (u16 )bit_id ;
13872
+ fltr -> base .type = BNXT_FLTR_TYPE_NTUPLE ;
13873
+ fltr -> base .flags |= BNXT_ACT_RING_DST ;
13874
+ head = & bp -> ntp_fltr_hash_tbl [idx ];
13875
+ hlist_add_head_rcu (& fltr -> base .hash , head );
13876
+ set_bit (BNXT_FLTR_INSERTED , & fltr -> base .state );
13877
+ bp -> ntp_fltr_count ++ ;
13878
+ spin_unlock_bh (& bp -> ntp_fltr_lock );
13879
+ return 0 ;
13880
+ }
13881
+
13877
13882
static bool bnxt_fltr_match (struct bnxt_ntuple_filter * f1 ,
13878
13883
struct bnxt_ntuple_filter * f2 )
13879
13884
{
@@ -13904,7 +13909,7 @@ static bool bnxt_fltr_match(struct bnxt_ntuple_filter *f1,
13904
13909
return false;
13905
13910
}
13906
13911
13907
- static struct bnxt_ntuple_filter *
13912
+ struct bnxt_ntuple_filter *
13908
13913
bnxt_lookup_ntp_filter_from_idx (struct bnxt * bp ,
13909
13914
struct bnxt_ntuple_filter * fltr , u32 idx )
13910
13915
{
@@ -13919,6 +13924,7 @@ bnxt_lookup_ntp_filter_from_idx(struct bnxt *bp,
13919
13924
return NULL ;
13920
13925
}
13921
13926
13927
+ #ifdef CONFIG_RFS_ACCEL
13922
13928
static int bnxt_rx_flow_steer (struct net_device * dev , const struct sk_buff * skb ,
13923
13929
u16 rxq_index , u32 flow_id )
13924
13930
{
@@ -13927,8 +13933,7 @@ static int bnxt_rx_flow_steer(struct net_device *dev, const struct sk_buff *skb,
13927
13933
struct flow_keys * fkeys ;
13928
13934
struct ethhdr * eth = (struct ethhdr * )skb_mac_header (skb );
13929
13935
struct bnxt_l2_filter * l2_fltr ;
13930
- int rc = 0 , idx , bit_id ;
13931
- struct hlist_head * head ;
13936
+ int rc = 0 , idx ;
13932
13937
u32 flags ;
13933
13938
13934
13939
if (ether_addr_equal (dev -> dev_addr , eth -> h_dest )) {
@@ -13981,7 +13986,6 @@ static int bnxt_rx_flow_steer(struct net_device *dev, const struct sk_buff *skb,
13981
13986
new_fltr -> l2_fltr = l2_fltr ;
13982
13987
13983
13988
idx = bnxt_get_ntp_filter_idx (bp , fkeys , skb );
13984
- head = & bp -> ntp_fltr_hash_tbl [idx ];
13985
13989
rcu_read_lock ();
13986
13990
fltr = bnxt_lookup_ntp_filter_from_idx (bp , new_fltr , idx );
13987
13991
if (fltr ) {
@@ -13991,33 +13995,20 @@ static int bnxt_rx_flow_steer(struct net_device *dev, const struct sk_buff *skb,
13991
13995
}
13992
13996
rcu_read_unlock ();
13993
13997
13994
- spin_lock_bh (& bp -> ntp_fltr_lock );
13995
- bit_id = bitmap_find_free_region (bp -> ntp_fltr_bmap , BNXT_MAX_FLTR , 0 );
13996
- if (bit_id < 0 ) {
13997
- spin_unlock_bh (& bp -> ntp_fltr_lock );
13998
- rc = - ENOMEM ;
13999
- goto err_free ;
14000
- }
14001
-
14002
- new_fltr -> base .sw_id = (u16 )bit_id ;
14003
13998
new_fltr -> flow_id = flow_id ;
14004
13999
new_fltr -> base .rxq = rxq_index ;
14005
- new_fltr -> base .type = BNXT_FLTR_TYPE_NTUPLE ;
14006
- new_fltr -> base .flags = BNXT_ACT_RING_DST ;
14007
- hlist_add_head_rcu (& new_fltr -> base .hash , head );
14008
- set_bit (BNXT_FLTR_INSERTED , & new_fltr -> base .state );
14009
- bp -> ntp_fltr_count ++ ;
14010
- spin_unlock_bh (& bp -> ntp_fltr_lock );
14011
-
14012
- bnxt_queue_sp_work (bp , BNXT_RX_NTP_FLTR_SP_EVENT );
14013
-
14014
- return new_fltr -> base .sw_id ;
14000
+ rc = bnxt_insert_ntp_filter (bp , new_fltr , idx );
14001
+ if (!rc ) {
14002
+ bnxt_queue_sp_work (bp , BNXT_RX_NTP_FLTR_SP_EVENT );
14003
+ return new_fltr -> base .sw_id ;
14004
+ }
14015
14005
14016
14006
err_free :
14017
14007
bnxt_del_l2_filter (bp , l2_fltr );
14018
14008
kfree (new_fltr );
14019
14009
return rc ;
14020
14010
}
14011
+ #endif
14021
14012
14022
14013
static void bnxt_cfg_ntp_filters (struct bnxt * bp )
14023
14014
{
@@ -14070,14 +14061,6 @@ static void bnxt_cfg_ntp_filters(struct bnxt *bp)
14070
14061
netdev_info (bp -> dev , "Receive PF driver unload event!\n" );
14071
14062
}
14072
14063
14073
- #else
14074
-
14075
- static void bnxt_cfg_ntp_filters (struct bnxt * bp )
14076
- {
14077
- }
14078
-
14079
- #endif /* CONFIG_RFS_ACCEL */
14080
-
14081
14064
static int bnxt_udp_tunnel_set_port (struct net_device * netdev , unsigned int table ,
14082
14065
unsigned int entry , struct udp_tunnel_info * ti )
14083
14066
{
0 commit comments