summaryrefslogtreecommitdiff
path: root/drivers/net/ethernet/emulex/benet/be.h
diff options
context:
space:
mode:
authorSathya Perla <sathya.perla@broadcom.com>2016-06-22 15:54:54 +0300
committerDavid S. Miller <davem@davemloft.net>2016-06-27 11:06:24 +0300
commite261768e9e395b3bd71946104afd5550f77d049b (patch)
tree665899898508d2e1b58506dec9c96db7eaf6b5c5 /drivers/net/ethernet/emulex/benet/be.h
parentce7faf0a071b6d05f55d8b7b36fd796cab527427 (diff)
downloadlinux-e261768e9e395b3bd71946104afd5550f77d049b.tar.xz
be2net: support asymmetric rx/tx queue counts
be2net so far supported creation of RX/TX queues only in pairs. On configs where rx and tx queue counts are different, creation of only the lesser number of queues has been supported. This patch now allows a combination of RX/TX-only channels along with combined channels. N TX-queues and M RX-queues can be created with the following cmds: ethtool -L ethX combined N rx M-N (when N < M) ethtool -L ethX combined M tx N-M (when M < N) Setting both RX-only and TX-only channels is still not supported. It is mandatory to create atleast one combined channel. Signed-off-by: Sathya Perla <sathya.perla@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/emulex/benet/be.h')
-rw-r--r--drivers/net/ethernet/emulex/benet/be.h32
1 files changed, 27 insertions, 5 deletions
diff --git a/drivers/net/ethernet/emulex/benet/be.h b/drivers/net/ethernet/emulex/benet/be.h
index f8040efb97e9..096cb1f53409 100644
--- a/drivers/net/ethernet/emulex/benet/be.h
+++ b/drivers/net/ethernet/emulex/benet/be.h
@@ -526,7 +526,8 @@ struct be_adapter {
spinlock_t mcc_lock; /* For serializing mcc cmds to BE card */
spinlock_t mcc_cq_lock;
- u16 cfg_num_qs; /* configured via set-channels */
+ u16 cfg_num_rx_irqs; /* configured via set-channels */
+ u16 cfg_num_tx_irqs; /* configured via set-channels */
u16 num_evt_qs;
u16 num_msix_vec;
struct be_eq_obj eq_obj[MAX_EVT_QS];
@@ -652,14 +653,35 @@ struct be_adapter {
#define be_if_cap_flags(adapter) (adapter->res.if_cap_flags)
#define be_max_pf_pool_rss_tables(adapter) \
(adapter->pool_res.max_rss_tables)
+/* Max irqs avaialble for NIC */
+#define be_max_irqs(adapter) \
+ (min_t(u16, be_max_nic_eqs(adapter), num_online_cpus()))
-static inline u16 be_max_qs(struct be_adapter *adapter)
+/* Max irqs *needed* for RX queues */
+static inline u16 be_max_rx_irqs(struct be_adapter *adapter)
{
- /* If no RSS, need atleast the one def RXQ */
+ /* If no RSS, need atleast one irq for def-RXQ */
u16 num = max_t(u16, be_max_rss(adapter), 1);
- num = min(num, be_max_nic_eqs(adapter));
- return min_t(u16, num, num_online_cpus());
+ return min_t(u16, num, be_max_irqs(adapter));
+}
+
+/* Max irqs *needed* for TX queues */
+static inline u16 be_max_tx_irqs(struct be_adapter *adapter)
+{
+ return min_t(u16, be_max_txqs(adapter), be_max_irqs(adapter));
+}
+
+/* Max irqs *needed* for combined queues */
+static inline u16 be_max_qp_irqs(struct be_adapter *adapter)
+{
+ return min(be_max_tx_irqs(adapter), be_max_rx_irqs(adapter));
+}
+
+/* Max irqs *needed* for RX and TX queues together */
+static inline u16 be_max_any_irqs(struct be_adapter *adapter)
+{
+ return max(be_max_tx_irqs(adapter), be_max_rx_irqs(adapter));
}
/* Is BE in pvid_tagging mode */