diff options
author | Dmitry Kravkov <dmitry@broadcom.com> | 2010-10-05 23:32:10 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-10-06 17:10:40 -0400 |
commit | d6214d7aaa9a82b206dac9e3b0665c49c522a271 (patch) | |
tree | 593dae3485d4d5e13eec568460dcd7d8dde4381d /drivers/net/bnx2x/bnx2x_cmn.h | |
parent | 217de5aaed833982c420fc37d82272d84eaefe64 (diff) |
bnx2x: move msix table initialization to probe()
Decide which interrupt mode to use (MSI-X, MSI, INTa) only once in probe() and
initialize appropriate structures.
Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/bnx2x/bnx2x_cmn.h')
-rw-r--r-- | drivers/net/bnx2x/bnx2x_cmn.h | 75 |
1 files changed, 72 insertions, 3 deletions
diff --git a/drivers/net/bnx2x/bnx2x_cmn.h b/drivers/net/bnx2x/bnx2x_cmn.h index f08a42ad6b47..1d9686ea6b66 100644 --- a/drivers/net/bnx2x/bnx2x_cmn.h +++ b/drivers/net/bnx2x/bnx2x_cmn.h | |||
@@ -23,6 +23,7 @@ | |||
23 | 23 | ||
24 | #include "bnx2x.h" | 24 | #include "bnx2x.h" |
25 | 25 | ||
26 | extern int num_queues; | ||
26 | 27 | ||
27 | /*********************** Interfaces **************************** | 28 | /*********************** Interfaces **************************** |
28 | * Functions that need to be implemented by each driver version | 29 | * Functions that need to be implemented by each driver version |
@@ -193,12 +194,12 @@ int bnx2x_stop_fw_client(struct bnx2x *bp, | |||
193 | struct bnx2x_client_ramrod_params *p); | 194 | struct bnx2x_client_ramrod_params *p); |
194 | 195 | ||
195 | /** | 196 | /** |
196 | * Set number of quueus according to mode | 197 | * Set number of queues according to mode |
197 | * | 198 | * |
198 | * @param bp | 199 | * @param bp |
199 | * | 200 | * |
200 | */ | 201 | */ |
201 | void bnx2x_set_num_queues_msix(struct bnx2x *bp); | 202 | void bnx2x_set_num_queues(struct bnx2x *bp); |
202 | 203 | ||
203 | /** | 204 | /** |
204 | * Cleanup chip internals: | 205 | * Cleanup chip internals: |
@@ -325,6 +326,42 @@ int bnx2x_func_stop(struct bnx2x *bp); | |||
325 | */ | 326 | */ |
326 | void bnx2x_ilt_set_info(struct bnx2x *bp); | 327 | void bnx2x_ilt_set_info(struct bnx2x *bp); |
327 | 328 | ||
329 | /** | ||
330 | * Fill msix_table, request vectors, update num_queues according | ||
331 | * to number of available vectors | ||
332 | * | ||
333 | * @param bp | ||
334 | * | ||
335 | * @return int | ||
336 | */ | ||
337 | int bnx2x_enable_msix(struct bnx2x *bp); | ||
338 | |||
339 | /** | ||
340 | * Request msi mode from OS, updated internals accordingly | ||
341 | * | ||
342 | * @param bp | ||
343 | * | ||
344 | * @return int | ||
345 | */ | ||
346 | int bnx2x_enable_msi(struct bnx2x *bp); | ||
347 | |||
348 | /** | ||
349 | * Request IRQ vectors from OS. | ||
350 | * | ||
351 | * @param bp | ||
352 | * | ||
353 | * @return int | ||
354 | */ | ||
355 | int bnx2x_setup_irqs(struct bnx2x *bp); | ||
356 | /** | ||
357 | * NAPI callback | ||
358 | * | ||
359 | * @param napi | ||
360 | * @param budget | ||
361 | * | ||
362 | * @return int | ||
363 | */ | ||
364 | int bnx2x_poll(struct napi_struct *napi, int budget); | ||
328 | static inline void bnx2x_update_fpsb_idx(struct bnx2x_fastpath *fp) | 365 | static inline void bnx2x_update_fpsb_idx(struct bnx2x_fastpath *fp) |
329 | { | 366 | { |
330 | barrier(); /* status block is written to by the chip */ | 367 | barrier(); /* status block is written to by the chip */ |
@@ -605,9 +642,41 @@ static inline void bnx2x_free_rx_sge(struct bnx2x *bp, | |||
605 | sge->addr_lo = 0; | 642 | sge->addr_lo = 0; |
606 | } | 643 | } |
607 | 644 | ||
645 | static inline void bnx2x_add_all_napi(struct bnx2x *bp) | ||
646 | { | ||
647 | int i; | ||
608 | 648 | ||
649 | /* Add NAPI objects */ | ||
650 | for_each_queue(bp, i) | ||
651 | netif_napi_add(bp->dev, &bnx2x_fp(bp, i, napi), | ||
652 | bnx2x_poll, BNX2X_NAPI_WEIGHT); | ||
653 | } | ||
609 | 654 | ||
655 | static inline void bnx2x_del_all_napi(struct bnx2x *bp) | ||
656 | { | ||
657 | int i; | ||
658 | |||
659 | for_each_queue(bp, i) | ||
660 | netif_napi_del(&bnx2x_fp(bp, i, napi)); | ||
661 | } | ||
610 | 662 | ||
663 | static inline void bnx2x_disable_msi(struct bnx2x *bp) | ||
664 | { | ||
665 | if (bp->flags & USING_MSIX_FLAG) { | ||
666 | pci_disable_msix(bp->pdev); | ||
667 | bp->flags &= ~USING_MSIX_FLAG; | ||
668 | } else if (bp->flags & USING_MSI_FLAG) { | ||
669 | pci_disable_msi(bp->pdev); | ||
670 | bp->flags &= ~USING_MSI_FLAG; | ||
671 | } | ||
672 | } | ||
673 | |||
674 | static inline int bnx2x_calc_num_queues(struct bnx2x *bp) | ||
675 | { | ||
676 | return num_queues ? | ||
677 | min_t(int, num_queues, BNX2X_MAX_QUEUES(bp)) : | ||
678 | min_t(int, num_online_cpus(), BNX2X_MAX_QUEUES(bp)); | ||
679 | } | ||
611 | 680 | ||
612 | static inline void bnx2x_clear_sge_mask_next_elems(struct bnx2x_fastpath *fp) | 681 | static inline void bnx2x_clear_sge_mask_next_elems(struct bnx2x_fastpath *fp) |
613 | { | 682 | { |
@@ -877,7 +946,7 @@ void bnx2x_tx_timeout(struct net_device *dev); | |||
877 | void bnx2x_vlan_rx_register(struct net_device *dev, struct vlan_group *vlgrp); | 946 | void bnx2x_vlan_rx_register(struct net_device *dev, struct vlan_group *vlgrp); |
878 | void bnx2x_netif_start(struct bnx2x *bp); | 947 | void bnx2x_netif_start(struct bnx2x *bp); |
879 | void bnx2x_netif_stop(struct bnx2x *bp, int disable_hw); | 948 | void bnx2x_netif_stop(struct bnx2x *bp, int disable_hw); |
880 | void bnx2x_free_irq(struct bnx2x *bp, bool disable_only); | 949 | void bnx2x_free_irq(struct bnx2x *bp); |
881 | int bnx2x_suspend(struct pci_dev *pdev, pm_message_t state); | 950 | int bnx2x_suspend(struct pci_dev *pdev, pm_message_t state); |
882 | int bnx2x_resume(struct pci_dev *pdev); | 951 | int bnx2x_resume(struct pci_dev *pdev); |
883 | void bnx2x_free_skbs(struct bnx2x *bp); | 952 | void bnx2x_free_skbs(struct bnx2x *bp); |