Commit 5bd36a6f authored by David S. Miller's avatar David S. Miller

Merge branch 'sfc-physical-port-ids'

Edward Cree says:

====================
sfc: physical port ids

This series brings our handling of ndo_get_phys_port_id and related
interfaces into line with the behaviour of other drivers.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 79f664ed 0d71a84c
...@@ -547,7 +547,6 @@ static DEVICE_ATTR(primary_flag, 0444, efx_ef10_show_primary_flag, NULL); ...@@ -547,7 +547,6 @@ static DEVICE_ATTR(primary_flag, 0444, efx_ef10_show_primary_flag, NULL);
static int efx_ef10_probe(struct efx_nic *efx) static int efx_ef10_probe(struct efx_nic *efx)
{ {
struct efx_ef10_nic_data *nic_data; struct efx_ef10_nic_data *nic_data;
struct net_device *net_dev = efx->net_dev;
int i, rc; int i, rc;
/* We can have one VI for each 8K region. However, until we /* We can have one VI for each 8K region. However, until we
...@@ -637,7 +636,6 @@ static int efx_ef10_probe(struct efx_nic *efx) ...@@ -637,7 +636,6 @@ static int efx_ef10_probe(struct efx_nic *efx)
if (rc < 0) if (rc < 0)
goto fail5; goto fail5;
efx->port_num = rc; efx->port_num = rc;
net_dev->dev_port = rc;
rc = efx->type->get_mac_address(efx, efx->net_dev->perm_addr); rc = efx->type->get_mac_address(efx, efx->net_dev->perm_addr);
if (rc) if (rc)
...@@ -5540,6 +5538,20 @@ static int efx_ef10_ptp_set_ts_config(struct efx_nic *efx, ...@@ -5540,6 +5538,20 @@ static int efx_ef10_ptp_set_ts_config(struct efx_nic *efx,
} }
} }
static int efx_ef10_get_phys_port_id(struct efx_nic *efx,
struct netdev_phys_item_id *ppid)
{
struct efx_ef10_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 int efx_ef10_vlan_rx_add_vid(struct efx_nic *efx, __be16 proto, u16 vid) static int efx_ef10_vlan_rx_add_vid(struct efx_nic *efx, __be16 proto, u16 vid)
{ {
if (proto != htons(ETH_P_8021Q)) if (proto != htons(ETH_P_8021Q))
...@@ -5647,11 +5659,11 @@ const struct efx_nic_type efx_hunt_a0_vf_nic_type = { ...@@ -5647,11 +5659,11 @@ const struct efx_nic_type efx_hunt_a0_vf_nic_type = {
.vswitching_probe = efx_ef10_vswitching_probe_vf, .vswitching_probe = efx_ef10_vswitching_probe_vf,
.vswitching_restore = efx_ef10_vswitching_restore_vf, .vswitching_restore = efx_ef10_vswitching_restore_vf,
.vswitching_remove = efx_ef10_vswitching_remove_vf, .vswitching_remove = efx_ef10_vswitching_remove_vf,
.sriov_get_phys_port_id = efx_ef10_sriov_get_phys_port_id,
#endif #endif
.get_mac_address = efx_ef10_get_mac_address_vf, .get_mac_address = efx_ef10_get_mac_address_vf,
.set_mac_address = efx_ef10_set_mac_address, .set_mac_address = efx_ef10_set_mac_address,
.get_phys_port_id = efx_ef10_get_phys_port_id,
.revision = EFX_REV_HUNT_A0, .revision = EFX_REV_HUNT_A0,
.max_dma_mask = DMA_BIT_MASK(ESF_DZ_TX_KER_BUF_ADDR_WIDTH), .max_dma_mask = DMA_BIT_MASK(ESF_DZ_TX_KER_BUF_ADDR_WIDTH),
.rx_prefix_size = ES_DZ_RX_PREFIX_SIZE, .rx_prefix_size = ES_DZ_RX_PREFIX_SIZE,
...@@ -5776,6 +5788,7 @@ const struct efx_nic_type efx_hunt_a0_nic_type = { ...@@ -5776,6 +5788,7 @@ const struct efx_nic_type efx_hunt_a0_nic_type = {
.set_mac_address = efx_ef10_set_mac_address, .set_mac_address = efx_ef10_set_mac_address,
.tso_versions = efx_ef10_tso_versions, .tso_versions = efx_ef10_tso_versions,
.get_phys_port_id = efx_ef10_get_phys_port_id,
.revision = EFX_REV_HUNT_A0, .revision = EFX_REV_HUNT_A0,
.max_dma_mask = DMA_BIT_MASK(ESF_DZ_TX_KER_BUF_ADDR_WIDTH), .max_dma_mask = DMA_BIT_MASK(ESF_DZ_TX_KER_BUF_ADDR_WIDTH),
.rx_prefix_size = ES_DZ_RX_PREFIX_SIZE, .rx_prefix_size = ES_DZ_RX_PREFIX_SIZE,
......
...@@ -760,17 +760,3 @@ int efx_ef10_sriov_get_vf_config(struct efx_nic *efx, int vf_i, ...@@ -760,17 +760,3 @@ int efx_ef10_sriov_get_vf_config(struct efx_nic *efx, int vf_i,
return 0; return 0;
} }
int efx_ef10_sriov_get_phys_port_id(struct efx_nic *efx,
struct netdev_phys_item_id *ppid)
{
struct efx_ef10_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;
}
...@@ -56,9 +56,6 @@ int efx_ef10_sriov_get_vf_config(struct efx_nic *efx, int vf_i, ...@@ -56,9 +56,6 @@ int efx_ef10_sriov_get_vf_config(struct efx_nic *efx, int vf_i,
int efx_ef10_sriov_set_vf_link_state(struct efx_nic *efx, int vf_i, int efx_ef10_sriov_set_vf_link_state(struct efx_nic *efx, int vf_i,
int link_state); int link_state);
int efx_ef10_sriov_get_phys_port_id(struct efx_nic *efx,
struct netdev_phys_item_id *ppid);
int efx_ef10_vswitching_probe_pf(struct efx_nic *efx); int efx_ef10_vswitching_probe_pf(struct efx_nic *efx);
int efx_ef10_vswitching_probe_vf(struct efx_nic *efx); int efx_ef10_vswitching_probe_vf(struct efx_nic *efx);
int efx_ef10_vswitching_restore_pf(struct efx_nic *efx); int efx_ef10_vswitching_restore_pf(struct efx_nic *efx);
......
...@@ -2334,6 +2334,27 @@ static int efx_set_features(struct net_device *net_dev, netdev_features_t data) ...@@ -2334,6 +2334,27 @@ static int efx_set_features(struct net_device *net_dev, netdev_features_t data)
return 0; return 0;
} }
int efx_get_phys_port_id(struct net_device *net_dev,
struct netdev_phys_item_id *ppid)
{
struct efx_nic *efx = netdev_priv(net_dev);
if (efx->type->get_phys_port_id)
return efx->type->get_phys_port_id(efx, ppid);
else
return -EOPNOTSUPP;
}
static int efx_get_phys_port_name(struct net_device *net_dev,
char *name, size_t len)
{
struct efx_nic *efx = netdev_priv(net_dev);
if (snprintf(name, len, "p%u", efx->port_num) >= len)
return -EINVAL;
return 0;
}
static int efx_vlan_rx_add_vid(struct net_device *net_dev, __be16 proto, u16 vid) static int efx_vlan_rx_add_vid(struct net_device *net_dev, __be16 proto, u16 vid)
{ {
struct efx_nic *efx = netdev_priv(net_dev); struct efx_nic *efx = netdev_priv(net_dev);
...@@ -2374,8 +2395,9 @@ static const struct net_device_ops efx_netdev_ops = { ...@@ -2374,8 +2395,9 @@ static const struct net_device_ops efx_netdev_ops = {
.ndo_set_vf_spoofchk = efx_sriov_set_vf_spoofchk, .ndo_set_vf_spoofchk = efx_sriov_set_vf_spoofchk,
.ndo_get_vf_config = efx_sriov_get_vf_config, .ndo_get_vf_config = efx_sriov_get_vf_config,
.ndo_set_vf_link_state = efx_sriov_set_vf_link_state, .ndo_set_vf_link_state = efx_sriov_set_vf_link_state,
.ndo_get_phys_port_id = efx_sriov_get_phys_port_id,
#endif #endif
.ndo_get_phys_port_id = efx_get_phys_port_id,
.ndo_get_phys_port_name = efx_get_phys_port_name,
#ifdef CONFIG_NET_POLL_CONTROLLER #ifdef CONFIG_NET_POLL_CONTROLLER
.ndo_poll_controller = efx_netpoll, .ndo_poll_controller = efx_netpoll,
#endif #endif
......
...@@ -1220,6 +1220,7 @@ struct efx_mtd_partition { ...@@ -1220,6 +1220,7 @@ struct efx_mtd_partition {
* @ptp_set_ts_config: Set hardware timestamp configuration. The flags * @ptp_set_ts_config: Set hardware timestamp configuration. The flags
* and tx_type will already have been validated but this operation * and tx_type will already have been validated but this operation
* must validate and update rx_filter. * must validate and update rx_filter.
* @get_phys_port_id: Get the underlying physical port id.
* @set_mac_address: Set the MAC address of the device * @set_mac_address: Set the MAC address of the device
* @tso_versions: Returns mask of firmware-assisted TSO versions supported. * @tso_versions: Returns mask of firmware-assisted TSO versions supported.
* If %NULL, then device does not support any TSO version. * If %NULL, then device does not support any TSO version.
...@@ -1358,6 +1359,8 @@ struct efx_nic_type { ...@@ -1358,6 +1359,8 @@ struct efx_nic_type {
int (*sriov_configure)(struct efx_nic *efx, int num_vfs); int (*sriov_configure)(struct efx_nic *efx, int num_vfs);
int (*vlan_rx_add_vid)(struct efx_nic *efx, __be16 proto, u16 vid); int (*vlan_rx_add_vid)(struct efx_nic *efx, __be16 proto, u16 vid);
int (*vlan_rx_kill_vid)(struct efx_nic *efx, __be16 proto, u16 vid); int (*vlan_rx_kill_vid)(struct efx_nic *efx, __be16 proto, u16 vid);
int (*get_phys_port_id)(struct efx_nic *efx,
struct netdev_phys_item_id *ppid);
int (*sriov_init)(struct efx_nic *efx); int (*sriov_init)(struct efx_nic *efx);
void (*sriov_fini)(struct efx_nic *efx); void (*sriov_fini)(struct efx_nic *efx);
bool (*sriov_wanted)(struct efx_nic *efx); bool (*sriov_wanted)(struct efx_nic *efx);
...@@ -1372,8 +1375,6 @@ struct efx_nic_type { ...@@ -1372,8 +1375,6 @@ struct efx_nic_type {
struct ifla_vf_info *ivi); struct ifla_vf_info *ivi);
int (*sriov_set_vf_link_state)(struct efx_nic *efx, int vf_i, int (*sriov_set_vf_link_state)(struct efx_nic *efx, int vf_i,
int link_state); int link_state);
int (*sriov_get_phys_port_id)(struct efx_nic *efx,
struct netdev_phys_item_id *ppid);
int (*vswitching_probe)(struct efx_nic *efx); int (*vswitching_probe)(struct efx_nic *efx);
int (*vswitching_restore)(struct efx_nic *efx); int (*vswitching_restore)(struct efx_nic *efx);
void (*vswitching_remove)(struct efx_nic *efx); void (*vswitching_remove)(struct efx_nic *efx);
......
...@@ -73,14 +73,3 @@ int efx_sriov_set_vf_link_state(struct net_device *net_dev, int vf_i, ...@@ -73,14 +73,3 @@ int efx_sriov_set_vf_link_state(struct net_device *net_dev, int vf_i,
else else
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
int efx_sriov_get_phys_port_id(struct net_device *net_dev,
struct netdev_phys_item_id *ppid)
{
struct efx_nic *efx = netdev_priv(net_dev);
if (efx->type->sriov_get_phys_port_id)
return efx->type->sriov_get_phys_port_id(efx, ppid);
else
return -EOPNOTSUPP;
}
...@@ -23,9 +23,6 @@ int efx_sriov_get_vf_config(struct net_device *net_dev, int vf_i, ...@@ -23,9 +23,6 @@ int efx_sriov_get_vf_config(struct net_device *net_dev, int vf_i,
struct ifla_vf_info *ivi); struct ifla_vf_info *ivi);
int efx_sriov_set_vf_link_state(struct net_device *net_dev, int vf_i, int efx_sriov_set_vf_link_state(struct net_device *net_dev, int vf_i,
int link_state); int link_state);
int efx_sriov_get_phys_port_id(struct net_device *net_dev,
struct netdev_phys_item_id *ppid);
#endif /* CONFIG_SFC_SRIOV */ #endif /* CONFIG_SFC_SRIOV */
#endif /* EFX_SRIOV_H */ #endif /* EFX_SRIOV_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment