Skip to content

Commit f0739e6

Browse files
committed
Merge branch '100GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/next-queue
Jeff Kirsher says: ==================== 100GbE Intel Wired LAN Driver Updates 2018-11-13 This series contains updates to the ice driver only. Brett cleans up debug print messages by removing useless or duplicate messages, and make sure we assign the hardware head pointer to head instead of the software head pointer. Resolved an issue when disabling SRIOV we were trying to stop queues multiple times, so make sure we disable SRIOV before stopping transmit and receive queues for VF. Tony fixes a potential NULL pointer dereference during a VF reset. Anirudh resolves an issue where we were releasing the VSI before removing the VSI scheduler node, which was resulting in an error "Failed to set LAN Tx queue context, error: -1". Also fixed the guaranteed number of VSIs available and used by discovering the device capabilities to determine the 'guar_num_vsi' per function, rather than always using the theoretical max number of VSIs every time. Dave avoids a deadlock by nesting RTNL locking, so added a boolean to determine if the RTNL lock is already held. Lev fixes bad mask values which would break compilation. Piotr increases the receive queue disable timeout since it can take additional time to finish all pending queue requests. Usha resolves an issue of VLAN priority tagged traffic not appearing on all traffic classes, which was causing ETS bandwidth shaping to not work as expected. Henry fixes the reset path to cleanup the old scheduler tree before rebuilding it. Md Fahad removes a unnecessary check which was causing a driver load error on platforms with more than 128 cores. ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents bd5196b + ef878d6 commit f0739e6

File tree

10 files changed

+265
-89
lines changed

10 files changed

+265
-89
lines changed

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ extern const char ice_drv_ver[];
5252
#define ICE_MBXQ_LEN 64
5353
#define ICE_MIN_MSIX 2
5454
#define ICE_NO_VSI 0xffff
55-
#define ICE_MAX_VSI_ALLOC 130
5655
#define ICE_MAX_TXQS 2048
5756
#define ICE_MAX_RXQS 2048
5857
#define ICE_VSI_MAP_CONTIG 0
@@ -113,7 +112,9 @@ extern const char ice_drv_ver[];
113112

114113
struct ice_tc_info {
115114
u16 qoffset;
116-
u16 qcount;
115+
u16 qcount_tx;
116+
u16 qcount_rx;
117+
u8 netdev_tc;
117118
};
118119

