Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

sfc: Implement ndo_gets_phys_port_id() for EF10 VFs

Signed-off-by: Shradha Shah <sshah@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Shradha Shah and committed by
David S. Miller
1d051e00 0f5c0845

+45
+11
drivers/net/ethernet/sfc/ef10.c
··· 406 406 407 407 efx_ptp_probe(efx, NULL); 408 408 409 + #ifdef CONFIG_SFC_SRIOV 410 + if ((efx->pci_dev->physfn) && (!efx->pci_dev->is_physfn)) { 411 + struct pci_dev *pci_dev_pf = efx->pci_dev->physfn; 412 + struct efx_nic *efx_pf = pci_get_drvdata(pci_dev_pf); 413 + 414 + efx_pf->type->get_mac_address(efx_pf, nic_data->port_id); 415 + } else 416 + #endif 417 + ether_addr_copy(nic_data->port_id, efx->net_dev->perm_addr); 418 + 409 419 return 0; 410 420 411 421 fail5: ··· 4150 4140 .vswitching_probe = efx_ef10_vswitching_probe_vf, 4151 4141 .vswitching_restore = efx_ef10_vswitching_restore_vf, 4152 4142 .vswitching_remove = efx_ef10_vswitching_remove_vf, 4143 + .sriov_get_phys_port_id = efx_ef10_sriov_get_phys_port_id, 4153 4144 #endif 4154 4145 .get_mac_address = efx_ef10_get_mac_address_vf, 4155 4146 .set_mac_address = efx_ef10_set_mac_address,
+14
drivers/net/ethernet/sfc/ef10_sriov.c
··· 736 736 737 737 return 0; 738 738 } 739 + 740 + int efx_ef10_sriov_get_phys_port_id(struct efx_nic *efx, 741 + struct netdev_phys_item_id *ppid) 742 + { 743 + struct efx_ef10_nic_data *nic_data = efx->nic_data; 744 + 745 + if (!is_valid_ether_addr(nic_data->port_id)) 746 + return -EOPNOTSUPP; 747 + 748 + ppid->id_len = ETH_ALEN; 749 + memcpy(ppid->id, nic_data->port_id, ppid->id_len); 750 + 751 + return 0; 752 + }
+3
drivers/net/ethernet/sfc/ef10_sriov.h
··· 54 54 int efx_ef10_sriov_set_vf_link_state(struct efx_nic *efx, int vf_i, 55 55 int link_state); 56 56 57 + int efx_ef10_sriov_get_phys_port_id(struct efx_nic *efx, 58 + struct netdev_phys_item_id *ppid); 59 + 57 60 int efx_ef10_vswitching_probe_pf(struct efx_nic *efx); 58 61 int efx_ef10_vswitching_probe_vf(struct efx_nic *efx); 59 62 int efx_ef10_vswitching_restore_pf(struct efx_nic *efx);
+1
drivers/net/ethernet/sfc/efx.c
··· 2282 2282 .ndo_set_vf_spoofchk = efx_sriov_set_vf_spoofchk, 2283 2283 .ndo_get_vf_config = efx_sriov_get_vf_config, 2284 2284 .ndo_set_vf_link_state = efx_sriov_set_vf_link_state, 2285 + .ndo_get_phys_port_id = efx_sriov_get_phys_port_id, 2285 2286 #endif 2286 2287 #ifdef CONFIG_NET_POLL_CONTROLLER 2287 2288 .ndo_poll_controller = efx_netpoll,
+2
drivers/net/ethernet/sfc/net_driver.h
··· 1350 1350 struct ifla_vf_info *ivi); 1351 1351 int (*sriov_set_vf_link_state)(struct efx_nic *efx, int vf_i, 1352 1352 int link_state); 1353 + int (*sriov_get_phys_port_id)(struct efx_nic *efx, 1354 + struct netdev_phys_item_id *ppid); 1353 1355 int (*vswitching_probe)(struct efx_nic *efx); 1354 1356 int (*vswitching_restore)(struct efx_nic *efx); 1355 1357 void (*vswitching_remove)(struct efx_nic *efx);
+1
drivers/net/ethernet/sfc/nic.h
··· 524 524 unsigned int vport_id; 525 525 bool must_probe_vswitching; 526 526 unsigned int pf_index; 527 + u8 port_id[ETH_ALEN]; 527 528 #ifdef CONFIG_SFC_SRIOV 528 529 unsigned int vf_index; 529 530 struct ef10_vf *vf;
+11
drivers/net/ethernet/sfc/sriov.c
··· 70 70 else 71 71 return -EOPNOTSUPP; 72 72 } 73 + 74 + int efx_sriov_get_phys_port_id(struct net_device *net_dev, 75 + struct netdev_phys_item_id *ppid) 76 + { 77 + struct efx_nic *efx = netdev_priv(net_dev); 78 + 79 + if (efx->type->sriov_get_phys_port_id) 80 + return efx->type->sriov_get_phys_port_id(efx, ppid); 81 + else 82 + return -EOPNOTSUPP; 83 + }
+2
drivers/net/ethernet/sfc/sriov.h
··· 23 23 struct ifla_vf_info *ivi); 24 24 int efx_sriov_set_vf_link_state(struct net_device *net_dev, int vf_i, 25 25 int link_state); 26 + int efx_sriov_get_phys_port_id(struct net_device *net_dev, 27 + struct netdev_phys_item_id *ppid); 26 28 27 29 #endif /* CONFIG_SFC_SRIOV */ 28 30