Skip to content

Commit b5b6b6b

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 2021-12-08 Yahui adds re-initialization of Flow Director for VF reset. Paul restores interrupts when enabling VFs. Dave re-adds bandwidth check for DCBNL and moves DSCP mode check earlier in the function. Jesse prevents reporting of dropped packets that occur during initialization and fixes reporting of statistics which could occur with frequent reads. Michal corrects setting of protocol type for UDP header and fixes lack of differentiation when adding filters for tunnels. * '100GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/net-queue: ice: safer stats processing ice: fix adding different tunnels ice: fix choosing UDP header type ice: ignore dropped packets during init ice: Fix problems with DSCP QoS implementation ice: rearm other interrupt cause register after enabling VFs ice: fix FDIR init missing when reset VF ==================== Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
2 parents 6efcdad + 1a0f25a commit b5b6b6b

File tree

9 files changed

+74
-47
lines changed

9 files changed

+74
-47
lines changed

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

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,9 @@ static int ice_dcbnl_setets(struct net_device *netdev, struct ieee_ets *ets)
9797

9898
new_cfg->etscfg.maxtcs = pf->hw.func_caps.common_cap.maxtc;
9999

100+
if (!bwcfg)
101+
new_cfg->etscfg.tcbwtable[0] = 100;
102+
100103
if (!bwrec)
101104
new_cfg->etsrec.tcbwtable[0] = 100;
102105

@@ -167,15 +170,18 @@ static u8 ice_dcbnl_setdcbx(struct net_device *netdev, u8 mode)
167170
if (mode == pf->dcbx_cap)
168171
return ICE_DCB_NO_HW_CHG;
169172

170-
pf->dcbx_cap = mode;
171173
qos_cfg = &pf->hw.port_info->qos_cfg;
172-
if (mode & DCB_CAP_DCBX_VER_CEE) {
173-
if (qos_cfg->local_dcbx_cfg.pfc_mode == ICE_QOS_MODE_DSCP)
174-
return ICE_DCB_NO_HW_CHG;
174+
175+
/* DSCP configuration is not DCBx negotiated */
176+
if (qos_cfg->local_dcbx_cfg.pfc_mode == ICE_QOS_MODE_DSCP)
177+
return ICE_DCB_NO_HW_CHG;
178+
179+
pf->dcbx_cap = mode;
180+
181+
if (mode & DCB_CAP_DCBX_VER_CEE)
175182
qos_cfg->local_dcbx_cfg.dcbx_mode = ICE_DCBX_MODE_CEE;
176-
} else {
183+
else
177184
qos_cfg->local_dcbx_cfg.dcbx_mode = ICE_DCBX_MODE_IEEE;
178-
}
179185

180186
dev_info(ice_pf_to_dev(pf), "DCBx mode = 0x%x\n", mode);
181187
return ICE_DCB_HW_CHG_RST;

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1268,7 +1268,7 @@ ice_fdir_write_all_fltr(struct ice_pf *pf, struct ice_fdir_fltr *input,
12681268
bool is_tun = tun == ICE_FD_HW_SEG_TUN;
12691269
int err;
12701270

1271-
if (is_tun && !ice_get_open_tunnel_port(&pf->hw, &port_num))
1271+
if (is_tun && !ice_get_open_tunnel_port(&pf->hw, &port_num, TNL_ALL))
12721272
continue;
12731273
err = ice_fdir_write_fltr(pf, input, add, is_tun);
12741274
if (err)
@@ -1652,7 +1652,7 @@ int ice_add_fdir_ethtool(struct ice_vsi *vsi, struct ethtool_rxnfc *cmd)
16521652
}
16531653