119120
struct ice_tc_cfg {

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ struct ice_aqc_list_caps {
8787
/* Device/Function buffer entry, repeated per reported capability */
8888
struct ice_aqc_list_caps_elem {
8989
__le16 cap;
90+
#define ICE_AQC_CAPS_VALID_FUNCTIONS 0x0005
9091
#define ICE_AQC_CAPS_SRIOV 0x0012
9192
#define ICE_AQC_CAPS_VF 0x0013
9293
#define ICE_AQC_CAPS_VSI 0x0017
@@ -1065,10 +1066,10 @@ struct ice_aqc_nvm {
10651066
#define ICE_AQC_NVM_LAST_CMD BIT(0)
10661067
#define ICE_AQC_NVM_PCIR_REQ BIT(0) /* Used by NVM Update reply */
10671068
#define ICE_AQC_NVM_PRESERVATION_S 1
1068-
#define ICE_AQC_NVM_PRESERVATION_M (3 << CSR_AQ_NVM_PRESERVATION_S)
1069-
#define ICE_AQC_NVM_NO_PRESERVATION (0 << CSR_AQ_NVM_PRESERVATION_S)
1069+
#define ICE_AQC_NVM_PRESERVATION_M (3 << ICE_AQC_NVM_PRESERVATION_S)
1070+
#define ICE_AQC_NVM_NO_PRESERVATION (0 << ICE_AQC_NVM_PRESERVATION_S)
10701071
#define ICE_AQC_NVM_PRESERVE_ALL BIT(1)
1071-
#define ICE_AQC_NVM_PRESERVE_SELECTED (3 << CSR_AQ_NVM_PRESERVATION_S)
1072+
#define ICE_AQC_NVM_PRESERVE_SELECTED (3 << ICE_AQC_NVM_PRESERVATION_S)
10721073
#define ICE_AQC_NVM_FLASH_ONLY BIT(7)
10731074
__le16 module_typeid;
10741075
__le16 length;

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

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1386,6 +1386,27 @@ void ice_release_res(struct ice_hw *hw, enum ice_aq_res_ids res)
13861386
}
13871387
}
13881388

1389+
/**
1390+
* ice_get_guar_num_vsi - determine number of guar VSI for a PF
1391+
* @hw: pointer to the hw structure
1392+
*
1393+
* Determine the number of valid functions by going through the bitmap returned
1394+
* from parsing capabilities and use this to calculate the number of VSI per PF.
1395+
*/
1396+
static u32 ice_get_guar_num_vsi(struct ice_hw *hw)
1397+
{
1398+
u8 funcs;
1399+
1400+
#define ICE_CAPS_VALID_FUNCS_M 0xFF
1401+
funcs = hweight8(hw->dev_caps.common_cap.valid_functions &
1402+
ICE_CAPS_VALID_FUNCS_M);
1403+
1404+
if (!funcs)
1405+
return 0;
1406+
1407+
return ICE_MAX_VSI / funcs;
1408+
}
1409+
13891410
/**
13901411
* ice_parse_caps - parse function/device capabilities
13911412
* @hw: pointer to the hw struct
@@ -1428,6 +1449,12 @@ ice_parse_caps(struct ice_hw *hw, void *buf, u32 cap_count,
14281449
u16 cap = le16_to_cpu(cap_resp->cap);
14291450

14301451
switch (cap) {
1452+
case ICE_AQC_CAPS_VALID_FUNCTIONS:
1453+
caps->valid_functions = number;
1454+
ice_debug(hw, ICE_DBG_INIT,
1455+
"HW caps: Valid Functions = %d\n",
1456+
caps->valid_functions);
1457+
break;
14311458
case ICE_AQC_CAPS_SRIOV:
14321459
caps->sr_iov_1_1 = (number == 1);
14331460
ice_debug(hw, ICE_DBG_INIT,
@@ -1457,10 +1484,10 @@ ice_parse_caps(struct ice_hw *hw, void *buf, u32 cap_count,
14571484
"HW caps: Dev.VSI cnt = %d\n",
14581485
dev_p->num_vsi_allocd_to_host);
14591486
} else if (func_p) {
1460-
func_p->guaranteed_num_vsi = number;
1487+
func_p->guar_num_vsi = ice_get_guar_num_vsi(hw);
14611488
ice_debug(hw, ICE_DBG_INIT,
14621489
"HW caps: Func.VSI cnt = %d\n",
1463-
func_p->guaranteed_num_vsi);
1490+
number);
14641491
}
14651492
break;
14661493
case ICE_AQC_CAPS_RSS:

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
#define _ICE_HW_AUTOGEN_H_
88

99
#define QTX_COMM_DBELL(_DBQM) (0x002C0000 + ((_DBQM) * 4))
10+
#define QTX_COMM_HEAD(_DBQM) (0x000E0000 + ((_DBQM) * 4))
11+
#define QTX_COMM_HEAD_HEAD_S 0
12+
#define QTX_COMM_HEAD_HEAD_M ICE_M(0x1FFF, 0)
1013
#define PF_FW_ARQBAH 0x00080180
1114
#define PF_FW_ARQBAL 0x00080080
1215
#define PF_FW_ARQH 0x00080380

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

Lines changed: 80 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -174,15 +174,15 @@ static int ice_pf_rxq_wait(struct ice_pf *pf, int pf_q, bool ena)
174174
{
175175
int i;
176176

177-
for (i = 0; i < ICE_Q_WAIT_RETRY_LIMIT; i++) {
177+
for (i = 0; i < ICE_Q_WAIT_MAX_RETRY; i++) {
178178
u32 rx_reg = rd32(&pf->hw, QRX_CTRL(pf_q));
179179

180180
if (ena == !!(rx_reg & QRX_CTRL_QENA_STAT_M))
181181
break;
182182

183-
usleep_range(10, 20);
183+
usleep_range(20, 40);
184184
}
185-
if (i >= ICE_Q_WAIT_RETRY_LIMIT)
185+
if (i >= ICE_Q_WAIT_MAX_RETRY)
186186
return -ETIMEDOUT;
187187

188188
return 0;
@@ -774,11 +774,13 @@ static void ice_set_dflt_vsi_ctx(struct ice_vsi_ctx *ctxt)
774774
*/
775775
static void ice_vsi_setup_q_map(struct ice_vsi *vsi, struct ice_vsi_ctx *ctxt)
776776
{
777-
u16 offset = 0, qmap = 0, numq_tc;
778-
u16 pow = 0, max_rss = 0, qcount;
777+
u16 offset = 0, qmap = 0, tx_count = 0;
779778
u16 qcount_tx = vsi->alloc_txq;
780779
u16 qcount_rx = vsi->alloc_rxq;
780+
u16 tx_numq_tc, rx_numq_tc;
781+
u16 pow = 0, max_rss = 0;
781782
bool ena_tc0 = false;
783+
u8 netdev_tc = 0;
782784
int i;
783785

784786
/* at least TC0 should be enabled by default */
@@ -794,7 +796,12 @@ static void ice_vsi_setup_q_map(struct ice_vsi *vsi, struct ice_vsi_ctx *ctxt)
794796
vsi->tc_cfg.ena_tc |= 1;
795797
}
796798

797-
numq_tc = qcount_rx / vsi->tc_cfg.numtc;
799+
rx_numq_tc = qcount_rx / vsi->tc_cfg.numtc;
800+
if (!rx_numq_tc)
801+
rx_numq_tc = 1;
802+
tx_numq_tc = qcount_tx / vsi->tc_cfg.numtc;
803+
if (!tx_numq_tc)
804+
tx_numq_tc = 1;
798805

799806
/* TC mapping is a function of the number of Rx queues assigned to the
800807
* VSI for each traffic class and the offset of these queues.
@@ -808,45 +815,50 @@ static void ice_vsi_setup_q_map(struct ice_vsi *vsi, struct ice_vsi_ctx *ctxt)
808815
* Setup number and offset of Rx queues for all TCs for the VSI
809816
*/
810817

811-
qcount = numq_tc;
818+
qcount_rx = rx_numq_tc;
819+
812820
/* qcount will change if RSS is enabled */
813821
if (test_bit(ICE_FLAG_RSS_ENA, vsi->back->flags)) {
814822
if (vsi->type == ICE_VSI_PF || vsi->type == ICE_VSI_VF) {
815823
if (vsi->type == ICE_VSI_PF)
816824
max_rss = ICE_MAX_LG_RSS_QS;
817825
else
818826
max_rss = ICE_MAX_SMALL_RSS_QS;
819-
qcount = min_t(int, numq_tc, max_rss);
820-
qcount = min_t(int, qcount, vsi->rss_size);
827+
qcount_rx = min_t(int, rx_numq_tc, max_rss);
828+
qcount_rx = min_t(int, qcount_rx, vsi->rss_size);
821829
}
822830
}
823831

824832
/* find the (rounded up) power-of-2 of qcount */
825-
pow = order_base_2(qcount);
833+
pow = order_base_2(qcount_rx);
826834

827835
for (i = 0; i < ICE_MAX_TRAFFIC_CLASS; i++) {
828836
if (!(vsi->tc_cfg.ena_tc & BIT(i))) {
829837
/* TC is not enabled */
830838
vsi->tc_cfg.tc_info[i].qoffset = 0;
831-
vsi->tc_cfg.tc_info[i].qcount = 1;
839+
vsi->tc_cfg.tc_info[i].qcount_rx = 1;
840+
vsi->tc_cfg.tc_info[i].qcount_tx = 1;
841+
vsi->tc_cfg.tc_info[i].netdev_tc = 0;
832842
ctxt->info.tc_mapping[i] = 0;
833843
continue;
834844
}
835845

836846
/* TC is enabled */
837847
vsi->tc_cfg.tc_info[i].qoffset = offset;
838-
vsi->tc_cfg.tc_info[i].qcount = qcount;
848+
vsi->tc_cfg.tc_info[i].qcount_rx = qcount_rx;
849+
vsi->tc_cfg.tc_info[i].qcount_tx = tx_numq_tc;
850+
vsi->tc_cfg.tc_info[i].netdev_tc = netdev_tc++;
839851

840852
qmap = ((offset << ICE_AQ_VSI_TC_Q_OFFSET_S) &
841853
ICE_AQ_VSI_TC_Q_OFFSET_M) |
842854
((pow << ICE_AQ_VSI_TC_Q_NUM_S) &
843855
ICE_AQ_VSI_TC_Q_NUM_M);
844-
offset += qcount;
856+
offset += qcount_rx;
857+
tx_count += tx_numq_tc;
845858
ctxt->info.tc_mapping[i] = cpu_to_le16(qmap);
846859
}
847-
848-
vsi->num_txq = qcount_tx;
849860
vsi->num_rxq = offset;
861+
vsi->num_txq = tx_count;
850862

851863
if (vsi->type == ICE_VSI_VF && vsi->num_txq != vsi->num_rxq) {
852864
dev_dbg(&vsi->back->pdev->dev, "VF VSI should have same number of Tx and Rx queues. Hence making them equal\n");
@@ -1611,55 +1623,62 @@ int ice_vsi_cfg_txqs(struct ice_vsi *vsi)
16111623
struct ice_aqc_add_tx_qgrp *qg_buf;
16121624
struct ice_aqc_add_txqs_perq *txq;
16131625
struct ice_pf *pf = vsi->back;
1626+
u8 num_q_grps, q_idx = 0;
16141627
enum ice_status status;
16151628
u16 buf_len, i, pf_q;
16161629
int err = 0, tc = 0;
1617-
u8 num_q_grps;
16181630

16191631
buf_len = sizeof(struct ice_aqc_add_tx_qgrp);
16201632
qg_buf = devm_kzalloc(&pf->pdev->dev, buf_len, GFP_KERNEL);
16211633
if (!qg_buf)
16221634
return -ENOMEM;
16231635

1624-
if (vsi->num_txq > ICE_MAX_TXQ_PER_TXQG) {
1625-
err = -EINVAL;
1626-
goto err_cfg_txqs;
1627-
}
16281636
qg_buf->num_txqs = 1;
16291637
num_q_grps = 1;
16301638

1631-
/* set up and configure the Tx queues */
1632-
ice_for_each_txq(vsi, i) {
1633-
struct ice_tlan_ctx tlan_ctx = { 0 };
1639+
/* set up and configure the Tx queues for each enabled TC */
1640+
for (tc = 0; tc < ICE_MAX_TRAFFIC_CLASS; tc++) {
1641+
if (!(vsi->tc_cfg.ena_tc & BIT(tc)))
1642+
break;
16341643

1635-
pf_q = vsi->txq_map[i];
1636-
ice_setup_tx_ctx(vsi->tx_rings[i], &tlan_ctx, pf_q);
1637-
/* copy context contents into the qg_buf */
1638-
qg_buf->txqs[0].txq_id = cpu_to_le16(pf_q);
1639-
ice_set_ctx((u8 *)&tlan_ctx, qg_buf->txqs[0].txq_ctx,
1640-
ice_tlan_ctx_info);
1644+
for (i = 0; i < vsi->tc_cfg.tc_info[tc].qcount_tx; i++) {
1645+
struct ice_tlan_ctx tlan_ctx = { 0 };
1646+
1647+
pf_q = vsi->txq_map[q_idx];
1648+
ice_setup_tx_ctx(vsi->tx_rings[q_idx], &tlan_ctx,
1649+
pf_q);
1650+
/* copy context contents into the qg_buf */
1651+
qg_buf->txqs[0].txq_id = cpu_to_le16(pf_q);
1652+
ice_set_ctx((u8 *)&tlan_ctx, qg_buf->txqs[0].txq_ctx,
1653+
ice_tlan_ctx_info);
1654+
1655+
/* init queue specific tail reg. It is referred as
1656+
* transmit comm scheduler queue doorbell.
1657+
*/
1658+
vsi->tx_rings[q_idx]->tail =
1659+
pf->hw.hw_addr + QTX_COMM_DBELL(pf_q);
1660+
status = ice_ena_vsi_txq(vsi->port_info, vsi->idx, tc,
1661+
num_q_grps, qg_buf, buf_len,
1662+
NULL);
1663+
if (status) {
1664+
dev_err(&vsi->back->pdev->dev,
1665+
"Failed to set LAN Tx queue context, error: %d\n",
1666+
status);
1667+
err = -ENODEV;
1668+
goto err_cfg_txqs;
1669+
}
16411670

1642-
/* init queue specific tail reg. It is referred as transmit
1643-
* comm scheduler queue doorbell.
1644-
*/
1645-
vsi->tx_rings[i]->tail = pf->hw.hw_addr + QTX_COMM_DBELL(pf_q);
1646-
status = ice_ena_vsi_txq(vsi->port_info, vsi->idx, tc,
1647-
num_q_grps, qg_buf, buf_len, NULL);
1648-
if (status) {
1649-
dev_err(&vsi->back->pdev->dev,
1650-
"Failed to set LAN Tx queue context, error: %d\n",
1651-
status);
1652-
err = -ENODEV;
1653-
goto err_cfg_txqs;
1654-
}
1671+
/* Add Tx Queue TEID into the VSI Tx ring from the
1672+
* response. This will complete configuring and
1673+
* enabling the queue.
1674+
*/
1675+
txq = &qg_buf->txqs[0];
1676+
if (pf_q == le16_to_cpu(txq->txq_id))
1677+
vsi->tx_rings[q_idx]->txq_teid =
1678+
le32_to_cpu(txq->q_teid);
16551679

1656-
/* Add Tx Queue TEID into the VSI Tx ring from the response
1657-
* This will complete configuring and enabling the queue.
1658-
*/
1659-
txq = &qg_buf->txqs[0];
1660-
if (pf_q == le16_to_cpu(txq->txq_id))
1661-
vsi->tx_rings[i]->txq_teid =
1662-
le32_to_cpu(txq->q_teid);
1680+
q_idx++;
1681+
}
16631682
}
16641683
err_cfg_txqs:
16651684
devm_kfree(&pf->pdev->dev, qg_buf);
@@ -1908,7 +1927,8 @@ int ice_vsi_stop_tx_rings(struct ice_vsi *vsi, enum ice_disq_rst_src rst_src,
19081927
ice_for_each_txq(vsi, i) {
19091928
u16 v_idx;
19101929

1911-
if (!vsi->tx_rings || !vsi->tx_rings[i]) {
1930+
if (!vsi->tx_rings || !vsi->tx_rings[i] ||
1931+
!vsi->tx_rings[i]->q_vector) {
19121932
err = -EINVAL;
19131933
goto err_out;
19141934
}
@@ -2056,6 +2076,9 @@ ice_vsi_setup(struct ice_pf *pf, struct ice_port_info *pi,
20562076
/* set RSS capabilities */
20572077
ice_vsi_set_rss_params(vsi);
20582078

2079+
/* set tc configuration */
2080+
ice_vsi_set_tc_cfg(vsi);
2081+
20592082
/* create the VSI */
20602083
ret = ice_vsi_init(vsi);
20612084
if (ret)
@@ -2119,11 +2142,9 @@ ice_vsi_setup(struct ice_pf *pf, struct ice_port_info *pi,
21192142
goto unroll_vsi_init;
21202143
}
21212144

2122-
ice_vsi_set_tc_cfg(vsi);
2123-
21242145
/* configure VSI nodes based on number of queues and TC's */
21252146
for (i = 0; i < vsi->tc_cfg.numtc; i++)
2126-
max_txqs[i] = vsi->num_txq;
2147+
max_txqs[i] = pf->num_lan_tx;
21272148

21282149
ret = ice_cfg_vsi_lan(vsi->port_info, vsi->idx, vsi->tc_cfg.ena_tc,
21292150
max_txqs);
@@ -2491,6 +2512,7 @@ int ice_vsi_release(struct ice_vsi *vsi)
24912512
}
24922513

24932514
ice_remove_vsi_fltr(&pf->hw, vsi->idx);
2515+
ice_rm_vsi_lan_cfg(vsi->port_info, vsi->idx);
24942516
ice_vsi_delete(vsi);
24952517
ice_vsi_free_q_vectors(vsi);
24962518
ice_vsi_clear_rings(vsi);
@@ -2518,11 +2540,14 @@ int ice_vsi_release(struct ice_vsi *vsi)
25182540
int ice_vsi_rebuild(struct ice_vsi *vsi)
25192541
{
25202542
u16 max_txqs[ICE_MAX_TRAFFIC_CLASS] = { 0 };
2543+
struct ice_pf *pf;
25212544
int ret, i;
25222545

25232546
if (!vsi)
25242547
return -EINVAL;
25252548

2549+
pf = vsi->back;
2550+
ice_rm_vsi_lan_cfg(vsi->port_info, vsi->idx);
25262551
ice_vsi_free_q_vectors(vsi);
25272552
ice_free_res(vsi->back->sw_irq_tracker, vsi->sw_base_vector, vsi->idx);
25282553
ice_free_res(vsi->back->hw_irq_tracker, vsi->hw_base_vector, vsi->idx);
@@ -2532,6 +2557,7 @@ int ice_vsi_rebuild(struct ice_vsi *vsi)
25322557
ice_vsi_free_arrays(vsi, false);
25332558
ice_dev_onetime_setup(&vsi->back->hw);
25342559
ice_vsi_set_num_qs(vsi);
2560+
ice_vsi_set_tc_cfg(vsi);
25352561

25362562
/* Initialize VSI struct elements and create VSI in FW */
25372563
ret = ice_vsi_init(vsi);
@@ -2578,11 +2604,9 @@ int ice_vsi_rebuild(struct ice_vsi *vsi)
25782604
break;
25792605
}
25802606

2581-
ice_vsi_set_tc_cfg(vsi);
2582-
25832607
/* configure VSI nodes based on number of queues and TC's */
25842608
for (i = 0; i < vsi->tc_cfg.numtc; i++)
2585-
max_txqs[i] = vsi->num_txq;
2609+
max_txqs[i] = pf->num_lan_tx;
25862610

25872611
ret = ice_cfg_vsi_lan(vsi->port_info, vsi->idx, vsi->tc_cfg.ena_tc,
25882612
max_txqs);

0 commit comments

Comments
 (0)