* [PATCH v2] bnx2x: Support for managing RX indirection table
@ 2011-02-16 20:27 Tom Herbert
2011-02-17 9:09 ` Eric Dumazet
0 siblings, 1 reply; 4+ messages in thread
From: Tom Herbert @ 2011-02-16 20:27 UTC (permalink / raw)
To: davem, eilong, netdev
Support fetching and retrieving RX indirection table via ethtool.
Signed-off-by: Tom Herbert <therbert@google.com>
---
drivers/net/bnx2x/bnx2x.h | 2 +
drivers/net/bnx2x/bnx2x_ethtool.c | 56 +++++++++++++++++++++++++++++++++++++
drivers/net/bnx2x/bnx2x_main.c | 22 +++++++++++---
3 files changed, 75 insertions(+), 5 deletions(-)
diff --git a/drivers/net/bnx2x/bnx2x.h b/drivers/net/bnx2x/bnx2x.h
index 236d79a..c0dd30d 100644
--- a/drivers/net/bnx2x/bnx2x.h
+++ b/drivers/net/bnx2x/bnx2x.h
@@ -1076,6 +1076,7 @@ struct bnx2x {
int num_queues;
int disable_tpa;
int int_mode;
+ u32 *rx_indir_table;
struct tstorm_eth_mac_filter_config mac_filters;
#define BNX2X_ACCEPT_NONE 0x0000
@@ -1799,5 +1800,6 @@ static inline u32 reg_poll(struct bnx2x *bp, u32 reg, u32 expected, int ms,
BNX2X_EXTERN int load_count[2][3]; /* per path: 0-common, 1-port0, 2-port1 */
extern void bnx2x_set_ethtool_ops(struct net_device *netdev);
+void bnx2x_push_indir_table(struct bnx2x *bp);
#endif /* bnx2x.h */
diff --git a/drivers/net/bnx2x/bnx2x_ethtool.c b/drivers/net/bnx2x/bnx2x_ethtool.c
index 816fef6..8d19d12 100644
--- a/drivers/net/bnx2x/bnx2x_ethtool.c
+++ b/drivers/net/bnx2x/bnx2x_ethtool.c
@@ -2134,6 +2134,59 @@ static int bnx2x_phys_id(struct net_device *dev, u32 data)
return 0;
}
+static int bnx2x_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *info,
+ void *rules __always_unused)
+{
+ struct bnx2x *bp = netdev_priv(dev);
+
+ switch (info->cmd) {
+ case ETHTOOL_GRXRINGS:
+ info->data = BNX2X_NUM_ETH_QUEUES(bp);
+ return 0;
+
+ default:
+ return -EOPNOTSUPP;
+ }
+}
+
+static int bnx2x_get_rxfh_indir(struct net_device *dev,
+ struct ethtool_rxfh_indir *indir)
+{
+ struct bnx2x *bp = netdev_priv(dev);
+ size_t copy_size =
+ min_t(size_t, indir->size, TSTORM_INDIRECTION_TABLE_SIZE);
+
+ if (bp->multi_mode == ETH_RSS_MODE_DISABLED)
+ return -EOPNOTSUPP;
+
+ indir->size = TSTORM_INDIRECTION_TABLE_SIZE;
+ memcpy(indir->ring_index, bp->rx_indir_table,
+ copy_size * sizeof(bp->rx_indir_table[0]));
+ return 0;
+}
+
+static int bnx2x_set_rxfh_indir(struct net_device *dev,
+ const struct ethtool_rxfh_indir *indir)
+{
+ struct bnx2x *bp = netdev_priv(dev);
+ size_t i;
+
+ if (bp->multi_mode == ETH_RSS_MODE_DISABLED)
+ return -EOPNOTSUPP;
+
+ /* Validate size and indices */
+ if (indir->size != TSTORM_INDIRECTION_TABLE_SIZE)
+ return -EINVAL;
+ for (i = 0; i < TSTORM_INDIRECTION_TABLE_SIZE; i++)
+ if (indir->ring_index[i] >= BNX2X_NUM_ETH_QUEUES(bp))
+ return -EINVAL;
+
+ memcpy(bp->rx_indir_table, indir->ring_index,
+ indir->size * sizeof(bp->rx_indir_table[0]));
+ bnx2x_push_indir_table(bp);
+ return 0;
+}
+
static const struct ethtool_ops bnx2x_ethtool_ops = {
.get_settings = bnx2x_get_settings,
.set_settings = bnx2x_set_settings,
@@ -2170,6 +2223,9 @@ static const struct ethtool_ops bnx2x_ethtool_ops = {
.get_strings = bnx2x_get_strings,
.phys_id = bnx2x_phys_id,
.get_ethtool_stats = bnx2x_get_ethtool_stats,
+ .get_rxnfc = bnx2x_get_rxnfc,
+ .get_rxfh_indir = bnx2x_get_rxfh_indir,
+ .set_rxfh_indir = bnx2x_set_rxfh_indir,
};
void bnx2x_set_ethtool_ops(struct net_device *netdev)
diff --git a/drivers/net/bnx2x/bnx2x_main.c b/drivers/net/bnx2x/bnx2x_main.c
index c238c4d..6c7745e 100644
--- a/drivers/net/bnx2x/bnx2x_main.c
+++ b/drivers/net/bnx2x/bnx2x_main.c
@@ -4254,7 +4254,7 @@ static void bnx2x_init_eq_ring(struct bnx2x *bp)
min_t(int, MAX_SP_DESC_CNT - MAX_SPQ_PENDING, NUM_EQ_DESC) - 1);
}
-static void bnx2x_init_ind_table(struct bnx2x *bp)
+void bnx2x_push_indir_table(struct bnx2x *bp)
{
int func = BP_FUNC(bp);
int i;
@@ -4262,13 +4262,20 @@ static void bnx2x_init_ind_table(struct bnx2x *bp)
if (bp->multi_mode == ETH_RSS_MODE_DISABLED)
return;
- DP(NETIF_MSG_IFUP,
- "Initializing indirection table multi_mode %d\n", bp->multi_mode);
for (i = 0; i < TSTORM_INDIRECTION_TABLE_SIZE; i++)
REG_WR8(bp, BAR_TSTRORM_INTMEM +
TSTORM_INDIRECTION_TABLE_OFFSET(func) + i,
- bp->fp->cl_id + (i % (bp->num_queues -
- NONE_ETH_CONTEXT_USE)));
+ bp->fp->cl_id + bp->rx_indir_table[i]);
+}
+
+static void bnx2x_init_ind_table(struct bnx2x *bp)
+{
+ int i;
+
+ for (i = 0; i < TSTORM_INDIRECTION_TABLE_SIZE; i++)
+ bp->rx_indir_table[i] = i % BNX2X_NUM_ETH_QUEUES(bp);
+
+ bnx2x_push_indir_table(bp);
}
void bnx2x_set_storm_rx_mode(struct bnx2x *bp)
@@ -6016,6 +6023,8 @@ void bnx2x_free_mem(struct bnx2x *bp)
BNX2X_PCI_FREE(bp->eq_ring, bp->eq_mapping,
BCM_PAGE_SIZE * NUM_EQ_PAGES);
+ BNX2X_FREE(bp->rx_indir_table);
+
#undef BNX2X_PCI_FREE
#undef BNX2X_KFREE
}
@@ -6146,6 +6155,9 @@ int bnx2x_alloc_mem(struct bnx2x *bp)
/* EQ */
BNX2X_PCI_ALLOC(bp->eq_ring, &bp->eq_mapping,
BCM_PAGE_SIZE * NUM_EQ_PAGES);
+
+ BNX2X_ALLOC(bp->rx_indir_table, sizeof(bp->rx_indir_table[0]) *
+ TSTORM_INDIRECTION_TABLE_SIZE);
return 0;
alloc_mem_err:
--
1.7.3.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2] bnx2x: Support for managing RX indirection table
2011-02-16 20:27 [PATCH v2] bnx2x: Support for managing RX indirection table Tom Herbert
@ 2011-02-17 9:09 ` Eric Dumazet
2011-02-17 12:58 ` Eilon Greenstein
0 siblings, 1 reply; 4+ messages in thread
From: Eric Dumazet @ 2011-02-17 9:09 UTC (permalink / raw)
To: Tom Herbert; +Cc: davem, eilong, netdev
Le mercredi 16 février 2011 à 12:27 -0800, Tom Herbert a écrit :
> Support fetching and retrieving RX indirection table via ethtool.
>
> Signed-off-by: Tom Herbert <therbert@google.com>
> ---
> drivers/net/bnx2x/bnx2x.h | 2 +
> drivers/net/bnx2x/bnx2x_ethtool.c | 56 +++++++++++++++++++++++++++++++++++++
> drivers/net/bnx2x/bnx2x_main.c | 22 +++++++++++---
> 3 files changed, 75 insertions(+), 5 deletions(-)
Acked-by: Eric Dumazet <eric.dumazet@gmail.com>
As this is a bit unusual stuff (ethtool -X), I guess some hints can be
useful to testers and admins :
I tested this patch on my dev machine
Broadcom Corporation NetXtreme II BCM57711E 10Gigabit PCIe
(Hewlett-Packard Company NC532i Dual Port 10GbE Multifunction BL-C
Adapter)
# ethtool -X eth1 weight 0 1 0 2 0 4 0 8 0 16 0 32
# ethtool -x eth1
RX flow hash indirection table for eth1 with 16 RX ring(s):
0: 1 1 3 3 3 3 5 5
8: 5 5 5 5 5 5 7 7
16: 7 7 7 7 7 7 7 7
24: 7 7 7 7 7 7 9 9
32: 9 9 9 9 9 9 9 9
40: 9 9 9 9 9 9 9 9
48: 9 9 9 9 9 9 9 9
56: 9 9 9 9 9 9 11 11
64: 11 11 11 11 11 11 11 11
72: 11 11 11 11 11 11 11 11
80: 11 11 11 11 11 11 11 11
88: 11 11 11 11 11 11 11 11
96: 11 11 11 11 11 11 11 11
104: 11 11 11 11 11 11 11 11
112: 11 11 11 11 11 11 11 11
120: 11 11 11 11 11 11 11 11
After some (distributed) trafic on eth1 I get :
[root@svivoipvnx021 ~]# ethtool -S eth1|grep rx_ucast_packets
[0]: rx_ucast_packets: 62
[1]: rx_ucast_packets: 15870
[2]: rx_ucast_packets: 9
[3]: rx_ucast_packets: 31507
[4]: rx_ucast_packets: 0
[5]: rx_ucast_packets: 63106
[6]: rx_ucast_packets: 0
[7]: rx_ucast_packets: 122051
[8]: rx_ucast_packets: 1
[9]: rx_ucast_packets: 248071
[10]: rx_ucast_packets: 0
[11]: rx_ucast_packets: 519864
[12]: rx_ucast_packets: 0
[13]: rx_ucast_packets: 0
[14]: rx_ucast_packets: 0
[15]: rx_ucast_packets: 0
rx_ucast_packets: 1000541
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] bnx2x: Support for managing RX indirection table
2011-02-17 9:09 ` Eric Dumazet
@ 2011-02-17 12:58 ` Eilon Greenstein
2011-02-17 20:49 ` David Miller
0 siblings, 1 reply; 4+ messages in thread
From: Eilon Greenstein @ 2011-02-17 12:58 UTC (permalink / raw)
To: Eric Dumazet, Tom Herbert; +Cc: davem@davemloft.net, netdev@vger.kernel.org
On Thu, 2011-02-17 at 01:09 -0800, Eric Dumazet wrote:
> Le mercredi 16 février 2011 à 12:27 -0800, Tom Herbert a écrit :
> > Support fetching and retrieving RX indirection table via ethtool.
> >
> > Signed-off-by: Tom Herbert <therbert@google.com>
> > ---
> > drivers/net/bnx2x/bnx2x.h | 2 +
> > drivers/net/bnx2x/bnx2x_ethtool.c | 56 +++++++++++++++++++++++++++++++++++++
> > drivers/net/bnx2x/bnx2x_main.c | 22 +++++++++++---
> > 3 files changed, 75 insertions(+), 5 deletions(-)
>
> Acked-by: Eric Dumazet <eric.dumazet@gmail.com>
Acked-by: Eilon Greenstein <eilong@broadcom.com>
Thanks everyone!
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] bnx2x: Support for managing RX indirection table
2011-02-17 12:58 ` Eilon Greenstein
@ 2011-02-17 20:49 ` David Miller
0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2011-02-17 20:49 UTC (permalink / raw)
To: eilong; +Cc: eric.dumazet, therbert, netdev
From: "Eilon Greenstein" <eilong@broadcom.com>
Date: Thu, 17 Feb 2011 14:58:44 +0200
> On Thu, 2011-02-17 at 01:09 -0800, Eric Dumazet wrote:
>> Le mercredi 16 février 2011 à 12:27 -0800, Tom Herbert a écrit :
>> > Support fetching and retrieving RX indirection table via ethtool.
>> >
>> > Signed-off-by: Tom Herbert <therbert@google.com>
>> > ---
>> > drivers/net/bnx2x/bnx2x.h | 2 +
>> > drivers/net/bnx2x/bnx2x_ethtool.c | 56 +++++++++++++++++++++++++++++++++++++
>> > drivers/net/bnx2x/bnx2x_main.c | 22 +++++++++++---
>> > 3 files changed, 75 insertions(+), 5 deletions(-)
>>
>> Acked-by: Eric Dumazet <eric.dumazet@gmail.com>
>
> Acked-by: Eilon Greenstein <eilong@broadcom.com>
>
> Thanks everyone!
Applied to net-next-2.6, thanks!
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-02-17 20:49 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-16 20:27 [PATCH v2] bnx2x: Support for managing RX indirection table Tom Herbert
2011-02-17 9:09 ` Eric Dumazet
2011-02-17 12:58 ` Eilon Greenstein
2011-02-17 20:49 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).