Skip to content

Commit c4f2cbd

Browse files
author
Jakub Kicinski
committed
Merge branch '100GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/next-queue
Jeff Kirsher says: ==================== This series contains updates to the ice driver only. Bruce updates the driver to store the number of functions the device has so that it won't have to compute it when setting safe mode capabilities. Adds a check to adjust the reporting of capabilities for devices with more than 4 ports, which differ for devices with less than 4 ports. Brett adds a helper function to determine if the VF is allowed to do VLAN operations based on the host's VF configuration. Also adds a new function that initializes VLAN stripping (enabled/disabled) for the VF based on the device supported capabilities. Adds a check if the vector index is valid with the respect to the number of transmit and receive queues configured when we set coalesce settings for DCB. Adds a check if the promisc_mask contains ICE_PROMISC_VLAN_RX or ICE_PROMISC_VLAN_TX so that VLAN 0 promiscuous rules to be removed. Add a helper macro for a commonly used de-reference of a pointer to &pf->dev->pdev. Jesse fixes an issue where if an invalid virtchnl request from the VF, the driver would return uninitialized data to the VF from the PF stack, so ensure the stack variable is initialized earlier. Add helpers to the virtchnl interface make the reporting of strings consistent and help reduce stack space. Implements VF statistics gathering via the kernel ndo_get_vf_stats(). Akeem ensures we disable the state flag for each VF when its resources are returned to the device. Tony does additional cleanup in the driver to ensure the when we allocate and free memory within the same function, we should not be using devm_* variants; use regular alloc and free functions. Henry implements code to query and set the number of channels on the primary VSI for a PF via ethtool. Jake cleans up needless NULL checks in ice_sched_cleanup_all(). Kevin updates the firmware API version to align with current NVM images. v2: Added "Fixes:" tag to patch 5 commit description and added the use of netif_is_rxfh_configured() in patch 13 to see if RSS has been configured by the user, if so do not overwrite that configuration. ==================== Signed-off-by: Jakub Kicinski <[email protected]>
2 parents 30429fb + ed960c1 commit c4f2cbd

17 files changed

+1022
-539
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,8 @@ extern const char ice_drv_ver[];
130130
ICE_PROMISC_VLAN_TX | \
131131
ICE_PROMISC_VLAN_RX)
132132

