Skip to content

Commit 42870a1

Browse files
committed
Merge branch '40GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/net-queue
Tony Nguyen says: ==================== Intel Wired LAN Driver Updates 2021-02-19 This series contains updates to i40e driver only. Slawomir resolves an issue with the IPv6 extension headers being processed incorrectly. Keita Suzuki fixes a memory leak on probe failure. Mateusz initializes AQ command structures to zero to comply with spec, fixes FW flow control settings being overwritten and resolves an issue with adding VLAN filters after enabling FW LLDP. He also adds an additional check when adding TC filter as the current check doesn't properly distinguish between IPv4 and IPv6. Sylwester removes setting disabled bit when syncing filters as this prevents VFs from completing setup. Norbert cleans up sparse warnings. v2: - Fix fixes tag on patch 7 * '40GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/net-queue: i40e: Fix endianness conversions i40e: Fix add TC filter for IPv6 i40e: Fix VFs not created i40e: Fix addition of RX filters after enabling FW LLDP agent i40e: Fix overwriting flow control settings during driver loading i40e: Add zero-initialization of AQ command structures i40e: Fix memory leak in i40e_probe i40e: Fix flow for IPv6 next header (extension header) ==================== Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
2 parents 8eb65fd + b32cddd commit 42870a1

File tree

4 files changed

+39
-54
lines changed

4 files changed

+39
-54
lines changed

drivers/net/ethernet/intel/i40e/i40e_ethtool.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5083,7 +5083,7 @@ static int i40e_set_priv_flags(struct net_device *dev, u32 flags)
50835083
enum i40e_admin_queue_err adq_err;
50845084
struct i40e_vsi *vsi = np->vsi;
50855085
struct i40e_pf *pf = vsi->back;
5086-
bool is_reset_needed;
5086+
u32 reset_needed = 0;
50875087
i40e_status status;
50885088
u32 i, j;
50895089

@@ -5128,9 +5128,11 @@ static int i40e_set_priv_flags(struct net_device *dev, u32 flags)
51285128
flags_complete:
51295129
changed_flags = orig_flags ^ new_flags;
51305130

5131-
is_reset_needed = !!(changed_flags & (I40E_FLAG_VEB_STATS_ENABLED |
5132-
I40E_FLAG_LEGACY_RX | I40E_FLAG_SOURCE_PRUNING_DISABLED |
5133-
I40E_FLAG_DISABLE_FW_LLDP));
5131+
if (changed_flags & I40E_FLAG_DISABLE_FW_LLDP)
5132+
reset_needed = I40E_PF_RESET_AND_REBUILD_FLAG;
5133+
if (changed_flags & (I40E_FLAG_VEB_STATS_ENABLED |
5134+
I40E_FLAG_LEGACY_RX | I40E_FLAG_SOURCE_PRUNING_DISABLED))
5135+
reset_needed = BIT(__I40E_PF_RESET_REQUESTED);
51345136

51355137
/* Before we finalize any flag changes, we need to perform some
51365138
* checks to ensure that the changes are supported and safe.
@@ -5252,7 +5254,7 @@ static int i40e_set_priv_flags(struct net_device *dev, u32 flags)
52525254
case I40E_AQ_RC_EEXIST:
52535255
dev_warn(&pf->pdev->dev,
52545256
"FW LLDP agent is already running\n");
5255-
is_reset_needed = false;
5257+
reset_needed = 0;
52565258
break;
52575259
case I40E_AQ_RC_EPERM:
52585260
dev_warn(&pf->pdev->dev,
@@ -5281,8 +5283,8 @@ static int i40e_set_priv_flags(struct net_device *dev, u32 flags)
52815283
/* Issue reset to cause things to take effect, as additional bits
52825284
* are added we will need to create a mask of bits requiring reset
52835285
*/
5284-
if (is_reset_needed)
5285-
i40e_do_reset(pf, BIT(__I40E_PF_RESET_REQUESTED), true);
5286+
if (reset_needed)
5287+
i40e_do_reset(pf, reset_needed, true);
52865288

52875289
return 0;
52885290
}

drivers/net/ethernet/intel/i40e/i40e_main.c

