Commit 168c478e authored by Jakub Kicinski's avatar Jakub Kicinski Committed by David S. Miller

nfp: wire get_phys_port_name on representors

Make nfp_port_get_phys_port_name() support new port types and
wire it up to representors' struct net_device_ops.
Signed-off-by: default avatarJakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: default avatarSimon Horman <simon.horman@netronome.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 39ae7eb6
...@@ -256,6 +256,7 @@ const struct net_device_ops nfp_repr_netdev_ops = { ...@@ -256,6 +256,7 @@ const struct net_device_ops nfp_repr_netdev_ops = {
.ndo_get_stats64 = nfp_repr_get_stats64, .ndo_get_stats64 = nfp_repr_get_stats64,
.ndo_has_offload_stats = nfp_repr_has_offload_stats, .ndo_has_offload_stats = nfp_repr_has_offload_stats,
.ndo_get_offload_stats = nfp_repr_get_offload_stats, .ndo_get_offload_stats = nfp_repr_get_offload_stats,
.ndo_get_phys_port_name = nfp_port_get_phys_port_name,
}; };
static void nfp_repr_clean(struct nfp_repr *repr) static void nfp_repr_clean(struct nfp_repr *repr)
......
...@@ -106,6 +106,11 @@ nfp_port_get_phys_port_name(struct net_device *netdev, char *name, size_t len) ...@@ -106,6 +106,11 @@ nfp_port_get_phys_port_name(struct net_device *netdev, char *name, size_t len)
int n; int n;
port = nfp_port_from_netdev(netdev); port = nfp_port_from_netdev(netdev);
if (!port)
return -EOPNOTSUPP;
switch (port->type) {
case NFP_PORT_PHYS_PORT:
eth_port = __nfp_port_get_eth_port(port); eth_port = __nfp_port_get_eth_port(port);
if (!eth_port) if (!eth_port)
return -EOPNOTSUPP; return -EOPNOTSUPP;
...@@ -115,6 +120,17 @@ nfp_port_get_phys_port_name(struct net_device *netdev, char *name, size_t len) ...@@ -115,6 +120,17 @@ nfp_port_get_phys_port_name(struct net_device *netdev, char *name, size_t len)
else else
n = snprintf(name, len, "p%ds%d", eth_port->label_port, n = snprintf(name, len, "p%ds%d", eth_port->label_port,
eth_port->label_subport); eth_port->label_subport);
break;
case NFP_PORT_PF_PORT:
n = snprintf(name, len, "pf%d", port->pf_id);
break;
case NFP_PORT_VF_PORT:
n = snprintf(name, len, "pf%dvf%d", port->pf_id, port->vf_id);
break;
default:
return -EOPNOTSUPP;
}
if (n >= len) if (n >= len)
return -EINVAL; return -EINVAL;
......
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