133+
#define ice_pf_to_dev(pf) (&((pf)->pdev->dev))
134+
133135
struct ice_txq_meta {
134136
u32 q_teid; /* Tx-scheduler element identifier */
135137
u16 q_id; /* Entry in VSI's txq_map bitmap */
@@ -283,6 +285,8 @@ struct ice_vsi {
283285
u16 num_txq; /* Used Tx queues */
284286
u16 alloc_rxq; /* Allocated Rx queues */
285287
u16 num_rxq; /* Used Rx queues */
288+
u16 req_txq; /* User requested Tx queues */
289+
u16 req_rxq; /* User requested Rx queues */
286290
u16 num_rx_desc;
287291
u16 num_tx_desc;
288292
struct ice_tc_cfg tc_cfg;
@@ -489,6 +493,7 @@ void ice_set_ethtool_ops(struct net_device *netdev);
489493
void ice_set_ethtool_safe_mode_ops(struct net_device *netdev);
490494
u16 ice_get_avail_txq_count(struct ice_pf *pf);
491495
u16 ice_get_avail_rxq_count(struct ice_pf *pf);
496+
int ice_vsi_recfg_qs(struct ice_vsi *vsi, int new_rx, int new_tx);
492497
void ice_update_vsi_stats(struct ice_vsi *vsi);
493498
void ice_update_pf_stats(struct ice_pf *pf);
494499
int ice_up(struct ice_vsi *vsi);
@@ -503,6 +508,7 @@ ice_xdp_xmit(struct net_device *dev, int n, struct xdp_frame **frames,
503508
int ice_set_rss(struct ice_vsi *vsi, u8 *seed, u8 *lut, u16 lut_size);
504509
int ice_get_rss(struct ice_vsi *vsi, u8 *seed, u8 *lut, u16 lut_size);
505510
void ice_fill_rss_lut(u8 *lut, u16 rss_table_size, u16 rss_size);
511+
int ice_schedule_reset(struct ice_pf *pf, enum ice_reset_req reset);
506512
void ice_print_link_msg(struct ice_vsi *vsi, bool isup);
507513
int ice_open(struct net_device *netdev);
508514
int ice_stop(struct net_device *netdev);

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

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,8 @@ static int ice_vsi_alloc_q_vector(struct ice_vsi *vsi, int v_idx)
101101
struct ice_q_vector *q_vector;
102102

103103
/* allocate q_vector */
104-
q_vector = devm_kzalloc(&pf->pdev->dev, sizeof(*q_vector), GFP_KERNEL);
104+
q_vector = devm_kzalloc(ice_pf_to_dev(pf), sizeof(*q_vector),
105+
GFP_KERNEL);
105106
if (!q_vector)
106107
return -ENOMEM;
107108

@@ -138,10 +139,11 @@ static void ice_free_q_vector(struct ice_vsi *vsi, int v_idx)
138139
struct ice_q_vector *q_vector;
139140
struct ice_pf *pf = vsi->back;
140141
struct ice_ring *ring;
142+
struct device *dev;
141143

144+
dev = ice_pf_to_dev(pf);
142145
if (!vsi->q_vectors[v_idx]) {
143-
dev_dbg(&pf->pdev->dev, "Queue vector at index %d not found\n",
144-
v_idx);
146+
dev_dbg(dev, "Queue vector at index %d not found\n", v_idx);
145147
return;
146148
}
147149
q_vector = vsi->q_vectors[v_idx];
@@ -155,7 +157,7 @@ static void ice_free_q_vector(struct ice_vsi *vsi, int v_idx)
155157
if (vsi->netdev)
156158
netif_napi_del(&q_vector->napi);
157159

158-
devm_kfree(&pf->pdev->dev, q_vector);
160+
devm_kfree(dev, q_vector);
159161
vsi->q_vectors[v_idx] = NULL;
160162
}
161163

@@ -482,7 +484,7 @@ int ice_vsi_ctrl_rx_ring(struct ice_vsi *vsi, bool ena, u16 rxq_idx)
482484
/* wait for the change to finish */
483485
ret = ice_pf_rxq_wait(pf, pf_q, ena);
484486
if (ret)
485-
dev_err(&pf->pdev->dev,
487+
dev_err(ice_pf_to_dev(pf),
486488
"VSI idx %d Rx ring %d %sable timeout\n",
487489
vsi->idx, pf_q, (ena ? "en" : "dis"));
488490

@@ -500,11 +502,12 @@ int ice_vsi_alloc_q_vectors(struct ice_vsi *vsi)
500502
{
501503
struct ice_pf *pf = vsi->back;
502504
int v_idx = 0, num_q_vectors;
505+
struct device *dev;
503506
int err;
504507

508+
dev = ice_pf_to_dev(pf);
505509
if (vsi->q_vectors[0]) {
506-
dev_dbg(&pf->pdev->dev, "VSI %d has existing q_vectors\n",
507-
vsi->vsi_num);
510+
dev_dbg(dev, "VSI %d has existing q_vectors\n", vsi->vsi_num);
508511
return -EEXIST;
509512
}
510513

@@ -522,8 +525,7 @@ int ice_vsi_alloc_q_vectors(struct ice_vsi *vsi)
522525
while (v_idx--)
523526
ice_free_q_vector(vsi, v_idx);
524527

525-
dev_err(&pf->pdev->dev,
526-
"Failed to allocate %d q_vector for VSI %d, ret=%d\n",
528+
dev_err(dev, "Failed to allocate %d q_vector for VSI %d, ret=%d\n",
527529
vsi->num_q_vectors, vsi->vsi_num, err);
528530
vsi->num_q_vectors = 0;
529531
return err;
@@ -640,7 +642,7 @@ ice_vsi_cfg_txq(struct ice_vsi *vsi, struct ice_ring *ring,
640642
status = ice_ena_vsi_txq(vsi->port_info, vsi->idx, tc, ring->q_handle,
641643
1, qg_buf, buf_len, NULL);
642644
if (status) {
643-
dev_err(&pf->pdev->dev,
645+
dev_err(ice_pf_to_dev(pf),
644646
"Failed to set LAN Tx queue context, error: %d\n",
645647
status);
646648
return -ENODEV;

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

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1673,6 +1673,10 @@ ice_parse_caps(struct ice_hw *hw, void *buf, u32 cap_count,
16731673
ice_debug(hw, ICE_DBG_INIT,
16741674
"%s: valid_functions (bitmap) = %d\n", prefix,
16751675
caps->valid_functions);
1676+
1677+
/* store func count for resource management purposes */
1678+
if (dev_p)
1679+
dev_p->num_funcs = hweight32(number);
16761680
break;
16771681
case ICE_AQC_CAPS_SRIOV:
16781682
caps->sr_iov_1_1 = (number == 1);
@@ -1779,6 +1783,18 @@ ice_parse_caps(struct ice_hw *hw, void *buf, u32 cap_count,
17791783
break;
17801784
}
17811785
}
1786+
1787+
/* Re-calculate capabilities that are dependent on the number of
1788+
* physical ports; i.e. some features are not supported or function
1789+
* differently on devices with more than 4 ports.
1790+
*/
1791+
if (hw->dev_caps.num_funcs > 4) {
1792+
/* Max 4 TCs per port */
1793+
caps->maxtc = 4;
1794+
ice_debug(hw, ICE_DBG_INIT,
1795+
"%s: maxtc = %d (based on #ports)\n", prefix,
1796+
caps->maxtc);
1797+
}
17821798
}
17831799

17841800
/**
@@ -1875,8 +1891,7 @@ void ice_set_safe_mode_caps(struct ice_hw *hw)
18751891
struct ice_hw_dev_caps *dev_caps = &hw->dev_caps;
18761892
u32 valid_func, rxq_first_id, txq_first_id;
18771893
u32 msix_vector_first_id, max_mtu;
1878-
u32 num_func = 0;
1879-
u8 i;
1894+
u32 num_funcs;
18801895

18811896
/* cache some func_caps values that should be restored after memset */
18821897
valid_func = func_caps->common_cap.valid_functions;
@@ -1909,6 +1924,7 @@ void ice_set_safe_mode_caps(struct ice_hw *hw)
19091924
rxq_first_id = dev_caps->common_cap.rxq_first_id;
19101925
msix_vector_first_id = dev_caps->common_cap.msix_vector_first_id;
19111926
max_mtu = dev_caps->common_cap.max_mtu;
1927+
num_funcs = dev_caps->num_funcs;
19121928

19131929
/* unset dev capabilities */
19141930
memset(dev_caps, 0, sizeof(*dev_caps));
@@ -1919,19 +1935,14 @@ void ice_set_safe_mode_caps(struct ice_hw *hw)
19191935
dev_caps->common_cap.rxq_first_id = rxq_first_id;
19201936
dev_caps->common_cap.msix_vector_first_id = msix_vector_first_id;
19211937
dev_caps->common_cap.max_mtu = max_mtu;
1922-
1923-
/* valid_func is a bitmap. get number of functions */
1924-
#define ICE_MAX_FUNCS 8
1925-
for (i = 0; i < ICE_MAX_FUNCS; i++)
1926-
if (valid_func & BIT(i))
1927-
num_func++;
1938+
dev_caps->num_funcs = num_funcs;
19281939

19291940
/* one Tx and one Rx queue per function in safe mode */
1930-
dev_caps->common_cap.num_rxq = num_func;
1931-
dev_caps->common_cap.num_txq = num_func;
1941+
dev_caps->common_cap.num_rxq = num_funcs;
1942+
dev_caps->common_cap.num_txq = num_funcs;
19321943

19331944
/* two MSIX vectors per function */
1934-
dev_caps->common_cap.num_msix_vectors = 2 * num_func;
1945+
dev_caps->common_cap.num_msix_vectors = 2 * num_funcs;
19351946
}
19361947

19371948
/**

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
*/
2323
#define EXP_FW_API_VER_BRANCH 0x00
2424
#define EXP_FW_API_VER_MAJOR 0x01
25-
#define EXP_FW_API_VER_MINOR 0x03
25+
#define EXP_FW_API_VER_MINOR 0x05
2626

2727
/* Different control queue types: These are mainly for SW consumption. */
2828
enum ice_ctl_q {

0 commit comments

Comments
 (0)