[PATCH net-next] liquidio: Added ndo_get_phys_port_id support

Subsystems: cavium liquidio network driver, networking drivers, the rest

STALE3153d REVIEWED: 1 (0M)

1 review trailer.

2 messages, 2 authors, 2018-03-05 · open the first message on its own page

[PATCH net-next] liquidio: Added ndo_get_phys_port_id support

From: Felix Manlunas <hidden>
Date: 2018-03-03 02:59:19

From: Intiyaz Basha <redacted>

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

Signed-off-by: Intiyaz Basha <redacted>
Acked-by: Derek Chickles <redacted>
Signed-off-by: Felix Manlunas <redacted>
---
 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(+)
diff --git a/drivers/net/ethernet/cavium/liquidio/lio_core.c b/drivers/net/ethernet/cavium/liquidio/lio_core.c
index 8b1ee83..8bb4cfb 100644
--- a/drivers/net/ethernet/cavium/liquidio/lio_core.c
+++ b/drivers/net/ethernet/cavium/liquidio/lio_core.c
@@ -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;
+}
diff --git a/drivers/net/ethernet/cavium/liquidio/lio_main.c b/drivers/net/ethernet/cavium/liquidio/lio_main.c
index a5eecd8..e376b9d 100644
--- a/drivers/net/ethernet/cavium/liquidio/lio_main.c
+++ b/drivers/net/ethernet/cavium/liquidio/lio_main.c
@@ -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
diff --git a/drivers/net/ethernet/cavium/liquidio/lio_vf_main.c b/drivers/net/ethernet/cavium/liquidio/lio_vf_main.c
index fd70a48..dbff977 100644
--- a/drivers/net/ethernet/cavium/liquidio/lio_vf_main.c
+++ b/drivers/net/ethernet/cavium/liquidio/lio_vf_main.c
@@ -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)
diff --git a/drivers/net/ethernet/cavium/liquidio/octeon_network.h b/drivers/net/ethernet/cavium/liquidio/octeon_network.h
index f2d1a07..ea7536f 100644
--- a/drivers/net/ethernet/cavium/liquidio/octeon_network.h
+++ b/drivers/net/ethernet/cavium/liquidio/octeon_network.h
@@ -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)
 

Re: [PATCH net-next] liquidio: Added ndo_get_phys_port_id support

From: David Miller <davem@davemloft.net>
Date: 2018-03-05 15:23:41

From: Felix Manlunas <redacted>
Date: Fri, 2 Mar 2018 18:59:10 -0800
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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help