diff options
author | Edward Cree <ecree@solarflare.com> | 2020-07-27 13:05:48 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2020-07-27 12:26:56 -0700 |
commit | 1c74884387e5b6d599316eff7d51d484b3f6dcca (patch) | |
tree | 41972f84d4cce12a25e08ece02940a5c5d060f58 | |
parent | 29ec1b27e73990cf32aedd9208aa6eff2d4a1e5e (diff) |
sfc_ef100: implement ndo_get_phys_port_{id,name}
Signed-off-by: Edward Cree <ecree@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/ethernet/sfc/ef100_netdev.c | 2 | ||||
-rw-r--r-- | drivers/net/ethernet/sfc/ef100_nic.c | 21 |
2 files changed, 23 insertions, 0 deletions
diff --git a/drivers/net/ethernet/sfc/ef100_netdev.c b/drivers/net/ethernet/sfc/ef100_netdev.c index d1753ed7aaca..4c3caac2c8cc 100644 --- a/drivers/net/ethernet/sfc/ef100_netdev.c +++ b/drivers/net/ethernet/sfc/ef100_netdev.c @@ -208,6 +208,8 @@ static const struct net_device_ops ef100_netdev_ops = { .ndo_open = ef100_net_open, .ndo_stop = ef100_net_stop, .ndo_start_xmit = ef100_hard_start_xmit, + .ndo_get_phys_port_id = efx_get_phys_port_id, + .ndo_get_phys_port_name = efx_get_phys_port_name, }; /* Netdev registration diff --git a/drivers/net/ethernet/sfc/ef100_nic.c b/drivers/net/ethernet/sfc/ef100_nic.c index 1161190391b1..6a00f2a2dc2b 100644 --- a/drivers/net/ethernet/sfc/ef100_nic.c +++ b/drivers/net/ethernet/sfc/ef100_nic.c @@ -403,6 +403,20 @@ static int ef100_reset(struct efx_nic *efx, enum reset_type reset_type) return rc; } +static int efx_ef100_get_phys_port_id(struct efx_nic *efx, + struct netdev_phys_item_id *ppid) +{ + struct ef100_nic_data *nic_data = efx->nic_data; + + if (!is_valid_ether_addr(nic_data->port_id)) + return -EOPNOTSUPP; + + ppid->id_len = ETH_ALEN; + memcpy(ppid->id, nic_data->port_id, ppid->id_len); + + return 0; +} + static unsigned int ef100_check_caps(const struct efx_nic *efx, u8 flag, u32 offset) { @@ -459,6 +473,8 @@ const struct efx_nic_type ef100_pf_nic_type = { .rx_write = ef100_rx_write, .rx_packet = __ef100_rx_packet, + .get_phys_port_id = efx_ef100_get_phys_port_id, + .reconfigure_mac = ef100_reconfigure_mac, /* Per-type bar/size configuration not used on ef100. Location of @@ -541,6 +557,11 @@ static int ef100_probe_main(struct efx_nic *efx) efx->max_vis = EF100_MAX_VIS; + rc = efx_mcdi_port_get_number(efx); + if (rc < 0) + goto fail; + efx->port_num = rc; + rc = ef100_phy_probe(efx); if (rc) goto fail; |