Skip to content

Commit 448ad88

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-21 This series contains updates to ice driver only. Marcin fixes GTP filters by allowing ignoring of the inner ethertype field. Wojciech adds VSI handle tracking in order to properly distinguish similar filters for removal. Anatolii removes ability to set 1000baseT and 1000baseX fields concurrently which caused link issues. He also disallows setting channels to less than the number of Traffic Classes which would cause NULL pointer dereference. * '100GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/net-queue: ice: ethtool: Prohibit improper channel config for DCB ice: ethtool: advertise 1000M speeds properly ice: Fix switchdev rules book keeping ice: ignore protocol field in GTP offload ==================== Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
2 parents 4e0effd + a632b2a commit 448ad88

File tree

3 files changed

+89
-7
lines changed

3 files changed

+89
-7
lines changed

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

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2189,6 +2189,42 @@ ice_setup_autoneg(struct ice_port_info *p, struct ethtool_link_ksettings *ks,
21892189
return err;
21902190
}
21912191

2192+
/**
2193+
* ice_set_phy_type_from_speed - set phy_types based on speeds
2194+
* and advertised modes
2195+
* @ks: ethtool link ksettings struct
2196+
* @phy_type_low: pointer to the lower part of phy_type
2197+
* @phy_type_high: pointer to the higher part of phy_type
2198+
* @adv_link_speed: targeted link speeds bitmap
2199+
*/
2200+
static void
2201+
ice_set_phy_type_from_speed(const struct ethtool_link_ksettings *ks,
2202+
u64 *phy_type_low, u64 *phy_type_high,
2203+
u16 adv_link_speed)
2204+
{
2205+
/* Handle 1000M speed in a special way because ice_update_phy_type
2206+
* enables all link modes, but having mixed copper and optical
2207+
* standards is not supported.
2208+
*/
2209+
adv_link_speed &= ~ICE_AQ_LINK_SPEED_1000MB;
2210+
2211+
if (ethtool_link_ksettings_test_link_mode(ks, advertising,
2212+
1000baseT_Full))
2213+
*phy_type_low |= ICE_PHY_TYPE_LOW_1000BASE_T |
2214+
ICE_PHY_TYPE_LOW_1G_SGMII;
2215+
2216+
if (ethtool_link_ksettings_test_link_mode(ks, advertising,
2217+
1000baseKX_Full))
2218+
*phy_type_low |= ICE_PHY_TYPE_LOW_1000BASE_KX;
2219+
2220+
if (ethtool_link_ksettings_test_link_mode(ks, advertising,
2221+
1000baseX_Full))
2222+
*phy_type_low |= ICE_PHY_TYPE_LOW_1000BASE_SX |
2223+
ICE_PHY_TYPE_LOW_1000BASE_LX;
2224+
2225+
ice_update_phy_type(phy_type_low, phy_type_high, adv_link_speed);
2226+
}
2227+
21922228
/**
21932229
* ice_set_link_ksettings - Set Speed and Duplex
21942230
* @netdev: network interface device structure
@@ -2320,7 +2356,8 @@ ice_set_link_ksettings(struct net_device *netdev,
23202356
adv_link_speed = curr_link_speed;
23212357

23222358
/* Convert the advertise link speeds to their corresponded PHY_TYPE */
2323-
ice_update_phy_type(&phy_type_low, &phy_type_high, adv_link_speed);
2359+
ice_set_phy_type_from_speed(ks, &phy_type_low, &phy_type_high,
2360+
adv_link_speed);
23242361

