Skip to content

Commit 48ea8ea

Browse files
committed
Merge branch '40GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/net-queue
Tony Nguyen says: ==================== Intel Wired LAN Driver Updates 2022-07-18 This series contains updates to iavf driver only. Przemyslaw fixes handling of multiple VLAN requests to account for individual errors instead of rejecting them all. He removes incorrect implementations of ETHTOOL_COALESCE_MAX_FRAMES and ETHTOOL_COALESCE_MAX_FRAMES_IRQ. He also corrects an issue with NULL pointer caused by improper handling of dummy receive descriptors. Finally, he corrects debug prints reporting an unknown state. * '40GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/net-queue: iavf: Fix missing state logs iavf: Fix handling of dummy receive descriptors iavf: Disallow changing rx/tx-frames and rx/tx-frames-irq iavf: Fix VLAN_V2 addition/rejection ==================== Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
2 parents c6b10de + d8fa2fd commit 48ea8ea

File tree

5 files changed

+81
-26
lines changed

5 files changed

+81
-26
lines changed

drivers/net/ethernet/intel/iavf/iavf.h

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ struct iavf_vsi {
6464
u16 id;
6565
DECLARE_BITMAP(state, __IAVF_VSI_STATE_SIZE__);
6666
int base_vector;
67-
u16 work_limit;
6867
u16 qs_handle;
6968
void *priv; /* client driver data reference. */
7069
};
@@ -159,8 +158,12 @@ struct iavf_vlan {
159158
struct iavf_vlan_filter {
160159
struct list_head list;
161160
struct iavf_vlan vlan;
162-
bool remove; /* filter needs to be removed */
163-
bool add; /* filter needs to be added */
161+
struct {
162+
u8 is_new_vlan:1; /* filter is new, wait for PF answer */
163+
u8 remove:1; /* filter needs to be removed */
164+
u8 add:1; /* filter needs to be added */
165+
u8 padding:5;
166+
};
164167
};
165168

166169
#define IAVF_MAX_TRAFFIC_CLASS 4
@@ -461,6 +464,10 @@ static inline const char *iavf_state_str(enum iavf_state_t state)
461464
return "__IAVF_INIT_VERSION_CHECK";
462465
case __IAVF_INIT_GET_RESOURCES:
463466
return "__IAVF_INIT_GET_RESOURCES";
467+
case __IAVF_INIT_EXTENDED_CAPS:
468+
return "__IAVF_INIT_EXTENDED_CAPS";
469+
case __IAVF_INIT_CONFIG_ADAPTER:
470+
return "__IAVF_INIT_CONFIG_ADAPTER";
464471
case __IAVF_INIT_SW:
465472
return "__IAVF_INIT_SW";
466473
case __IAVF_INIT_FAILED:
@@ -520,6 +527,7 @@ int iavf_get_vf_config(struct iavf_adapter *adapter);
520527
int iavf_get_vf_vlan_v2_caps(struct iavf_adapter *adapter);
521528
int iavf_send_vf_offload_vlan_v2_msg(struct iavf_adapter *adapter);
522529
void iavf_set_queue_vlan_tag_loc(struct iavf_adapter *adapter);
530+
u16 iavf_get_num_vlans_added(struct iavf_adapter *adapter);
523531
void iavf_irq_enable(struct iavf_adapter *adapter, bool flush);
524532
void iavf_configure_queues(struct iavf_adapter *adapter);
525533
void iavf_deconfigure_queues(struct iavf_adapter *adapter);

drivers/net/ethernet/intel/iavf/iavf_ethtool.c

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -692,12 +692,8 @@ static int __iavf_get_coalesce(struct net_device *netdev,
692692
struct ethtool_coalesce *ec, int queue)
693693
{
694694
struct iavf_adapter *adapter = netdev_priv(netdev);
695-
struct iavf_vsi *vsi = &adapter->vsi;
696695
struct iavf_ring *rx_ring, *tx_ring;
697696

698-
ec->tx_max_coalesced_frames = vsi->work_limit;
699-
ec->rx_max_coalesced_frames = vsi->work_limit;
700-
701697
/* Rx and Tx usecs per queue value. If user doesn't specify the
702698
* queue, return queue 0's value to represent.
703699
*/
@@ -825,12 +821,8 @@ static int __iavf_set_coalesce(struct net_device *netdev,
825821
struct ethtool_coalesce *ec, int queue)
826822
{
827823
struct iavf_adapter *adapter = netdev_priv(netdev);
828-
struct iavf_vsi *vsi = &adapter->vsi;
829824
int i;
830825

831-
if (ec->tx_max_coalesced_frames_irq || ec->rx_max_coalesced_frames_irq)
832-
vsi->work_limit = ec->tx_max_coalesced_frames_irq;
833-
834826
if (ec->rx_coalesce_usecs == 0) {
835827
if (ec->use_adaptive_rx_coalesce)
836828
netif_info(adapter, drv, netdev, "rx-usecs=0, need to disable adaptive-rx for a complete disable\n");
@@ -1969,8 +1961,6 @@ static int iavf_set_rxfh(struct net_device *netdev, const u32 *indir,
19691961

19701962
static const struct ethtool_ops iavf_ethtool_ops = {
19711963
.supported_coalesce_params = ETHTOOL_COALESCE_USECS |
1972-
ETHTOOL_COALESCE_MAX_FRAMES |
1973-
ETHTOOL_COALESCE_MAX_FRAMES_IRQ |
19741964
ETHTOOL_COALESCE_USE_ADAPTIVE,
19751965
.get_drvinfo = iavf_get_drvinfo,
19761966
.get_link = ethtool_op_get_link,

drivers/net/ethernet/intel/iavf/iavf_main.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -843,7 +843,7 @@ static void iavf_restore_filters(struct iavf_adapter *adapter)
843843
* iavf_get_num_vlans_added - get number of VLANs added
844844
* @adapter: board private structure
845845
*/
846-
static u16 iavf_get_num_vlans_added(struct iavf_adapter *adapter)
846+
u16 iavf_get_num_vlans_added(struct iavf_adapter *adapter)
847847
{
848848
return bitmap_weight(adapter->vsi.active_cvlans, VLAN_N_VID) +
849849
bitmap_weight(adapter->vsi.active_svlans, VLAN_N_VID);
@@ -906,11 +906,6 @@ static int iavf_vlan_rx_add_vid(struct net_device *netdev,
906906
if (!iavf_add_vlan(adapter, IAVF_VLAN(vid, be16_to_cpu(proto))))
907907
return -ENOMEM;
908908

909-
if (proto == cpu_to_be16(ETH_P_8021Q))
910-
set_bit(vid, adapter->vsi.active_cvlans);
911-
else
912-
set_bit(vid, adapter->vsi.active_svlans);
913-
914909
return 0;
915910
}
916911

@@ -2245,7 +2240,6 @@ int iavf_parse_vf_resource_msg(struct iavf_adapter *adapter)
22452240

22462241
adapter->vsi.back = adapter;
22472242
adapter->vsi.base_vector = 1;
2248-
adapter->vsi.work_limit = IAVF_DEFAULT_IRQ_WORK;
22492243
vsi->netdev = adapter->netdev;
22502244
vsi->qs_handle = adapter->vsi_res->qset_handle;
22512245
if (adapter->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_RSS_PF) {
@@ -2956,6 +2950,9 @@ static void iavf_reset_task(struct work_struct *work)
29562950
adapter->aq_required |= IAVF_FLAG_AQ_ADD_CLOUD_FILTER;
29572951
iavf_misc_irq_enable(adapter);
29582952

2953+
bitmap_clear(adapter->vsi.active_cvlans, 0, VLAN_N_VID);
2954+
bitmap_clear(adapter->vsi.active_svlans, 0, VLAN_N_VID);
2955+
29592956
mod_delayed_work(iavf_wq, &adapter->watchdog_task, 2);
29602957

29612958
/* We were running when the reset started, so we need to restore some

drivers/net/ethernet/intel/iavf/iavf_txrx.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ static bool iavf_clean_tx_irq(struct iavf_vsi *vsi,
194194
struct iavf_tx_buffer *tx_buf;
195195
struct iavf_tx_desc *tx_desc;
196196
unsigned int total_bytes = 0, total_packets = 0;
197-
unsigned int budget = vsi->work_limit;
197+
unsigned int budget = IAVF_DEFAULT_IRQ_WORK;
198198

199199
tx_buf = &tx_ring->tx_bi[i];
200200
tx_desc = IAVF_TX_DESC(tx_ring, i);
@@ -1285,11 +1285,10 @@ static struct iavf_rx_buffer *iavf_get_rx_buffer(struct iavf_ring *rx_ring,
12851285
{
12861286
struct iavf_rx_buffer *rx_buffer;
12871287

1288-
if (!size)
1289-
return NULL;
1290-
12911288
rx_buffer = &rx_ring->rx_bi[rx_ring->next_to_clean];
12921289
prefetchw(rx_buffer->page);
1290+
if (!size)
1291+
return rx_buffer;
12931292

12941293
/* we are reusing so sync this buffer for CPU use */
12951294
dma_sync_single_range_for_cpu(rx_ring->dev,

drivers/net/ethernet/intel/iavf/iavf_virtchnl.c

Lines changed: 63 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -626,6 +626,33 @@ static void iavf_mac_add_reject(struct iavf_adapter *adapter)
626626
spin_unlock_bh(&adapter->mac_vlan_list_lock);
627627
}
628628

629+
/**
630+
* iavf_vlan_add_reject
631+
* @adapter: adapter structure
632+
*
633+
* Remove VLAN filters from list based on PF response.
634+
**/
635+
static void iavf_vlan_add_reject(struct iavf_adapter *adapter)
636+
{
637+
struct iavf_vlan_filter *f, *ftmp;
638+
639+
spin_lock_bh(&adapter->mac_vlan_list_lock);
640+
list_for_each_entry_safe(f, ftmp, &adapter->vlan_filter_list, list) {
641+
if (f->is_new_vlan) {
642+
if (f->vlan.tpid == ETH_P_8021Q)
643+
clear_bit(f->vlan.vid,
644+
adapter->vsi.active_cvlans);
645+
else
646+
clear_bit(f->vlan.vid,
647+
adapter->vsi.active_svlans);
648+
649+
list_del(&f->list);
650+
kfree(f);
651+
}
652+
}
653+
spin_unlock_bh(&adapter->mac_vlan_list_lock);
654+
}
655+
629656
/**
630657
* iavf_add_vlans
631658
* @adapter: adapter structure
@@ -683,6 +710,7 @@ void iavf_add_vlans(struct iavf_adapter *adapter)
683710
vvfl->vlan_id[i] = f->vlan.vid;
684711
i++;
685712
f->add = false;
713+
f->is_new_vlan = true;
686714
if (i == count)
687715
break;
688716
}
@@ -695,10 +723,18 @@ void iavf_add_vlans(struct iavf_adapter *adapter)
695723
iavf_send_pf_msg(adapter, VIRTCHNL_OP_ADD_VLAN, (u8 *)vvfl, len);
696724
kfree(vvfl);
697725
} else {
726+
u16 max_vlans = adapter->vlan_v2_caps.filtering.max_filters;
727+
u16 current_vlans = iavf_get_num_vlans_added(adapter);
698728
struct virtchnl_vlan_filter_list_v2 *vvfl_v2;
699729

700730
adapter->current_op = VIRTCHNL_OP_ADD_VLAN_V2;
701731

732+
if ((count + current_vlans) > max_vlans &&
733+
current_vlans < max_vlans) {
734+
count = max_vlans - iavf_get_num_vlans_added(adapter);
735+
more = true;
736+
}
737+
702738
len = sizeof(*vvfl_v2) + ((count - 1) *
703739
sizeof(struct virtchnl_vlan_filter));
704740
if (len > IAVF_MAX_AQ_BUF_SIZE) {
@@ -725,6 +761,9 @@ void iavf_add_vlans(struct iavf_adapter *adapter)
725761
&adapter->vlan_v2_caps.filtering.filtering_support;
726762
struct virtchnl_vlan *vlan;
727763

764+
if (i == count)
765+
break;
766+
728767
/* give priority over outer if it's enabled */
729768
if (filtering_support->outer)
730769
vlan = &vvfl_v2->filters[i].outer;
@@ -736,8 +775,7 @@ void iavf_add_vlans(struct iavf_adapter *adapter)
736775

737776
i++;
738777
f->add = false;
739-
if (i == count)
740-
break;
778+
f->is_new_vlan = true;
741779
}
742780
}
743781

@@ -2080,6 +2118,11 @@ void iavf_virtchnl_completion(struct iavf_adapter *adapter,
20802118
*/
20812119
iavf_netdev_features_vlan_strip_set(netdev, true);
20822120
break;
2121+
case VIRTCHNL_OP_ADD_VLAN_V2:
2122+
iavf_vlan_add_reject(adapter);
2123+
dev_warn(&adapter->pdev->dev, "Failed to add VLAN filter, error %s\n",
2124+
iavf_stat_str(&adapter->hw, v_retval));
2125+
break;
20832126
default:
20842127
dev_err(&adapter->pdev->dev, "PF returned error %d (%s) to our request %d\n",
20852128
v_retval, iavf_stat_str(&adapter->hw, v_retval),
@@ -2332,6 +2375,24 @@ void iavf_virtchnl_completion(struct iavf_adapter *adapter,
23322375
spin_unlock_bh(&adapter->adv_rss_lock);
23332376
}
23342377
break;
2378+
case VIRTCHNL_OP_ADD_VLAN_V2: {
2379+
struct iavf_vlan_filter *f;
2380+
2381+
spin_lock_bh(&adapter->mac_vlan_list_lock);
2382+
list_for_each_entry(f, &adapter->vlan_filter_list, list) {
2383+
if (f->is_new_vlan) {
2384+
f->is_new_vlan = false;
2385+
if (f->vlan.tpid == ETH_P_8021Q)
2386+
set_bit(f->vlan.vid,
2387+
adapter->vsi.active_cvlans);
2388+
else
2389+
set_bit(f->vlan.vid,
2390+
adapter->vsi.active_svlans);
2391+
}
2392+
}
2393+
spin_unlock_bh(&adapter->mac_vlan_list_lock);
2394+
}
2395+
break;
23352396
case VIRTCHNL_OP_ENABLE_VLAN_STRIPPING:
23362397
/* PF enabled vlan strip on this VF.
23372398
* Update netdev->features if needed to be in sync with ethtool.

0 commit comments

Comments
 (0)