diff options
author | Sathya Perla <sathyap@serverengines.com> | 2009-07-27 18:52:23 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-08-02 02:06:26 -0400 |
commit | eec368fb3ce3ee9e7bb042bbafb03f297d96e55e (patch) | |
tree | 1aa525ff817ea1cbcc6c95bc5beb1d01d38b1e26 /drivers/net | |
parent | 8788fdc2a53cf012a43808877eaa6ac7e3c923b4 (diff) |
be2net: remove pci_func field from be_adapter struct
pci function is available as PCI_FUNC(pdev->devfn); no need for a
separate field.
Signed-off-by: Sathya Perla <sathyap@serverengines.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/benet/be.h | 6 | ||||
-rw-r--r-- | drivers/net/benet/be_cmds.c | 8 | ||||
-rw-r--r-- | drivers/net/benet/be_hw.h | 3 | ||||
-rw-r--r-- | drivers/net/benet/be_main.c | 8 |
4 files changed, 11 insertions, 14 deletions
diff --git a/drivers/net/benet/be.h b/drivers/net/benet/be.h index d8a157f8caf4..beb131399231 100644 --- a/drivers/net/benet/be.h +++ b/drivers/net/benet/be.h | |||
@@ -213,7 +213,6 @@ struct be_adapter { | |||
213 | u8 __iomem *csr; | 213 | u8 __iomem *csr; |
214 | u8 __iomem *db; /* Door Bell */ | 214 | u8 __iomem *db; /* Door Bell */ |
215 | u8 __iomem *pcicfg; /* PCI config space */ | 215 | u8 __iomem *pcicfg; /* PCI config space */ |
216 | int pci_func; | ||
217 | 216 | ||
218 | spinlock_t mbox_lock; /* For serializing mbox cmds to BE card */ | 217 | spinlock_t mbox_lock; /* For serializing mbox cmds to BE card */ |
219 | struct be_dma_mem mbox_mem; | 218 | struct be_dma_mem mbox_mem; |
@@ -264,6 +263,11 @@ extern struct ethtool_ops be_ethtool_ops; | |||
264 | 263 | ||
265 | #define drvr_stats(adapter) (&adapter->stats.drvr_stats) | 264 | #define drvr_stats(adapter) (&adapter->stats.drvr_stats) |
266 | 265 | ||
266 | static inline unsigned int be_pci_func(struct be_adapter *adapter) | ||
267 | { | ||
268 | return PCI_FUNC(adapter->pdev->devfn); | ||
269 | } | ||
270 | |||
267 | #define BE_SET_NETDEV_OPS(netdev, ops) (netdev->netdev_ops = ops) | 271 | #define BE_SET_NETDEV_OPS(netdev, ops) (netdev->netdev_ops = ops) |
268 | 272 | ||
269 | #define PAGE_SHIFT_4K 12 | 273 | #define PAGE_SHIFT_4K 12 |
diff --git a/drivers/net/benet/be_cmds.c b/drivers/net/benet/be_cmds.c index 20278b9d5edb..daa2fe82b64a 100644 --- a/drivers/net/benet/be_cmds.c +++ b/drivers/net/benet/be_cmds.c | |||
@@ -388,7 +388,7 @@ int be_cmd_eq_create(struct be_adapter *adapter, | |||
388 | req->num_pages = cpu_to_le16(PAGES_4K_SPANNED(q_mem->va, q_mem->size)); | 388 | req->num_pages = cpu_to_le16(PAGES_4K_SPANNED(q_mem->va, q_mem->size)); |
389 | 389 | ||
390 | AMAP_SET_BITS(struct amap_eq_context, func, req->context, | 390 | AMAP_SET_BITS(struct amap_eq_context, func, req->context, |
391 | adapter->pci_func); | 391 | be_pci_func(adapter)); |
392 | AMAP_SET_BITS(struct amap_eq_context, valid, req->context, 1); | 392 | AMAP_SET_BITS(struct amap_eq_context, valid, req->context, 1); |
393 | /* 4byte eqe*/ | 393 | /* 4byte eqe*/ |
394 | AMAP_SET_BITS(struct amap_eq_context, size, req->context, 0); | 394 | AMAP_SET_BITS(struct amap_eq_context, size, req->context, 0); |
@@ -522,7 +522,7 @@ int be_cmd_cq_create(struct be_adapter *adapter, | |||
522 | AMAP_SET_BITS(struct amap_cq_context, eventable, ctxt, 1); | 522 | AMAP_SET_BITS(struct amap_cq_context, eventable, ctxt, 1); |
523 | AMAP_SET_BITS(struct amap_cq_context, eqid, ctxt, eq->id); | 523 | AMAP_SET_BITS(struct amap_cq_context, eqid, ctxt, eq->id); |
524 | AMAP_SET_BITS(struct amap_cq_context, armed, ctxt, 1); | 524 | AMAP_SET_BITS(struct amap_cq_context, armed, ctxt, 1); |
525 | AMAP_SET_BITS(struct amap_cq_context, func, ctxt, adapter->pci_func); | 525 | AMAP_SET_BITS(struct amap_cq_context, func, ctxt, be_pci_func(adapter)); |
526 | be_dws_cpu_to_le(ctxt, sizeof(req->context)); | 526 | be_dws_cpu_to_le(ctxt, sizeof(req->context)); |
527 | 527 | ||
528 | be_cmd_page_addrs_prepare(req->pages, ARRAY_SIZE(req->pages), q_mem); | 528 | be_cmd_page_addrs_prepare(req->pages, ARRAY_SIZE(req->pages), q_mem); |
@@ -565,7 +565,7 @@ int be_cmd_mccq_create(struct be_adapter *adapter, | |||
565 | 565 | ||
566 | req->num_pages = PAGES_4K_SPANNED(q_mem->va, q_mem->size); | 566 | req->num_pages = PAGES_4K_SPANNED(q_mem->va, q_mem->size); |
567 | 567 | ||
568 | AMAP_SET_BITS(struct amap_mcc_context, fid, ctxt, adapter->pci_func); | 568 | AMAP_SET_BITS(struct amap_mcc_context, fid, ctxt, be_pci_func(adapter)); |
569 | AMAP_SET_BITS(struct amap_mcc_context, valid, ctxt, 1); | 569 | AMAP_SET_BITS(struct amap_mcc_context, valid, ctxt, 1); |
570 | AMAP_SET_BITS(struct amap_mcc_context, ring_size, ctxt, | 570 | AMAP_SET_BITS(struct amap_mcc_context, ring_size, ctxt, |
571 | be_encoded_q_len(mccq->len)); | 571 | be_encoded_q_len(mccq->len)); |
@@ -614,7 +614,7 @@ int be_cmd_txq_create(struct be_adapter *adapter, | |||
614 | len_encoded = 0; | 614 | len_encoded = 0; |
615 | AMAP_SET_BITS(struct amap_tx_context, tx_ring_size, ctxt, len_encoded); | 615 | AMAP_SET_BITS(struct amap_tx_context, tx_ring_size, ctxt, len_encoded); |
616 | AMAP_SET_BITS(struct amap_tx_context, pci_func_id, ctxt, | 616 | AMAP_SET_BITS(struct amap_tx_context, pci_func_id, ctxt, |
617 | adapter->pci_func); | 617 | be_pci_func(adapter)); |
618 | AMAP_SET_BITS(struct amap_tx_context, ctx_valid, ctxt, 1); | 618 | AMAP_SET_BITS(struct amap_tx_context, ctx_valid, ctxt, 1); |
619 | AMAP_SET_BITS(struct amap_tx_context, cq_id_send, ctxt, cq->id); | 619 | AMAP_SET_BITS(struct amap_tx_context, cq_id_send, ctxt, cq->id); |
620 | 620 | ||
diff --git a/drivers/net/benet/be_hw.h b/drivers/net/benet/be_hw.h index 29c33c709c6d..d28f0c679bc8 100644 --- a/drivers/net/benet/be_hw.h +++ b/drivers/net/benet/be_hw.h | |||
@@ -51,9 +51,6 @@ | |||
51 | * with the OS. | 51 | * with the OS. |
52 | */ | 52 | */ |
53 | #define MEMBAR_CTRL_INT_CTRL_HOSTINTR_MASK (1 << 29) /* bit 29 */ | 53 | #define MEMBAR_CTRL_INT_CTRL_HOSTINTR_MASK (1 << 29) /* bit 29 */ |
54 | /* PCI physical function number */ | ||
55 | #define MEMBAR_CTRL_INT_CTRL_PFUNC_MASK 0x7 /* bits 26 - 28 */ | ||
56 | #define MEMBAR_CTRL_INT_CTRL_PFUNC_SHIFT 26 | ||
57 | 54 | ||
58 | /********* ISR0 Register offset **********/ | 55 | /********* ISR0 Register offset **********/ |
59 | #define CEV_ISR0_OFFSET 0xC18 | 56 | #define CEV_ISR0_OFFSET 0xC18 |
diff --git a/drivers/net/benet/be_main.c b/drivers/net/benet/be_main.c index da5341f10384..9c8654d9c508 100644 --- a/drivers/net/benet/be_main.c +++ b/drivers/net/benet/be_main.c | |||
@@ -1279,7 +1279,7 @@ static irqreturn_t be_intx(int irq, void *dev) | |||
1279 | int isr; | 1279 | int isr; |
1280 | 1280 | ||
1281 | isr = ioread32(adapter->csr + CEV_ISR0_OFFSET + | 1281 | isr = ioread32(adapter->csr + CEV_ISR0_OFFSET + |
1282 | adapter->pci_func * CEV_ISR_SIZE); | 1282 | be_pci_func(adapter) * CEV_ISR_SIZE); |
1283 | if (!isr) | 1283 | if (!isr) |
1284 | return IRQ_NONE; | 1284 | return IRQ_NONE; |
1285 | 1285 | ||
@@ -1446,7 +1446,7 @@ static void be_msix_enable(struct be_adapter *adapter) | |||
1446 | 1446 | ||
1447 | static inline int be_msix_vec_get(struct be_adapter *adapter, u32 eq_id) | 1447 | static inline int be_msix_vec_get(struct be_adapter *adapter, u32 eq_id) |
1448 | { | 1448 | { |
1449 | return adapter->msix_entries[eq_id - 8 * adapter->pci_func].vector; | 1449 | return adapter->msix_entries[eq_id - 8 * be_pci_func(adapter)].vector; |
1450 | } | 1450 | } |
1451 | 1451 | ||
1452 | static int be_msix_register(struct be_adapter *adapter) | 1452 | static int be_msix_register(struct be_adapter *adapter) |
@@ -1743,7 +1743,6 @@ static int be_ctrl_init(struct be_adapter *adapter) | |||
1743 | struct be_dma_mem *mbox_mem_alloc = &adapter->mbox_mem_alloced; | 1743 | struct be_dma_mem *mbox_mem_alloc = &adapter->mbox_mem_alloced; |
1744 | struct be_dma_mem *mbox_mem_align = &adapter->mbox_mem; | 1744 | struct be_dma_mem *mbox_mem_align = &adapter->mbox_mem; |
1745 | int status; | 1745 | int status; |
1746 | u32 val; | ||
1747 | 1746 | ||
1748 | status = be_map_pci_bars(adapter); | 1747 | status = be_map_pci_bars(adapter); |
1749 | if (status) | 1748 | if (status) |
@@ -1764,9 +1763,6 @@ static int be_ctrl_init(struct be_adapter *adapter) | |||
1764 | spin_lock_init(&adapter->mcc_lock); | 1763 | spin_lock_init(&adapter->mcc_lock); |
1765 | spin_lock_init(&adapter->mcc_cq_lock); | 1764 | spin_lock_init(&adapter->mcc_cq_lock); |
1766 | 1765 | ||
1767 | val = ioread32(adapter->pcicfg + PCICFG_MEMBAR_CTRL_INT_CTRL_OFFSET); | ||
1768 | adapter->pci_func = (val >> MEMBAR_CTRL_INT_CTRL_PFUNC_SHIFT) & | ||
1769 | MEMBAR_CTRL_INT_CTRL_PFUNC_MASK; | ||
1770 | return 0; | 1766 | return 0; |
1771 | } | 1767 | } |
1772 | 1768 | ||