Skip to content

Commit 371de1a

Browse files
committed
Merge branch '100GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/net-queue
Tony Nguyen says: ==================== Intel Wired LAN Driver Updates 2022-06-14 This series contains updates to ice driver only. Michal fixes incorrect Tx timestamp offset calculation for E822 devices. Roman enforces required VLAN filtering settings for double VLAN mode. Przemyslaw fixes memory corruption issues with VFs by ensuring queues are disabled in the error path of VF queue configuration and to disabled VFs during reset. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
2 parents b60377d + efe4186 commit 371de1a

5 files changed

Lines changed: 94 additions & 46 deletions

File tree

drivers/net/ethernet/intel/ice/ice_main.c

Lines changed: 31 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5763,25 +5763,38 @@ static netdev_features_t
57635763
ice_fix_features(struct net_device *netdev, netdev_features_t features)
57645764
{
57655765
struct ice_netdev_priv *np = netdev_priv(netdev);
5766-
netdev_features_t supported_vlan_filtering;
5767-
netdev_features_t requested_vlan_filtering;
5768-
struct ice_vsi *vsi = np->vsi;
5769-
5770-
requested_vlan_filtering = features & NETIF_VLAN_FILTERING_FEATURES;
5771-
5772-
/* make sure supported_vlan_filtering works for both SVM and DVM */
5773-
supported_vlan_filtering = NETIF_F_HW_VLAN_CTAG_FILTER;
5774-
if (ice_is_dvm_ena(&vsi->back->hw))
5775-
supported_vlan_filtering |= NETIF_F_HW_VLAN_STAG_FILTER;
5776-
5777-
if (requested_vlan_filtering &&
5778-
requested_vlan_filtering != supported_vlan_filtering) {
5779-
if (requested_vlan_filtering & NETIF_F_HW_VLAN_CTAG_FILTER) {
5780-
netdev_warn(netdev, "cannot support requested VLAN filtering settings, enabling all supported VLAN filtering settings\n");
5781-
features |= supported_vlan_filtering;
5766+
netdev_features_t req_vlan_fltr, cur_vlan_fltr;
5767+
bool cur_ctag, cur_stag, req_ctag, req_stag;
5768+
5769+
cur_vlan_fltr = netdev->features & NETIF_VLAN_FILTERING_FEATURES;
5770+
cur_ctag = cur_vlan_fltr & NETIF_F_HW_VLAN_CTAG_FILTER;
5771+
cur_stag = cur_vlan_fltr & NETIF_F_HW_VLAN_STAG_FILTER;
5772+
5773+
req_vlan_fltr = features & NETIF_VLAN_FILTERING_FEATURES;
5774+
req_ctag = req_vlan_fltr & NETIF_F_HW_VLAN_CTAG_FILTER;
5775+
req_stag = req_vlan_fltr & NETIF_F_HW_VLAN_STAG_FILTER;
5776+
5777+
if (req_vlan_fltr != cur_vlan_fltr) {
5778+
if (ice_is_dvm_ena(&np->vsi->back->hw)) {
5779+
if (req_ctag && req_stag) {
5780+
features |= NETIF_VLAN_FILTERING_FEATURES;
5781+
} else if (!req_ctag && !req_stag) {
5782+
features &= ~NETIF_VLAN_FILTERING_FEATURES;
5783+
} else if ((!cur_ctag && req_ctag && !cur_stag) ||
5784+
(!cur_stag && req_stag && !cur_ctag)) {
5785+
features |= NETIF_VLAN_FILTERING_FEATURES;
5786+
netdev_warn(netdev, "802.1Q and 802.1ad VLAN filtering must be either both on or both off. VLAN filtering has been enabled for both types.\n");
5787+
} else if ((cur_ctag && !req_ctag && cur_stag) ||
5788+
(cur_stag && !req_stag && cur_ctag)) {
5789+
features &= ~NETIF_VLAN_FILTERING_FEATURES;
5790+
netdev_warn(netdev, "802.1Q and 802.1ad VLAN filtering must be either both on or both off. VLAN filtering has been disabled for both types.\n");
5791+
}
57825792
} else {
5783-
netdev_warn(netdev, "cannot support requested VLAN filtering settings, clearing all supported VLAN filtering settings\n");
5784-
features &= ~supported_vlan_filtering;
5793+
if (req_vlan_fltr & NETIF_F_HW_VLAN_STAG_FILTER)
5794+
netdev_warn(netdev, "cannot support requested 802.1ad filtering setting in SVM mode\n");
5795+
5796+
if (req_vlan_fltr & NETIF_F_HW_VLAN_CTAG_FILTER)
5797+
features |= NETIF_F_HW_VLAN_CTAG_FILTER;
57855798
}
57865799
}
57875800

drivers/net/ethernet/intel/ice/ice_ptp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2271,7 +2271,7 @@ static int
22712271
ice_ptp_init_tx_e822(struct ice_pf *pf, struct ice_ptp_tx *tx, u8 port)
22722272
{
22732273
tx->quad = port / ICE_PORTS_PER_QUAD;
2274-
tx->quad_offset = tx->quad * INDEX_PER_PORT;
2274+
tx->quad_offset = (port % ICE_PORTS_PER_QUAD) * INDEX_PER_PORT;
22752275
tx->len = INDEX_PER_PORT;
22762276

22772277
return ice_ptp_alloc_tx_tracker(tx);

drivers/net/ethernet/intel/ice/ice_ptp.h

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,37 @@ struct ice_perout_channel {
4949
* To allow multiple ports to access the shared register block independently,
5050
* the blocks are split up so that indexes are assigned to each port based on
5151
* hardware logical port number.
52+
*
53+
* The timestamp blocks are handled differently for E810- and E822-based
54+
* devices. In E810 devices, each port has its own block of timestamps, while in
55+
* E822 there is a need to logically break the block of registers into smaller
56+
* chunks based on the port number to avoid collisions.
57+
*
58+
* Example for port 5 in E810:
59+
* +--------+--------+--------+--------+--------+--------+--------+--------+
60+
* |register|register|register|register|register|register|register|register|
61+
* | block | block | block | block | block | block | block | block |
62+
* | for | for | for | for | for | for | for | for |
63+
* | port 0 | port 1 | port 2 | port 3 | port 4 | port 5 | port 6 | port 7 |
64+
* +--------+--------+--------+--------+--------+--------+--------+--------+
65+
* ^^
66+
* ||
67+
* |--- quad offset is always 0
68+
* ---- quad number
69+
*
70+
* Example for port 5 in E822:
71+
* +-----------------------------+-----------------------------+
72+
* | register block for quad 0 | register block for quad 1 |
73+
* |+------+------+------+------+|+------+------+------+------+|
74+
* ||port 0|port 1|port 2|port 3|||port 0|port 1|port 2|port 3||
75+
* |+------+------+------+------+|+------+------+------+------+|
76+
* +-----------------------------+-------^---------------------+
77+
* ^ |
78+
* | --- quad offset*
79+
* ---- quad number
80+
*
81+
* * PHY port 5 is port 1 in quad 1
82+
*
5283
*/
5384

5485
/**

drivers/net/ethernet/intel/ice/ice_vf_lib.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -504,6 +504,11 @@ int ice_reset_vf(struct ice_vf *vf, u32 flags)
504504
}
505505

506506
if (ice_is_vf_disabled(vf)) {
507+
vsi = ice_get_vf_vsi(vf);
508+
if (WARN_ON(!vsi))
509+
return -EINVAL;
510+
ice_vsi_stop_lan_tx_rings(vsi, ICE_NO_RESET, vf->vf_id);
511+
ice_vsi_stop_all_rx_rings(vsi);
507512
dev_dbg(dev, "VF is already disabled, there is no need for resetting it, telling VM, all is fine %d\n",
508513
vf->vf_id);
509514
return 0;

drivers/net/ethernet/intel/ice/ice_virtchnl.c

Lines changed: 26 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1569,35 +1569,27 @@ static int ice_vc_cfg_irq_map_msg(struct ice_vf *vf, u8 *msg)
15691569
*/
15701570
static int ice_vc_cfg_qs_msg(struct ice_vf *vf, u8 *msg)
15711571
{
1572-
enum virtchnl_status_code v_ret = VIRTCHNL_STATUS_SUCCESS;
15731572
struct virtchnl_vsi_queue_config_info *qci =
15741573
(struct virtchnl_vsi_queue_config_info *)msg;
15751574
struct virtchnl_queue_pair_info *qpi;
15761575
struct ice_pf *pf = vf->pf;
15771576
struct ice_vsi *vsi;
1578-
int i, q_idx;
1577+
int i = -1, q_idx;
15791578

1580-
if (!test_bit(ICE_VF_STATE_ACTIVE, vf->vf_states)) {
1581-
v_ret = VIRTCHNL_STATUS_ERR_PARAM;
1579+
if (!test_bit(ICE_VF_STATE_ACTIVE, vf->vf_states))
15821580
goto error_param;
1583-
}
15841581

1585-
if (!ice_vc_isvalid_vsi_id(vf, qci->vsi_id)) {
1586-
v_ret = VIRTCHNL_STATUS_ERR_PARAM;
1582+
if (!ice_vc_isvalid_vsi_id(vf, qci->vsi_id))
15871583
goto error_param;
1588-
}
15891584

15901585
vsi = ice_get_vf_vsi(vf);
1591-
if (!vsi) {
1592-
v_ret = VIRTCHNL_STATUS_ERR_PARAM;
1586+
if (!vsi)
15931587
goto error_param;
1594-
}
15951588

15961589
if (qci->num_queue_pairs > ICE_MAX_RSS_QS_PER_VF ||
15971590
qci->num_queue_pairs > min_t(u16, vsi->alloc_txq, vsi->alloc_rxq)) {
15981591
dev_err(ice_pf_to_dev(pf), "VF-%d requesting more than supported number of queues: %d\n",
15991592
vf->vf_id, min_t(u16, vsi->alloc_txq, vsi->alloc_rxq));
1600-
v_ret = VIRTCHNL_STATUS_ERR_PARAM;
16011593
goto error_param;
16021594
}
16031595

@@ -1610,7 +1602,6 @@ static int ice_vc_cfg_qs_msg(struct ice_vf *vf, u8 *msg)
16101602
!ice_vc_isvalid_ring_len(qpi->txq.ring_len) ||
16111603
!ice_vc_isvalid_ring_len(qpi->rxq.ring_len) ||
16121604
!ice_vc_isvalid_q_id(vf, qci->vsi_id, qpi->txq.queue_id)) {
1613-
v_ret = VIRTCHNL_STATUS_ERR_PARAM;
16141605
goto error_param;
16151606
}
16161607

@@ -1620,7 +1611,6 @@ static int ice_vc_cfg_qs_msg(struct ice_vf *vf, u8 *msg)
16201611
* for selected "vsi"
16211612
*/
16221613
if (q_idx >= vsi->alloc_txq || q_idx >= vsi->alloc_rxq) {
1623-
v_ret = VIRTCHNL_STATUS_ERR_PARAM;
16241614
goto error_param;
16251615
}
16261616

@@ -1630,14 +1620,13 @@ static int ice_vc_cfg_qs_msg(struct ice_vf *vf, u8 *msg)
16301620
vsi->tx_rings[i]->count = qpi->txq.ring_len;
16311621

16321622
/* Disable any existing queue first */
1633-
if (ice_vf_vsi_dis_single_txq(vf, vsi, q_idx)) {
1634-
v_ret = VIRTCHNL_STATUS_ERR_PARAM;
1623+
if (ice_vf_vsi_dis_single_txq(vf, vsi, q_idx))
16351624
goto error_param;
1636-
}
16371625

16381626
/* Configure a queue with the requested settings */
16391627
if (ice_vsi_cfg_single_txq(vsi, vsi->tx_rings, q_idx)) {
1640-
v_ret = VIRTCHNL_STATUS_ERR_PARAM;
1628+
dev_warn(ice_pf_to_dev(pf), "VF-%d failed to configure TX queue %d\n",
1629+
vf->vf_id, i);
16411630
goto error_param;
16421631
}
16431632
}
@@ -1651,17 +1640,13 @@ static int ice_vc_cfg_qs_msg(struct ice_vf *vf, u8 *msg)
16511640

16521641
if (qpi->rxq.databuffer_size != 0 &&
16531642
(qpi->rxq.databuffer_size > ((16 * 1024) - 128) ||
1654-
qpi->rxq.databuffer_size < 1024)) {
1655-
v_ret = VIRTCHNL_STATUS_ERR_PARAM;
1643+
qpi->rxq.databuffer_size < 1024))
16561644
goto error_param;
1657-
}
16581645
vsi->rx_buf_len = qpi->rxq.databuffer_size;
16591646
vsi->rx_rings[i]->rx_buf_len = vsi->rx_buf_len;
16601647
if (qpi->rxq.max_pkt_size > max_frame_size ||
1661-
qpi->rxq.max_pkt_size < 64) {
1662-
v_ret = VIRTCHNL_STATUS_ERR_PARAM;
1648+
qpi->rxq.max_pkt_size < 64)
16631649
goto error_param;
1664-
}
16651650

16661651
vsi->max_frame = qpi->rxq.max_pkt_size;
16671652
/* add space for the port VLAN since the VF driver is
@@ -1672,16 +1657,30 @@ static int ice_vc_cfg_qs_msg(struct ice_vf *vf, u8 *msg)
16721657
vsi->max_frame += VLAN_HLEN;
16731658

16741659
if (ice_vsi_cfg_single_rxq(vsi, q_idx)) {
1675-
v_ret = VIRTCHNL_STATUS_ERR_PARAM;
1660+
dev_warn(ice_pf_to_dev(pf), "VF-%d failed to configure RX queue %d\n",
1661+
vf->vf_id, i);
16761662
goto error_param;
16771663
}
16781664
}
16791665
}
16801666

1667+
/* send the response to the VF */
1668+
return ice_vc_send_msg_to_vf(vf, VIRTCHNL_OP_CONFIG_VSI_QUEUES,
1669+
VIRTCHNL_STATUS_SUCCESS, NULL, 0);
16811670
error_param:
1671+
/* disable whatever we can */
1672+
for (; i >= 0; i--) {
1673+
if (ice_vsi_ctrl_one_rx_ring(vsi, false, i, true))
1674+
dev_err(ice_pf_to_dev(pf), "VF-%d could not disable RX queue %d\n",
1675+
vf->vf_id, i);
1676+
if (ice_vf_vsi_dis_single_txq(vf, vsi, i))
1677+
dev_err(ice_pf_to_dev(pf), "VF-%d could not disable TX queue %d\n",
1678+
vf->vf_id, i);
1679+
}
1680+
16821681
/* send the response to the VF */
1683-
return ice_vc_send_msg_to_vf(vf, VIRTCHNL_OP_CONFIG_VSI_QUEUES, v_ret,
1684-
NULL, 0);
1682+
return ice_vc_send_msg_to_vf(vf, VIRTCHNL_OP_CONFIG_VSI_QUEUES,
1683+
VIRTCHNL_STATUS_ERR_PARAM, NULL, 0);
16851684
}
16861685

16871686
/**

0 commit comments

Comments
 (0)