nfp: reintroduce ndo_get_port_parent_id for representor ports

NFP does not register devlink ports for representors (without
the "devlink: expose PF and VF representors as ports" series
there are no port flavours to expose them as).

Commit c25f08ac65 ("nfp: remove ndo_get_port_parent_id implementation")
went to far in removing ndo_get_port_parent_id for representors.
This causes redirection offloads to fail, and switch_id attribute
missing.

Reintroduce the ndo_get_port_parent_id callback for representor ports.

Fixes: c25f08ac65 ("nfp: remove ndo_get_port_parent_id implementation")
Signed-off-by: Pieter Jansen van Vuuren <pieter.jansenvanvuuren@netronome.com>
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Pieter Jansen van Vuuren 2019-05-08 15:52:56 -07:00 committed by David S. Miller
parent 8dde14299e
commit 1e966763e2
2 changed files with 17 additions and 0 deletions

View File

@ -273,6 +273,7 @@ const struct net_device_ops nfp_repr_netdev_ops = {
.ndo_fix_features = nfp_repr_fix_features,
.ndo_set_features = nfp_port_set_features,
.ndo_set_mac_address = eth_mac_addr,
.ndo_get_port_parent_id = nfp_port_get_port_parent_id,
.ndo_get_devlink_port = nfp_devlink_get_devlink_port,
};

View File

@ -30,6 +30,22 @@ struct nfp_port *nfp_port_from_netdev(struct net_device *netdev)
return NULL;
}
int nfp_port_get_port_parent_id(struct net_device *netdev,
struct netdev_phys_item_id *ppid)
{
struct nfp_port *port;
const u8 *serial;
port = nfp_port_from_netdev(netdev);
if (!port)
return -EOPNOTSUPP;
ppid->id_len = nfp_cpp_serial(port->app->cpp, &serial);
memcpy(&ppid->id, serial, ppid->id_len);
return 0;
}
int nfp_port_setup_tc(struct net_device *netdev, enum tc_setup_type type,
void *type_data)
{