Skip to content

Commit bfaaba9

Browse files
Marcin Szycikanguy11
authored andcommitted
ice: Hide bus-info in ethtool for PRs in switchdev mode
Disable showing bus-info information for port representors in switchdev mode. This fixes a bug that caused displaying wrong netdev descriptions in lshw tool - one port representor displayed PF branding string, and in turn one PF displayed a "generic" description. The bug occurs when many devices show the same bus-info in ethtool, which was the case in switchdev mode (PF and its port representors displayed the same bus-info). The bug occurs only if a port representor netdev appears before PF netdev in /proc/net/dev. In the examples below: ens6fX is PF ens6fXvY is VF ethX is port representor One irrelevant column was removed from output Before: $ sudo lshw -c net -businfo Bus info Device Description ========================================= pci@0000:02:00.0 eth102 Ethernet Controller E810-XXV for SFP pci@0000:02:00.1 ens6f1 Ethernet Controller E810-XXV for SFP pci@0000:02:01.0 ens6f0v0 Ethernet Adaptive Virtual Function pci@0000:02:01.1 ens6f0v1 Ethernet Adaptive Virtual Function pci@0000:02:01.2 ens6f0v2 Ethernet Adaptive Virtual Function pci@0000:02:00.0 ens6f0 Ethernet interface Notice that eth102 and ens6f0 have the same bus-info and their descriptions are swapped. After: $ sudo lshw -c net -businfo Bus info Device Description ========================================= pci@0000:02:00.0 ens6f0 Ethernet Controller E810-XXV for SFP pci@0000:02:00.1 ens6f1 Ethernet Controller E810-XXV for SFP pci@0000:02:01.0 ens6f0v0 Ethernet Adaptive Virtual Function pci@0000:02:01.1 ens6f0v1 Ethernet Adaptive Virtual Function pci@0000:02:01.2 ens6f0v2 Ethernet Adaptive Virtual Function Fixes: 7aae80c ("ice: add port representor ethtool ops and stats") Signed-off-by: Marcin Szycik <[email protected]> Tested-by: Sandeep Penigalapati <[email protected]> Signed-off-by: Tony Nguyen <[email protected]>
1 parent c79bb28 commit bfaaba9

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,18 +189,19 @@ __ice_get_drvinfo(struct net_device *netdev, struct ethtool_drvinfo *drvinfo,
189189
snprintf(drvinfo->fw_version, sizeof(drvinfo->fw_version),
190190
"%x.%02x 0x%x %d.%d.%d", nvm->major, nvm->minor,
191191
nvm->eetrack, orom->major, orom->build, orom->patch);
192-
193-
strscpy(drvinfo->bus_info, pci_name(pf->pdev),
194-
sizeof(drvinfo->bus_info));
195192
}
196193

197194
static void
198195
ice_get_drvinfo(struct net_device *netdev, struct ethtool_drvinfo *drvinfo)
199196
{
200197
struct ice_netdev_priv *np = netdev_priv(netdev);
198+
struct ice_pf *pf = np->vsi->back;
201199

202200
__ice_get_drvinfo(netdev, drvinfo, np->vsi);
203201

202+
strscpy(drvinfo->bus_info, pci_name(pf->pdev),
203+
sizeof(drvinfo->bus_info));
204+
204205
drvinfo->n_priv_flags = ICE_PRIV_FLAG_ARRAY_SIZE;
205206
}
206207

0 commit comments

Comments
 (0)