diff options
author | David Daney <david.daney@cavium.com> | 2015-10-23 20:14:09 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-10-25 21:13:00 -0400 |
commit | 88ed237720bd618240439714a57fb69ea96428e7 (patch) | |
tree | 7aa87a94dbbe8510a17f1db7d7f43034ff224f32 | |
parent | 4e85777ff071b51f500b130b6d036922af32be25 (diff) |
net: thunderx: Rewrite silicon revision tests.
The test for pass-1 silicon was incorrect, it should be for all
revisions less than 8. Also the revision is already present in the
pci_dev, so there is no need to read and keep a private copy.
Remove rev_id and code to read it from struct nicpf. Create new
static inline function pass1_silicon() to be used to testing the
silicon version. Use pass1_silicon() for revision checks, this will
be more widely used in follow on patches.
Signed-off-by: David Daney <david.daney@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/ethernet/cavium/thunder/nic_main.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/net/ethernet/cavium/thunder/nic_main.c b/drivers/net/ethernet/cavium/thunder/nic_main.c index d6e3219ddeb3..52e1acb69562 100644 --- a/drivers/net/ethernet/cavium/thunder/nic_main.c +++ b/drivers/net/ethernet/cavium/thunder/nic_main.c | |||
@@ -22,7 +22,6 @@ | |||
22 | 22 | ||
23 | struct nicpf { | 23 | struct nicpf { |
24 | struct pci_dev *pdev; | 24 | struct pci_dev *pdev; |
25 | u8 rev_id; | ||
26 | u8 node; | 25 | u8 node; |
27 | unsigned int flags; | 26 | unsigned int flags; |
28 | u8 num_vf_en; /* No of VF enabled */ | 27 | u8 num_vf_en; /* No of VF enabled */ |
@@ -54,6 +53,11 @@ struct nicpf { | |||
54 | bool irq_allocated[NIC_PF_MSIX_VECTORS]; | 53 | bool irq_allocated[NIC_PF_MSIX_VECTORS]; |
55 | }; | 54 | }; |
56 | 55 | ||
56 | static inline bool pass1_silicon(struct nicpf *nic) | ||
57 | { | ||
58 | return nic->pdev->revision < 8; | ||
59 | } | ||
60 | |||
57 | /* Supported devices */ | 61 | /* Supported devices */ |
58 | static const struct pci_device_id nic_id_table[] = { | 62 | static const struct pci_device_id nic_id_table[] = { |
59 | { PCI_DEVICE(PCI_VENDOR_ID_CAVIUM, PCI_DEVICE_ID_THUNDER_NIC_PF) }, | 63 | { PCI_DEVICE(PCI_VENDOR_ID_CAVIUM, PCI_DEVICE_ID_THUNDER_NIC_PF) }, |
@@ -117,7 +121,7 @@ static void nic_send_msg_to_vf(struct nicpf *nic, int vf, union nic_mbx *mbx) | |||
117 | * when PF writes to MBOX(1), in next revisions when | 121 | * when PF writes to MBOX(1), in next revisions when |
118 | * PF writes to MBOX(0) | 122 | * PF writes to MBOX(0) |
119 | */ | 123 | */ |
120 | if (nic->rev_id == 0) { | 124 | if (pass1_silicon(nic)) { |
121 | /* see the comment for nic_reg_write()/nic_reg_read() | 125 | /* see the comment for nic_reg_write()/nic_reg_read() |
122 | * functions above | 126 | * functions above |
123 | */ | 127 | */ |
@@ -998,8 +1002,6 @@ static int nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
998 | goto err_release_regions; | 1002 | goto err_release_regions; |
999 | } | 1003 | } |
1000 | 1004 | ||
1001 | pci_read_config_byte(pdev, PCI_REVISION_ID, &nic->rev_id); | ||
1002 | |||
1003 | nic->node = nic_get_node_id(pdev); | 1005 | nic->node = nic_get_node_id(pdev); |
1004 | 1006 | ||
1005 | nic_set_lmac_vf_mapping(nic); | 1007 | nic_set_lmac_vf_mapping(nic); |