Lines changed: 22 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -2616,7 +2616,7 @@ static void i40e_sync_filters_subtask(struct i40e_pf *pf)
26162616
return;
26172617
if (!test_and_clear_bit(__I40E_MACVLAN_SYNC_PENDING, pf->state))
26182618
return;
2619-
if (test_and_set_bit(__I40E_VF_DISABLE, pf->state)) {
2619+
if (test_bit(__I40E_VF_DISABLE, pf->state)) {
26202620
set_bit(__I40E_MACVLAN_SYNC_PENDING, pf->state);
26212621
return;
26222622
}
@@ -2634,7 +2634,6 @@ static void i40e_sync_filters_subtask(struct i40e_pf *pf)
26342634
}
26352635
}
26362636
}
2637-
clear_bit(__I40E_VF_DISABLE, pf->state);
26382637
}
26392638

26402639
/**
@@ -5937,7 +5936,7 @@ static int i40e_add_channel(struct i40e_pf *pf, u16 uplink_seid,
59375936
ch->enabled_tc = !i40e_is_channel_macvlan(ch) && enabled_tc;
59385937
ch->seid = ctxt.seid;
59395938
ch->vsi_number = ctxt.vsi_number;
5940-
ch->stat_counter_idx = cpu_to_le16(ctxt.info.stat_counter_idx);
5939+
ch->stat_counter_idx = le16_to_cpu(ctxt.info.stat_counter_idx);
59415940

59425941
/* copy just the sections touched not the entire info
59435942
* since not all sections are valid as returned by
@@ -7977,8 +7976,8 @@ static inline void
79777976
i40e_set_cld_element(struct i40e_cloud_filter *filter,
79787977
struct i40e_aqc_cloud_filters_element_data *cld)
79797978
{
7980-
int i, j;
79817979
u32 ipa;
7980+
int i;
79827981

79837982
memset(cld, 0, sizeof(*cld));
79847983
ether_addr_copy(cld->outer_mac, filter->dst_mac);
@@ -7989,14 +7988,14 @@ i40e_set_cld_element(struct i40e_cloud_filter *filter,
79897988

79907989
if (filter->n_proto == ETH_P_IPV6) {
79917990
#define IPV6_MAX_INDEX (ARRAY_SIZE(filter->dst_ipv6) - 1)
7992-
for (i = 0, j = 0; i < ARRAY_SIZE(filter->dst_ipv6);
7993-
i++, j += 2) {
7991+
for (i = 0; i < ARRAY_SIZE(filter->dst_ipv6); i++) {
79947992
ipa = be32_to_cpu(filter->dst_ipv6[IPV6_MAX_INDEX - i]);
7995-
ipa = cpu_to_le32(ipa);
7996-
memcpy(&cld->ipaddr.raw_v6.data[j], &ipa, sizeof(ipa));
7993+
7994+
*(__le32 *)&cld->ipaddr.raw_v6.data[i * 2] = cpu_to_le32(ipa);
79977995
}
79987996
} else {
79997997
ipa = be32_to_cpu(filter->dst_ipv4);
7998+
80007999
memcpy(&cld->ipaddr.v4.data, &ipa, sizeof(ipa));
80018000
}
80028001

@@ -8044,6 +8043,8 @@ int i40e_add_del_cloud_filter(struct i40e_vsi *vsi,
80448043
if (filter->flags >= ARRAY_SIZE(flag_table))
80458044
return I40E_ERR_CONFIG;
80468045

8046+
memset(&cld_filter, 0, sizeof(cld_filter));
8047+
80478048
/* copy element needed to add cloud filter from filter */
80488049
i40e_set_cld_element(filter, &cld_filter);
80498050

