Skip to content

Commit 2e957f9

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 2024-01-03 (i40e, ice, igc) This series contains updates to i40e, ice, and igc drivers. Ke Xiao fixes use after free for unicast filters on i40e. Andrii restores VF MSI-X flag after PCI reset on i40e. Paul corrects admin queue link status structure to fulfill firmware expectations for ice. Rodrigo Cataldo corrects value used for hicredit calculations on igc. * '40GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/net-queue: igc: Fix hicredit calculation ice: fix Get link status data length i40e: Restore VF MSI-X state during PCI reset i40e: fix use-after-free in i40e_aqc_add_filters() ==================== Link: https://lore.kernel.org/r/20240103193254.822968-1-anthony.l.nguyen@intel.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2 parents 382a320 + 947dfc8 commit 2e957f9

File tree

5 files changed

+42
-3
lines changed

5 files changed

+42
-3
lines changed

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

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,12 +107,18 @@ static struct workqueue_struct *i40e_wq;
107107
static void netdev_hw_addr_refcnt(struct i40e_mac_filter *f,
108108
struct net_device *netdev, int delta)
109109
{
110+
struct netdev_hw_addr_list *ha_list;
110111
struct netdev_hw_addr *ha;
111112

112113
if (!f || !netdev)
113114
return;
114115

115-
netdev_for_each_mc_addr(ha, netdev) {
116+
if (is_unicast_ether_addr(f->macaddr) || is_link_local_ether_addr(f->macaddr))
117+
ha_list = &netdev->uc;
118+
else
119+
ha_list = &netdev->mc;
120+
121+
netdev_hw_addr_list_for_each(ha, ha_list) {
116122
if (ether_addr_equal(ha->addr, f->macaddr)) {
117123
ha->refcount += delta;
118124
if (ha->refcount <= 0)
@@ -16512,6 +16518,9 @@ static void i40e_pci_error_reset_done(struct pci_dev *pdev)
1651216518
return;
1651316519

1651416520
i40e_reset_and_rebuild(pf, false, false);
16521+
#ifdef CONFIG_PCI_IOV
16522+
i40e_restore_all_vfs_msi_state(pdev);
16523+
#endif /* CONFIG_PCI_IOV */
1651516524
}
1651616525

1651716526
/**

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

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,32 @@ void i40e_vc_notify_reset(struct i40e_pf *pf)
154154
(u8 *)&pfe, sizeof(struct virtchnl_pf_event));
155155
}
156156

157+
#ifdef CONFIG_PCI_IOV
158+
void i40e_restore_all_vfs_msi_state(struct pci_dev *pdev)
159+
{
160+
u16 vf_id;
161+
u16 pos;
162+
163+
/* Continue only if this is a PF */
164+
if (!pdev->is_physfn)
165+
return;
166+
167+
if (!pci_num_vf(pdev))
168+
return;
169+
170+
pos = pci_find_ext_capability(pdev, PCI_EXT_CAP_ID_SRIOV);
171+
if (pos) {
172+
struct pci_dev *vf_dev = NULL;
173+
174+
pci_read_config_word(pdev, pos + PCI_SRIOV_VF_DID, &vf_id);
175+
while ((vf_dev = pci_get_device(pdev->vendor, vf_id, vf_dev))) {
176+
if (vf_dev->is_virtfn && vf_dev->physfn == pdev)
177+
pci_restore_msi_state(vf_dev);
178+
}
179+
}
180+
}
181+
#endif /* CONFIG_PCI_IOV */
182+
157183
/**
158184
* i40e_vc_notify_vf_reset
159185
* @vf: pointer to the VF structure

drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,9 @@ int i40e_ndo_set_vf_spoofchk(struct net_device *netdev, int vf_id, bool enable);
137137

138138
void i40e_vc_notify_link_state(struct i40e_pf *pf);
139139
void i40e_vc_notify_reset(struct i40e_pf *pf);
140+
#ifdef CONFIG_PCI_IOV
141+
void i40e_restore_all_vfs_msi_state(struct pci_dev *pdev);
142+
#endif /* CONFIG_PCI_IOV */
140143
int i40e_get_vf_stats(struct net_device *netdev, int vf_id,
141144
struct ifla_vf_stats *vf_stats);
142145

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1359,8 +1359,9 @@ struct ice_aqc_get_link_status_data {
13591359
u8 lp_flowcontrol;
13601360
#define ICE_AQ_LINK_LP_PAUSE_ADV BIT(0)
13611361
#define ICE_AQ_LINK_LP_ASM_DIR_ADV BIT(1)
1362+
u8 reserved5[5];
13621363
#define ICE_AQC_LS_DATA_SIZE_V2 \
1363-
offsetofend(struct ice_aqc_get_link_status_data, lp_flowcontrol)
1364+
offsetofend(struct ice_aqc_get_link_status_data, reserved5)
13641365
} __packed;
13651366

13661367
/* Set event mask command (direct 0x0613) */

drivers/net/ethernet/intel/igc/igc_tsn.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ static int igc_tsn_enable_offload(struct igc_adapter *adapter)
227227
wr32(IGC_TQAVCC(i), tqavcc);
228228

229229
wr32(IGC_TQAVHC(i),
230-
0x80000000 + ring->hicredit * 0x7735);
230+
0x80000000 + ring->hicredit * 0x7736);
231231
} else {
232232
/* Disable any CBS for the queue */
233233
txqctl &= ~(IGC_TXQCTL_QAV_SEL_MASK);

0 commit comments

Comments
 (0)