16541654
/* return error if not an update and no available filters */
1655-
fltrs_needed = ice_get_open_tunnel_port(hw, &tunnel_port) ? 2 : 1;
1655+
fltrs_needed = ice_get_open_tunnel_port(hw, &tunnel_port, TNL_ALL) ? 2 : 1;
16561656
if (!ice_fdir_find_fltr_by_idx(hw, fsp->location) &&
16571657
ice_fdir_num_avail_fltr(hw, pf->vsi[vsi->idx]) < fltrs_needed) {
16581658
dev_err(dev, "Failed to add filter. The maximum number of flow director filters has been reached.\n");

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -924,7 +924,7 @@ ice_fdir_get_gen_prgm_pkt(struct ice_hw *hw, struct ice_fdir_fltr *input,
924924
memcpy(pkt, ice_fdir_pkt[idx].pkt, ice_fdir_pkt[idx].pkt_len);
925925
loc = pkt;
926926
} else {
927-
if (!ice_get_open_tunnel_port(hw, &tnl_port))
927+
if (!ice_get_open_tunnel_port(hw, &tnl_port, TNL_ALL))
928928
return ICE_ERR_DOES_NOT_EXIST;
929929
if (!ice_fdir_pkt[idx].tun_pkt)
930930
return ICE_ERR_PARAM;

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1899,17 +1899,20 @@ static struct ice_buf *ice_pkg_buf(struct ice_buf_build *bld)
18991899
* ice_get_open_tunnel_port - retrieve an open tunnel port
19001900
* @hw: pointer to the HW structure
19011901
* @port: returns open port
1902+
* @type: type of tunnel, can be TNL_LAST if it doesn't matter
19021903
*/
19031904
bool
1904-
ice_get_open_tunnel_port(struct ice_hw *hw, u16 *port)
1905+
ice_get_open_tunnel_port(struct ice_hw *hw, u16 *port,
1906+
enum ice_tunnel_type type)
19051907
{
19061908
bool res = false;
19071909
u16 i;
19081910

19091911
mutex_lock(&hw->tnl_lock);
19101912

19111913
for (i = 0; i < hw->tnl.count && i < ICE_TUNNEL_MAX_ENTRIES; i++)
1912-
if (hw->tnl.tbl[i].valid && hw->tnl.tbl[i].port) {
1914+
if (hw->tnl.tbl[i].valid && hw->tnl.tbl[i].port &&
1915+
(type == TNL_LAST || type == hw->tnl.tbl[i].type)) {
19131916
*port = hw->tnl.tbl[i].port;
19141917
res = true;
19151918
break;

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ enum ice_status
3333
ice_get_sw_fv_list(struct ice_hw *hw, u8 *prot_ids, u16 ids_cnt,
3434
unsigned long *bm, struct list_head *fv_list);
3535
bool
36-
ice_get_open_tunnel_port(struct ice_hw *hw, u16 *port);
36+
ice_get_open_tunnel_port(struct ice_hw *hw, u16 *port,
37+
enum ice_tunnel_type type);
3738
int ice_udp_tunnel_set_port(struct net_device *netdev, unsigned int table,
3839
unsigned int idx, struct udp_tunnel_info *ti);
3940
int ice_udp_tunnel_unset_port(struct net_device *netdev, unsigned int table,

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

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5881,6 +5881,9 @@ static int ice_up_complete(struct ice_vsi *vsi)
58815881
netif_carrier_on(vsi->netdev);
58825882
}
58835883

5884+
/* clear this now, and the first stats read will be used as baseline */
5885+
vsi->stat_offsets_loaded = false;
5886+
58845887
ice_service_task_schedule(pf);
58855888

58865889
return 0;
@@ -5927,14 +5930,15 @@ ice_fetch_u64_stats_per_ring(struct u64_stats_sync *syncp, struct ice_q_stats st
59275930
/**
59285931
* ice_update_vsi_tx_ring_stats - Update VSI Tx ring stats counters
59295932
* @vsi: the VSI to be updated
5933+
* @vsi_stats: the stats struct to be updated
59305934
* @rings: rings to work on
59315935
* @count: number of rings
59325936
*/
59335937
static void
5934-
ice_update_vsi_tx_ring_stats(struct ice_vsi *vsi, struct ice_tx_ring **rings,
5935-
u16 count)
5938+
ice_update_vsi_tx_ring_stats(struct ice_vsi *vsi,
5939+
struct rtnl_link_stats64 *vsi_stats,
5940+
struct ice_tx_ring **rings, u16 count)
59365941
{
5937-
struct rtnl_link_stats64 *vsi_stats = &vsi->net_stats;
59385942
u16 i;
59395943

59405944
for (i = 0; i < count; i++) {
@@ -5958,15 +5962,13 @@ ice_update_vsi_tx_ring_stats(struct ice_vsi *vsi, struct ice_tx_ring **rings,
59585962
*/
59595963
static void ice_update_vsi_ring_stats(struct ice_vsi *vsi)
59605964
{
5961-
struct rtnl_link_stats64 *vsi_stats = &vsi->net_stats;
5965+
struct rtnl_link_stats64 *vsi_stats;
59625966
u64 pkts, bytes;
59635967
int i;
59645968

5965-
/* reset netdev stats */
5966-
vsi_stats->tx_packets = 0;
5967-
vsi_stats->tx_bytes = 0;
5968-
vsi_stats->rx_packets = 0;
5969-
vsi_stats->rx_bytes = 0;
5969+
vsi_stats = kzalloc(sizeof(*vsi_stats), GFP_ATOMIC);
5970+
if (!vsi_stats)
5971+
return;
59705972

59715973
/* reset non-netdev (extended) stats */
59725974
vsi->tx_restart = 0;
@@ -5978,7 +5980,8 @@ static void ice_update_vsi_ring_stats(struct ice_vsi *vsi)
59785980
rcu_read_lock();
59795981

59805982
/* update Tx rings counters */
5981-
ice_update_vsi_tx_ring_stats(vsi, vsi->tx_rings, vsi->num_txq);
5983+
ice_update_vsi_tx_ring_stats(vsi, vsi_stats, vsi->tx_rings,
5984+
vsi->num_txq);
59825985

59835986
/* update Rx rings counters */
59845987
ice_for_each_rxq(vsi, i) {
@@ -5993,10 +5996,17 @@ static void ice_update_vsi_ring_stats(struct ice_vsi *vsi)
59935996

59945997
/* update XDP Tx rings counters */
59955998
if (ice_is_xdp_ena_vsi(vsi))
5996-
ice_update_vsi_tx_ring_stats(vsi, vsi->xdp_rings,
5999+
ice_update_vsi_tx_ring_stats(vsi, vsi_stats, vsi->xdp_rings,
59976000
vsi->num_xdp_txq);
59986001

59996002
rcu_read_unlock();
6003+
6004+
vsi->net_stats.tx_packets = vsi_stats->tx_packets;
6005+
vsi->net_stats.tx_bytes = vsi_stats->tx_bytes;
6006+
vsi->net_stats.rx_packets = vsi_stats->rx_packets;
6007+
vsi->net_stats.rx_bytes = vsi_stats->rx_bytes;
6008+
6009+
kfree(vsi_stats);
60006010
}
60016011

60026012
/**

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

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3796,10 +3796,13 @@ static struct ice_protocol_entry ice_prot_id_tbl[ICE_PROTOCOL_LAST] = {
37963796
* ice_find_recp - find a recipe
37973797
* @hw: pointer to the hardware structure
37983798
* @lkup_exts: extension sequence to match
3799+
* @tun_type: type of recipe tunnel
37993800
*
38003801
* Returns index of matching recipe, or ICE_MAX_NUM_RECIPES if not found.
38013802
*/
3802-
static u16 ice_find_recp(struct ice_hw *hw, struct ice_prot_lkup_ext *lkup_exts)
3803+
static u16
3804+
ice_find_recp(struct ice_hw *hw, struct ice_prot_lkup_ext *lkup_exts,
3805+
enum ice_sw_tunnel_type tun_type)
38033806
{
38043807
bool refresh_required = true;
38053808
struct ice_sw_recipe *recp;
@@ -3860,8 +3863,9 @@ static u16 ice_find_recp(struct ice_hw *hw, struct ice_prot_lkup_ext *lkup_exts)
38603863
}
38613864
/* If for "i"th recipe the found was never set to false
38623865
* then it means we found our match
3866+
* Also tun type of recipe needs to be checked
38633867
*/
3864-
if (found)
3868+
if (found && recp[i].tun_type == tun_type)
38653869
return i; /* Return the recipe ID */
38663870
}
38673871
}
@@ -4651,11 +4655,12 @@ ice_add_adv_recipe(struct ice_hw *hw, struct ice_adv_lkup_elem *lkups,
46514655
}
46524656

46534657
/* Look for a recipe which matches our requested fv / mask list */
4654-
*rid = ice_find_recp(hw, lkup_exts);
4658+
*rid = ice_find_recp(hw, lkup_exts, rinfo->tun_type);
46554659
if (*rid < ICE_MAX_NUM_RECIPES)
46564660
/* Success if found a recipe that match the existing criteria */
46574661
goto err_unroll;
46584662

4663+
rm->tun_type = rinfo->tun_type;
46594664
/* Recipe we need does not exist, add a recipe */
46604665
status = ice_add_sw_recipe(hw, rm, profiles);
46614666
if (status)
@@ -4958,11 +4963,13 @@ ice_fill_adv_packet_tun(struct ice_hw *hw, enum ice_sw_tunnel_type tun_type,
49584963

49594964
switch (tun_type) {
49604965
case ICE_SW_TUN_VXLAN:
4966+
if (!ice_get_open_tunnel_port(hw, &open_port, TNL_VXLAN))
4967+
return ICE_ERR_CFG;
4968+
break;
49614969
case ICE_SW_TUN_GENEVE:
4962-
if (!ice_get_open_tunnel_port(hw, &open_port))
4970+
if (!ice_get_open_tunnel_port(hw, &open_port, TNL_GENEVE))
49634971
return ICE_ERR_CFG;
49644972
break;
4965-
49664973
default:
49674974
/* Nothing needs to be done for this tunnel type */
49684975
return 0;
@@ -5555,7 +5562,7 @@ ice_rem_adv_rule(struct ice_hw *hw, struct ice_adv_lkup_elem *lkups,
55555562
if (status)
55565563
return status;
55575564

5558-
rid = ice_find_recp(hw, &lkup_exts);
5565+
rid = ice_find_recp(hw, &lkup_exts, rinfo->tun_type);
55595566
/* If did not find a recipe that match the existing criteria */
55605567
if (rid == ICE_MAX_NUM_RECIPES)
55615568
return ICE_ERR_PARAM;

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

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -74,21 +74,13 @@ static enum ice_protocol_type ice_proto_type_from_ipv6(bool inner)
7474
return inner ? ICE_IPV6_IL : ICE_IPV6_OFOS;
7575
}
7676

77-
static enum ice_protocol_type
78-
ice_proto_type_from_l4_port(bool inner, u16 ip_proto)
77+
static enum ice_protocol_type ice_proto_type_from_l4_port(u16 ip_proto)
7978
{
80-
if (inner) {
81-
switch (ip_proto) {
82-
case IPPROTO_UDP:
83-
return ICE_UDP_ILOS;
84-
}
85-
} else {
86-
switch (ip_proto) {
87-
case IPPROTO_TCP:
88-
return ICE_TCP_IL;
89-
case IPPROTO_UDP:
90-
return ICE_UDP_OF;
91-
}
79+
switch (ip_proto) {
80+
case IPPROTO_TCP:
81+
return ICE_TCP_IL;
82+
case IPPROTO_UDP:
83+
return ICE_UDP_ILOS;
9284
}
9385

9486
return 0;
@@ -191,8 +183,9 @@ ice_tc_fill_tunnel_outer(u32 flags, struct ice_tc_flower_fltr *fltr,
191183
i++;
192184
}
193185

194-
if (flags & ICE_TC_FLWR_FIELD_ENC_DEST_L4_PORT) {
195-
list[i].type = ice_proto_type_from_l4_port(false, hdr->l3_key.ip_proto);
186+
if ((flags & ICE_TC_FLWR_FIELD_ENC_DEST_L4_PORT) &&
187+
hdr->l3_key.ip_proto == IPPROTO_UDP) {
188+
list[i].type = ICE_UDP_OF;
196189
list[i].h_u.l4_hdr.dst_port = hdr->l4_key.dst_port;
197190
list[i].m_u.l4_hdr.dst_port = hdr->l4_mask.dst_port;
198191
i++;
@@ -317,7 +310,7 @@ ice_tc_fill_rules(struct ice_hw *hw, u32 flags,
317310
ICE_TC_FLWR_FIELD_SRC_L4_PORT)) {
318311
struct ice_tc_l4_hdr *l4_key, *l4_mask;
319312

320-
list[i].type = ice_proto_type_from_l4_port(inner, headers->l3_key.ip_proto);
313+
list[i].type = ice_proto_type_from_l4_port(headers->l3_key.ip_proto);
321314
l4_key = &headers->l4_key;
322315
l4_mask = &headers->l4_mask;
323316

@@ -802,7 +795,8 @@ ice_parse_tunnel_attr(struct net_device *dev, struct flow_rule *rule,
802795
headers->l3_mask.ttl = match.mask->ttl;
803796
}
804797

805-
if (flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_ENC_PORTS)) {
798+
if (flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_ENC_PORTS) &&
799+
fltr->tunnel_type != TNL_VXLAN && fltr->tunnel_type != TNL_GENEVE) {
806800
struct flow_match_ports match;
807801

808802
flow_rule_match_enc_ports(rule, &match);

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1617,6 +1617,7 @@ bool ice_reset_all_vfs(struct ice_pf *pf, bool is_vflr)
16171617
ice_vc_set_default_allowlist(vf);
16181618

16191619
ice_vf_fdir_exit(vf);
1620+
ice_vf_fdir_init(vf);
16201621
/* clean VF control VSI when resetting VFs since it should be
16211622
* setup only when VF creates its first FDIR rule.
16221623
*/
@@ -1747,6 +1748,7 @@ bool ice_reset_vf(struct ice_vf *vf, bool is_vflr)
17471748
}
17481749

17491750
ice_vf_fdir_exit(vf);
1751+
ice_vf_fdir_init(vf);
17501752
/* clean VF control VSI when resetting VF since it should be setup
17511753
* only when VF creates its first FDIR rule.
17521754
*/
@@ -2021,6 +2023,10 @@ static int ice_ena_vfs(struct ice_pf *pf, u16 num_vfs)
20212023
if (ret)
20222024
goto err_unroll_sriov;
20232025

2026+
/* rearm global interrupts */
2027+
if (test_and_clear_bit(ICE_OICR_INTR_DIS, pf->state))
2028+
ice_irq_dynamic_ena(hw, NULL, NULL);
2029+
20242030
return 0;
20252031

20262032
err_unroll_sriov:

0 commit comments

Comments
 (0)