@@ -8107,10 +8108,13 @@ int i40e_add_del_cloud_filter_big_buf(struct i40e_vsi *vsi,
81078108
return -EOPNOTSUPP;
81088109

81098110
/* adding filter using src_port/src_ip is not supported at this stage */
8110-
if (filter->src_port || filter->src_ipv4 ||
8111+
if (filter->src_port ||
8112+
(filter->src_ipv4 && filter->n_proto != ETH_P_IPV6) ||
81118113
!ipv6_addr_any(&filter->ip.v6.src_ip6))
81128114
return -EOPNOTSUPP;
81138115

8116+
memset(&cld_filter, 0, sizeof(cld_filter));
8117+
81148118
/* copy element needed to add cloud filter from filter */
81158119
i40e_set_cld_element(filter, &cld_filter.element);
81168120

@@ -8134,7 +8138,7 @@ int i40e_add_del_cloud_filter_big_buf(struct i40e_vsi *vsi,
81348138
cpu_to_le16(I40E_AQC_ADD_CLOUD_FILTER_MAC_VLAN_PORT);
81358139
}
81368140

8137-
} else if (filter->dst_ipv4 ||
8141+
} else if ((filter->dst_ipv4 && filter->n_proto != ETH_P_IPV6) ||
81388142
!ipv6_addr_any(&filter->ip.v6.dst_ip6)) {
81398143
cld_filter.element.flags =
81408144
cpu_to_le16(I40E_AQC_ADD_CLOUD_FILTER_IP_PORT);
@@ -8928,18 +8932,17 @@ void i40e_do_reset(struct i40e_pf *pf, u32 reset_flags, bool lock_acquired)
89288932
dev_dbg(&pf->pdev->dev, "PFR requested\n");
89298933
i40e_handle_reset_warning(pf, lock_acquired);
89308934

8931-
dev_info(&pf->pdev->dev,
8932-
pf->flags & I40E_FLAG_DISABLE_FW_LLDP ?
8933-
"FW LLDP is disabled\n" :
8934-
"FW LLDP is enabled\n");
8935-
89368935
} else if (reset_flags & I40E_PF_RESET_AND_REBUILD_FLAG) {
89378936
/* Request a PF Reset
89388937
*
89398938
* Resets PF and reinitializes PFs VSI.
89408939
*/
89418940
i40e_prep_for_reset(pf);
89428941
i40e_reset_and_rebuild(pf, true, lock_acquired);
8942+
dev_info(&pf->pdev->dev,
8943+
pf->flags & I40E_FLAG_DISABLE_FW_LLDP ?
8944+
"FW LLDP is disabled\n" :
8945+
"FW LLDP is enabled\n");
89438946

89448947
} else if (reset_flags & BIT_ULL(__I40E_REINIT_REQUESTED)) {
89458948
int v;
@@ -10462,7 +10465,6 @@ static void i40e_rebuild(struct i40e_pf *pf, bool reinit, bool lock_acquired)
1046210465
int old_recovery_mode_bit = test_bit(__I40E_RECOVERY_MODE, pf->state);
1046310466
struct i40e_vsi *vsi = pf->vsi[pf->lan_vsi];
1046410467
struct i40e_hw *hw = &pf->hw;
10465-
u8 set_fc_aq_fail = 0;
1046610468
i40e_status ret;
1046710469
u32 val;
1046810470
int v;
@@ -10605,13 +10607,6 @@ static void i40e_rebuild(struct i40e_pf *pf, bool reinit, bool lock_acquired)
1060510607
i40e_stat_str(&pf->hw, ret),
1060610608
i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status));
1060710609

10608-
/* make sure our flow control settings are restored */
10609-
ret = i40e_set_fc(&pf->hw, &set_fc_aq_fail, true);
10610-
if (ret)
10611-
dev_dbg(&pf->pdev->dev, "setting flow control: ret = %s last_status = %s\n",
10612-
i40e_stat_str(&pf->hw, ret),
10613-
i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status));
10614-
1061510610
/* Rebuild the VSIs and VEBs that existed before reset.
1061610611
* They are still in our local switch element arrays, so only
1061710612
* need to rebuild the switch model in the HW.
@@ -12191,6 +12186,8 @@ i40e_status i40e_set_partition_bw_setting(struct i40e_pf *pf)
1219112186
struct i40e_aqc_configure_partition_bw_data bw_data;
1219212187
i40e_status status;
1219312188

12189+
memset(&bw_data, 0, sizeof(bw_data));
12190+
1219412191
/* Set the valid bit for this PF */
1219512192
bw_data.pf_valid_bits = cpu_to_le16(BIT(pf->hw.pf_id));
1219612193
bw_data.max_bw[pf->hw.pf_id] = pf->max_bw & I40E_ALT_BW_VALUE_MASK;
@@ -15198,7 +15195,6 @@ static int i40e_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
1519815195
int err;
1519915196
u32 val;
1520015197
u32 i;
15201-
u8 set_fc_aq_fail;
1520215198

1520315199
err = pci_enable_device_mem(pdev);
1520415200
if (err)
@@ -15537,24 +15533,6 @@ static int i40e_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
1553715533
}
1553815534
INIT_LIST_HEAD(&pf->vsi[pf->lan_vsi]->ch_list);
1553915535

