liquidio: Added ndo_get_phys_port_id support
Subsystems (3)
PATCH 1/1 liquidio: Added ndo_get_phys_port_id support
From: Intiyaz Basha <[email protected]>
Added support to the ndo_get_phys_port_id() callback to provide port specific unique id to the netdev layer.
Port id needs to be unique across different liquidio devices in the system. So used MAC address for port_id.
Usage: cat /sys/class/net/<interface>/phys_port_id
--- drivers/net/ethernet/cavium/liquidio/lio_core.c | 13 +++++++++++++ drivers/net/ethernet/cavium/liquidio/lio_main.c | 1 + drivers/net/ethernet/cavium/liquidio/lio_vf_main.c | 1 + drivers/net/ethernet/cavium/liquidio/octeon_network.h | 3 +++ 4 files changed, 18 insertions(+)
drivers/net/ethernet/cavium/liquidio/lio_core.c +13 -0
@@ -1081,3 +1081,16 @@ int octeon_setup_interrupt(struct octeon_device *oct, u32 num_ioqs) }return 0 ; } + +int liquidio_get_phys_port_id (struct net_device *netdev, +struct netdev_phys_item_id *ppid) +{ +struct lio *lio =GET_LIO (netdev); +u8 addr[ETH_ALEN ]; + +u64_to_ether_addr (be64_to_cpu (lio->linfo.hw_addr), addr); + ppid->id_len =ETH_ALEN ; +memcpy (ppid->id, addr, ppid->id_len); + +return 0 ; +}
drivers/net/ethernet/cavium/liquidio/lio_main.c +1 -0
@@ -3424,6 +3424,7 @@ static const struct net_device_ops lionetdevops = { .ndo_set_vf_vlan = liquidio_set_vf_vlan, .ndo_get_vf_config = liquidio_get_vf_config, .ndo_set_vf_link_state = liquidio_set_vf_link_state, + .ndo_get_phys_port_id = liquidio_get_phys_port_id, };/** \brief Entry point for the liquidio module
drivers/net/ethernet/cavium/liquidio/lio_vf_main.c +1 -0
@@ -2244,6 +2244,7 @@ static const struct net_device_ops lionetdevops = { .ndo_set_features = liquidio_set_features, .ndo_udp_tunnel_add = liquidio_add_vxlan_port, .ndo_udp_tunnel_del = liquidio_del_vxlan_port, + .ndo_get_phys_port_id = liquidio_get_phys_port_id, };static int lio_nic_info (struct octeon_recv_info *recv_info,void *buf)
drivers/net/ethernet/cavium/liquidio/octeon_network.h +3 -0
@@ -184,6 +184,9 @@ int octeon_setup_interrupt(struct octeon_device *oct, u32 num_ioqs);*/ void liquidio_set_ethtool_ops (struct net_device *netdev); +int liquidio_get_phys_port_id (struct net_device *netdev, +struct netdev_phys_item_id *ppid); +#define SKB_ADJ_MASK 0x3F#define SKB_ADJ (SKB_ADJ_MASK + 1)
David Miller
maintainerFrom: Felix Manlunas <[email protected]>
Date: Fri, 2 Mar 2018 18:59:10 -0800
Quoted 5 lines
Added support to the
ndo_get_phys_port_id()callback to provide port specific unique id to the netdev layer.Port id needs to be unique across different liquidio devices in the system. So used MAC address for
port_id.
This doesn't look right at all.
The physical port ID is used in order to distinguish several netdev devices present on the same PHYSICAL PORT.
So you should be using a number that is unique within a physical port.
Using the MAC address for this doesn't make any sense at all.