diff options
author | Ajit Khaparde <ajitkhaparde@gmail.com> | 2010-03-07 09:21:27 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-03-08 13:45:27 -0500 |
commit | 500ca9ba241304937c54c379e515b24400379353 (patch) | |
tree | 2a55bf6487ff8f366f361f0f91cabb31a4865a98 /drivers/net | |
parent | 6cce09f87a04797fae5b947ef2626c14a78f0b49 (diff) |
be2net: remove usage of be_pci_func
When PCI functions are virtuialized in applications by assigning PCI
functions to VM (PCI passthrough), the be2net driver in the VM sees a
different function number. So, use of PCI function number in any
calculation will break existing code. This patch takes care of it.
Signed-off-by: Ajit Khaparde <ajitk@serverengines.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/benet/be.h | 5 | ||||
-rw-r--r-- | drivers/net/benet/be_cmds.c | 6 | ||||
-rw-r--r-- | drivers/net/benet/be_main.c | 2 |
3 files changed, 1 insertions, 12 deletions
diff --git a/drivers/net/benet/be.h b/drivers/net/benet/be.h index be81fb2d10f7..8f0752553681 100644 --- a/drivers/net/benet/be.h +++ b/drivers/net/benet/be.h | |||
@@ -290,11 +290,6 @@ extern const struct ethtool_ops be_ethtool_ops; | |||
290 | 290 | ||
291 | #define drvr_stats(adapter) (&adapter->stats.drvr_stats) | 291 | #define drvr_stats(adapter) (&adapter->stats.drvr_stats) |
292 | 292 | ||
293 | static inline unsigned int be_pci_func(struct be_adapter *adapter) | ||
294 | { | ||
295 | return PCI_FUNC(adapter->pdev->devfn); | ||
296 | } | ||
297 | |||
298 | #define BE_SET_NETDEV_OPS(netdev, ops) (netdev->netdev_ops = ops) | 293 | #define BE_SET_NETDEV_OPS(netdev, ops) (netdev->netdev_ops = ops) |
299 | 294 | ||
300 | #define PAGE_SHIFT_4K 12 | 295 | #define PAGE_SHIFT_4K 12 |
diff --git a/drivers/net/benet/be_cmds.c b/drivers/net/benet/be_cmds.c index 4b1f80519ca4..c59215361f4e 100644 --- a/drivers/net/benet/be_cmds.c +++ b/drivers/net/benet/be_cmds.c | |||
@@ -465,8 +465,6 @@ int be_cmd_eq_create(struct be_adapter *adapter, | |||
465 | 465 | ||
466 | req->num_pages = cpu_to_le16(PAGES_4K_SPANNED(q_mem->va, q_mem->size)); | 466 | req->num_pages = cpu_to_le16(PAGES_4K_SPANNED(q_mem->va, q_mem->size)); |
467 | 467 | ||
468 | AMAP_SET_BITS(struct amap_eq_context, func, req->context, | ||
469 | be_pci_func(adapter)); | ||
470 | AMAP_SET_BITS(struct amap_eq_context, valid, req->context, 1); | 468 | AMAP_SET_BITS(struct amap_eq_context, valid, req->context, 1); |
471 | /* 4byte eqe*/ | 469 | /* 4byte eqe*/ |
472 | AMAP_SET_BITS(struct amap_eq_context, size, req->context, 0); | 470 | AMAP_SET_BITS(struct amap_eq_context, size, req->context, 0); |
@@ -629,7 +627,6 @@ int be_cmd_cq_create(struct be_adapter *adapter, | |||
629 | AMAP_SET_BITS(struct amap_cq_context, eventable, ctxt, 1); | 627 | AMAP_SET_BITS(struct amap_cq_context, eventable, ctxt, 1); |
630 | AMAP_SET_BITS(struct amap_cq_context, eqid, ctxt, eq->id); | 628 | AMAP_SET_BITS(struct amap_cq_context, eqid, ctxt, eq->id); |
631 | AMAP_SET_BITS(struct amap_cq_context, armed, ctxt, 1); | 629 | AMAP_SET_BITS(struct amap_cq_context, armed, ctxt, 1); |
632 | AMAP_SET_BITS(struct amap_cq_context, func, ctxt, be_pci_func(adapter)); | ||
633 | be_dws_cpu_to_le(ctxt, sizeof(req->context)); | 630 | be_dws_cpu_to_le(ctxt, sizeof(req->context)); |
634 | 631 | ||
635 | be_cmd_page_addrs_prepare(req->pages, ARRAY_SIZE(req->pages), q_mem); | 632 | be_cmd_page_addrs_prepare(req->pages, ARRAY_SIZE(req->pages), q_mem); |
@@ -678,7 +675,6 @@ int be_cmd_mccq_create(struct be_adapter *adapter, | |||
678 | 675 | ||
679 | req->num_pages = PAGES_4K_SPANNED(q_mem->va, q_mem->size); | 676 | req->num_pages = PAGES_4K_SPANNED(q_mem->va, q_mem->size); |
680 | 677 | ||
681 | AMAP_SET_BITS(struct amap_mcc_context, fid, ctxt, be_pci_func(adapter)); | ||
682 | AMAP_SET_BITS(struct amap_mcc_context, valid, ctxt, 1); | 678 | AMAP_SET_BITS(struct amap_mcc_context, valid, ctxt, 1); |
683 | AMAP_SET_BITS(struct amap_mcc_context, ring_size, ctxt, | 679 | AMAP_SET_BITS(struct amap_mcc_context, ring_size, ctxt, |
684 | be_encoded_q_len(mccq->len)); | 680 | be_encoded_q_len(mccq->len)); |
@@ -727,8 +723,6 @@ int be_cmd_txq_create(struct be_adapter *adapter, | |||
727 | 723 | ||
728 | AMAP_SET_BITS(struct amap_tx_context, tx_ring_size, ctxt, | 724 | AMAP_SET_BITS(struct amap_tx_context, tx_ring_size, ctxt, |
729 | be_encoded_q_len(txq->len)); | 725 | be_encoded_q_len(txq->len)); |
730 | AMAP_SET_BITS(struct amap_tx_context, pci_func_id, ctxt, | ||
731 | be_pci_func(adapter)); | ||
732 | AMAP_SET_BITS(struct amap_tx_context, ctx_valid, ctxt, 1); | 726 | AMAP_SET_BITS(struct amap_tx_context, ctx_valid, ctxt, 1); |
733 | AMAP_SET_BITS(struct amap_tx_context, cq_id_send, ctxt, cq->id); | 727 | AMAP_SET_BITS(struct amap_tx_context, cq_id_send, ctxt, cq->id); |
734 | 728 | ||
diff --git a/drivers/net/benet/be_main.c b/drivers/net/benet/be_main.c index 22f787f2a30b..7c9b57eb780e 100644 --- a/drivers/net/benet/be_main.c +++ b/drivers/net/benet/be_main.c | |||
@@ -1382,7 +1382,7 @@ rx_eq_free: | |||
1382 | /* There are 8 evt ids per func. Retruns the evt id's bit number */ | 1382 | /* There are 8 evt ids per func. Retruns the evt id's bit number */ |
1383 | static inline int be_evt_bit_get(struct be_adapter *adapter, u32 eq_id) | 1383 | static inline int be_evt_bit_get(struct be_adapter *adapter, u32 eq_id) |
1384 | { | 1384 | { |
1385 | return eq_id - 8 * be_pci_func(adapter); | 1385 | return eq_id % 8; |
1386 | } | 1386 | } |
1387 | 1387 | ||
1388 | static irqreturn_t be_intx(int irq, void *dev) | 1388 | static irqreturn_t be_intx(int irq, void *dev) |