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>
This commit is contained in:

committed by
David S. Miller

parent
dda922c831
commit
d768b678a8
@@ -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);
|
||||
|
Reference in New Issue
Block a user