diff options
author | Robert Richter <rrichter@cavium.com> | 2015-06-02 21:00:18 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-06-02 22:49:26 +0300 |
commit | d768b678a8d9c572ad3c2c6ba71d9e7029b867a2 (patch) | |
tree | e8c5f6e3226756e0e69c1001bb8090f14e4ca22b /drivers/net/ethernet/cavium/thunder/nic.h | |
parent | dda922c831d1661c11a3ae1051b7160236f6ffb0 (diff) | |
download | linux-d768b678a8d9c572ad3c2c6ba71d9e7029b867a2.tar.xz |
net: thunderx: Cleanup duplicate NODE_ID macros, add nic_get_node_id()
There are duplicate NODE_ID macro definitions. Move all of them to
nic.h for usage in nic and bgx driver and introduce nic_get_node_id()
helper function.
This patch also fixes 64bit mask which should have been ULL by
reworking the node calculation.
Signed-off-by: Robert Richter <rrichter@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/cavium/thunder/nic.h')
-rw-r--r-- | drivers/net/ethernet/cavium/thunder/nic.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/net/ethernet/cavium/thunder/nic.h b/drivers/net/ethernet/cavium/thunder/nic.h index 9b0be527909b..4f426db54e42 100644 --- a/drivers/net/ethernet/cavium/thunder/nic.h +++ b/drivers/net/ethernet/cavium/thunder/nic.h @@ -11,6 +11,7 @@ #include <linux/netdevice.h> #include <linux/interrupt.h> +#include <linux/pci.h> #include "thunder_bgx.h" /* PCI device IDs */ @@ -398,6 +399,15 @@ union nic_mbx { struct bgx_link_status link_status; }; +#define NIC_NODE_ID_MASK 0x03 +#define NIC_NODE_ID_SHIFT 44 + +static inline int nic_get_node_id(struct pci_dev *pdev) +{ + u64 addr = pci_resource_start(pdev, PCI_CFG_REG_BAR_NUM); + return ((addr >> NIC_NODE_ID_SHIFT) & NIC_NODE_ID_MASK); +} + int nicvf_set_real_num_queues(struct net_device *netdev, int tx_queues, int rx_queues); int nicvf_open(struct net_device *netdev); |