15540-
/* Make sure flow control is set according to current settings */
15541-
err = i40e_set_fc(hw, &set_fc_aq_fail, true);
15542-
if (set_fc_aq_fail & I40E_SET_FC_AQ_FAIL_GET)
15543-
dev_dbg(&pf->pdev->dev,
15544-
"Set fc with err %s aq_err %s on get_phy_cap\n",
15545-
i40e_stat_str(hw, err),
15546-
i40e_aq_str(hw, hw->aq.asq_last_status));
15547-
if (set_fc_aq_fail & I40E_SET_FC_AQ_FAIL_SET)
15548-
dev_dbg(&pf->pdev->dev,
15549-
"Set fc with err %s aq_err %s on set_phy_config\n",
15550-
i40e_stat_str(hw, err),
15551-
i40e_aq_str(hw, hw->aq.asq_last_status));
15552-
if (set_fc_aq_fail & I40E_SET_FC_AQ_FAIL_UPDATE)
15553-
dev_dbg(&pf->pdev->dev,
15554-
"Set fc with err %s aq_err %s on get_link_info\n",
15555-
i40e_stat_str(hw, err),
15556-
i40e_aq_str(hw, hw->aq.asq_last_status));
15557-
1555815536
/* if FDIR VSI was set up, start it now */
1555915537
for (i = 0; i < pf->num_alloc_vsi; i++) {
1556015538
if (pf->vsi[i] && pf->vsi[i]->type == I40E_VSI_FDIR) {
@@ -15611,6 +15589,8 @@ static int i40e_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
1561115589
if (err) {
1561215590
dev_info(&pdev->dev,
1561315591
"setup of misc vector failed: %d\n", err);
15592+
i40e_cloud_filter_exit(pf);
15593+
i40e_fdir_teardown(pf);
1561415594
goto err_vsis;
1561515595
}
1561615596
}

drivers/net/ethernet/intel/i40e/i40e_txrx.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1948,7 +1948,7 @@ void i40e_process_skb_fields(struct i40e_ring *rx_ring,
19481948
skb_record_rx_queue(skb, rx_ring->queue_index);
19491949

19501950
if (qword & BIT(I40E_RX_DESC_STATUS_L2TAG1P_SHIFT)) {
1951-
u16 vlan_tag = rx_desc->wb.qword0.lo_dword.l2tag1;
1951+
__le16 vlan_tag = rx_desc->wb.qword0.lo_dword.l2tag1;
19521952

19531953
__vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q),
19541954
le16_to_cpu(vlan_tag));
@@ -3223,13 +3223,16 @@ static int i40e_tx_enable_csum(struct sk_buff *skb, u32 *tx_flags,
32233223

32243224
l4_proto = ip.v4->protocol;
32253225
} else if (*tx_flags & I40E_TX_FLAGS_IPV6) {
3226+
int ret;
3227+
32263228
tunnel |= I40E_TX_CTX_EXT_IP_IPV6;
32273229

32283230
exthdr = ip.hdr + sizeof(*ip.v6);
32293231
l4_proto = ip.v6->nexthdr;
3230-
if (l4.hdr != exthdr)
3231-
ipv6_skip_exthdr(skb, exthdr - skb->data,
3232-
&l4_proto, &frag_off);
3232+
ret = ipv6_skip_exthdr(skb, exthdr - skb->data,
3233+
&l4_proto, &frag_off);
3234+
if (ret < 0)
3235+
return -1;
32333236
}
32343237

32353238
/* define outer transport */

drivers/net/ethernet/intel/i40e/i40e_xsk.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,7 @@ static void i40e_set_rs_bit(struct i40e_ring *xdp_ring)
453453
struct i40e_tx_desc *tx_desc;
454454

455455
tx_desc = I40E_TX_DESC(xdp_ring, ntu);
456-
tx_desc->cmd_type_offset_bsz |= (I40E_TX_DESC_CMD_RS << I40E_TXD_QW1_CMD_SHIFT);
456+
tx_desc->cmd_type_offset_bsz |= cpu_to_le64(I40E_TX_DESC_CMD_RS << I40E_TXD_QW1_CMD_SHIFT);
457457
}
458458

459459
/**

0 commit comments

Comments
 (0)