23252362
if (!autoneg_changed && adv_link_speed == curr_link_speed) {
23262363
netdev_info(netdev, "Nothing changed, exiting without setting anything.\n");
@@ -3470,6 +3507,16 @@ static int ice_set_channels(struct net_device *dev, struct ethtool_channels *ch)
34703507
new_rx = ch->combined_count + ch->rx_count;
34713508
new_tx = ch->combined_count + ch->tx_count;
34723509

3510+
if (new_rx < vsi->tc_cfg.numtc) {
3511+
netdev_err(dev, "Cannot set less Rx channels, than Traffic Classes you have (%u)\n",
3512+
vsi->tc_cfg.numtc);
3513+
return -EINVAL;
3514+
}
3515+
if (new_tx < vsi->tc_cfg.numtc) {
3516+
netdev_err(dev, "Cannot set less Tx channels, than Traffic Classes you have (%u)\n",
3517+
vsi->tc_cfg.numtc);
3518+
return -EINVAL;
3519+
}
34733520
if (new_rx > ice_get_max_rxq(pf)) {
34743521
netdev_err(dev, "Maximum allowed Rx channels is %d\n",
34753522
ice_get_max_rxq(pf));

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

Lines changed: 37 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -909,7 +909,7 @@ static void ice_set_dflt_vsi_ctx(struct ice_hw *hw, struct ice_vsi_ctx *ctxt)
909909
* @vsi: the VSI being configured
910910
* @ctxt: VSI context structure
911911
*/
912-
static void ice_vsi_setup_q_map(struct ice_vsi *vsi, struct ice_vsi_ctx *ctxt)
912+
static int ice_vsi_setup_q_map(struct ice_vsi *vsi, struct ice_vsi_ctx *ctxt)
913913
{
914914
u16 offset = 0, qmap = 0, tx_count = 0, pow = 0;
915915
u16 num_txq_per_tc, num_rxq_per_tc;
@@ -982,7 +982,18 @@ static void ice_vsi_setup_q_map(struct ice_vsi *vsi, struct ice_vsi_ctx *ctxt)
982982
else
983983
vsi->num_rxq = num_rxq_per_tc;
984984

985+
if (vsi->num_rxq > vsi->alloc_rxq) {
986+
dev_err(ice_pf_to_dev(vsi->back), "Trying to use more Rx queues (%u), than were allocated (%u)!\n",
987+
vsi->num_rxq, vsi->alloc_rxq);
988+
return -EINVAL;
989+
}
990+
985991
vsi->num_txq = tx_count;
992+
if (vsi->num_txq > vsi->alloc_txq) {
993+
dev_err(ice_pf_to_dev(vsi->back), "Trying to use more Tx queues (%u), than were allocated (%u)!\n",
994+
vsi->num_txq, vsi->alloc_txq);
995+
return -EINVAL;
996+
}
986997

987998
if (vsi->type == ICE_VSI_VF && vsi->num_txq != vsi->num_rxq) {
988999
dev_dbg(ice_pf_to_dev(vsi->back), "VF VSI should have same number of Tx and Rx queues. Hence making them equal\n");
@@ -1000,6 +1011,8 @@ static void ice_vsi_setup_q_map(struct ice_vsi *vsi, struct ice_vsi_ctx *ctxt)
10001011
*/
10011012
ctxt->info.q_mapping[0] = cpu_to_le16(vsi->rxq_map[0]);
10021013
ctxt->info.q_mapping[1] = cpu_to_le16(vsi->num_rxq);
1014+
1015+
return 0;
10031016
}
10041017

10051018
/**
@@ -1187,7 +1200,10 @@ static int ice_vsi_init(struct ice_vsi *vsi, bool init_vsi)
11871200
if (vsi->type == ICE_VSI_CHNL) {
11881201
ice_chnl_vsi_setup_q_map(vsi, ctxt);
11891202
} else {
1190-
ice_vsi_setup_q_map(vsi, ctxt);
1203+
ret = ice_vsi_setup_q_map(vsi, ctxt);
1204+
if (ret)
1205+
goto out;
1206+
11911207
if (!init_vsi) /* means VSI being updated */
11921208
/* must to indicate which section of VSI context are
11931209
* being modified
@@ -3464,7 +3480,7 @@ void ice_vsi_cfg_netdev_tc(struct ice_vsi *vsi, u8 ena_tc)
34643480
*
34653481
* Prepares VSI tc_config to have queue configurations based on MQPRIO options.
34663482
*/
3467-
static void
3483+
static int
34683484
ice_vsi_setup_q_map_mqprio(struct ice_vsi *vsi, struct ice_vsi_ctx *ctxt,
34693485
u8 ena_tc)
34703486
{
@@ -3513,7 +3529,18 @@ ice_vsi_setup_q_map_mqprio(struct ice_vsi *vsi, struct ice_vsi_ctx *ctxt,
35133529

35143530
/* Set actual Tx/Rx queue pairs */
35153531
vsi->num_txq = offset + qcount_tx;
3532+
if (vsi->num_txq > vsi->alloc_txq) {
3533+
dev_err(ice_pf_to_dev(vsi->back), "Trying to use more Tx queues (%u), than were allocated (%u)!\n",
3534+
vsi->num_txq, vsi->alloc_txq);
3535+
return -EINVAL;
3536+
}
3537+
35163538
vsi->num_rxq = offset + qcount_rx;
3539+
if (vsi->num_rxq > vsi->alloc_rxq) {
3540+
dev_err(ice_pf_to_dev(vsi->back), "Trying to use more Rx queues (%u), than were allocated (%u)!\n",
3541+
vsi->num_rxq, vsi->alloc_rxq);
3542+
return -EINVAL;
3543+
}
35173544

35183545
/* Setup queue TC[0].qmap for given VSI context */
35193546
ctxt->info.tc_mapping[0] = cpu_to_le16(qmap);
@@ -3531,6 +3558,8 @@ ice_vsi_setup_q_map_mqprio(struct ice_vsi *vsi, struct ice_vsi_ctx *ctxt,
35313558
dev_dbg(ice_pf_to_dev(vsi->back), "vsi->num_rxq = %d\n", vsi->num_rxq);
35323559
dev_dbg(ice_pf_to_dev(vsi->back), "all_numtc %u, all_enatc: 0x%04x, tc_cfg.numtc %u\n",
35333560
vsi->all_numtc, vsi->all_enatc, vsi->tc_cfg.numtc);
3561+
3562+
return 0;
35343563
}
35353564

35363565
/**
@@ -3580,9 +3609,12 @@ int ice_vsi_cfg_tc(struct ice_vsi *vsi, u8 ena_tc)
35803609

35813610
if (vsi->type == ICE_VSI_PF &&
35823611
test_bit(ICE_FLAG_TC_MQPRIO, pf->flags))
3583-
ice_vsi_setup_q_map_mqprio(vsi, ctx, ena_tc);
3612+
ret = ice_vsi_setup_q_map_mqprio(vsi, ctx, ena_tc);
35843613
else
3585-
ice_vsi_setup_q_map(vsi, ctx);
3614+
ret = ice_vsi_setup_q_map(vsi, ctx);
3615+
3616+
if (ret)
3617+
goto out;
35863618

35873619
/* must to indicate which section of VSI context are being modified */
35883620
ctx->info.valid_sections = cpu_to_le16(ICE_AQ_VSI_PROP_RXQ_MAP_VALID);

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -524,6 +524,7 @@ ice_eswitch_add_tc_fltr(struct ice_vsi *vsi, struct ice_tc_flower_fltr *fltr)
524524
*/
525525
fltr->rid = rule_added.rid;
526526
fltr->rule_id = rule_added.rule_id;
527+
fltr->dest_id = rule_added.vsi_handle;
527528

528529
exit:
529530
kfree(list);
@@ -993,7 +994,9 @@ ice_parse_cls_flower(struct net_device *filter_dev, struct ice_vsi *vsi,
993994
n_proto_key = ntohs(match.key->n_proto);
994995
n_proto_mask = ntohs(match.mask->n_proto);
995996

996-
if (n_proto_key == ETH_P_ALL || n_proto_key == 0) {
997+
if (n_proto_key == ETH_P_ALL || n_proto_key == 0 ||
998+
fltr->tunnel_type == TNL_GTPU ||
999+
fltr->tunnel_type == TNL_GTPC) {
9971000
n_proto_key = 0;
9981001
n_proto_mask = 0;
9991002
} else {

0 commit comments

Comments
 (0)