diff options
author | Tom Herbert <therbert@google.com> | 2011-02-16 05:27:02 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-02-17 15:49:45 -0500 |
commit | ab532cf32b4055028ad095d3c1fee9eec28ed25e (patch) | |
tree | 03c537583ce9d9dfa87d96e83ec4f467695ed3e4 /drivers/net/bnx2x/bnx2x_ethtool.c | |
parent | f878b995b0f746f5726af9e66940f3bf373dae91 (diff) |
bnx2x: Support for managing RX indirection table
Support fetching and retrieving RX indirection table via ethtool.
Signed-off-by: Tom Herbert <therbert@google.com>
Acked-by: Eric Dumazet <eric.dumazet@gmail.com>
Acked-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/bnx2x/bnx2x_ethtool.c')
-rw-r--r-- | drivers/net/bnx2x/bnx2x_ethtool.c | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/drivers/net/bnx2x/bnx2x_ethtool.c b/drivers/net/bnx2x/bnx2x_ethtool.c index 816fef6d3844..8d19d127f796 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) | |||
2134 | return 0; | 2134 | return 0; |
2135 | } | 2135 | } |
2136 | 2136 | ||
2137 | static int bnx2x_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *info, | ||
2138 | void *rules __always_unused) | ||
2139 | { | ||
2140 | struct bnx2x *bp = netdev_priv(dev); | ||
2141 | |||
2142 | switch (info->cmd) { | ||
2143 | case ETHTOOL_GRXRINGS: | ||
2144 | info->data = BNX2X_NUM_ETH_QUEUES(bp); | ||
2145 | return 0; | ||
2146 | |||
2147 | default: | ||
2148 | return -EOPNOTSUPP; | ||
2149 | } | ||
2150 | } | ||
2151 | |||
2152 | static int bnx2x_get_rxfh_indir(struct net_device *dev, | ||
2153 | struct ethtool_rxfh_indir *indir) | ||
2154 | { | ||
2155 | struct bnx2x *bp = netdev_priv(dev); | ||
2156 | size_t copy_size = | ||
2157 | min_t(size_t, indir->size, TSTORM_INDIRECTION_TABLE_SIZE); | ||
2158 | |||
2159 | if (bp->multi_mode == ETH_RSS_MODE_DISABLED) | ||
2160 | return -EOPNOTSUPP; | ||
2161 | |||
2162 | indir->size = TSTORM_INDIRECTION_TABLE_SIZE; | ||
2163 | memcpy(indir->ring_index, bp->rx_indir_table, | ||
2164 | copy_size * sizeof(bp->rx_indir_table[0])); | ||
2165 | return 0; | ||
2166 | } | ||
2167 | |||
2168 | static int bnx2x_set_rxfh_indir(struct net_device *dev, | ||
2169 | const struct ethtool_rxfh_indir *indir) | ||
2170 | { | ||
2171 | struct bnx2x *bp = netdev_priv(dev); | ||
2172 | size_t i; | ||
2173 | |||
2174 | if (bp->multi_mode == ETH_RSS_MODE_DISABLED) | ||
2175 | return -EOPNOTSUPP; | ||
2176 | |||
2177 | /* Validate size and indices */ | ||
2178 | if (indir->size != TSTORM_INDIRECTION_TABLE_SIZE) | ||
2179 | return -EINVAL; | ||
2180 | for (i = 0; i < TSTORM_INDIRECTION_TABLE_SIZE; i++) | ||
2181 | if (indir->ring_index[i] >= BNX2X_NUM_ETH_QUEUES(bp)) | ||
2182 | return -EINVAL; | ||
2183 | |||
2184 | memcpy(bp->rx_indir_table, indir->ring_index, | ||
2185 | indir->size * sizeof(bp->rx_indir_table[0])); | ||
2186 | bnx2x_push_indir_table(bp); | ||
2187 | return 0; | ||
2188 | } | ||
2189 | |||
2137 | static const struct ethtool_ops bnx2x_ethtool_ops = { | 2190 | static const struct ethtool_ops bnx2x_ethtool_ops = { |
2138 | .get_settings = bnx2x_get_settings, | 2191 | .get_settings = bnx2x_get_settings, |
2139 | .set_settings = bnx2x_set_settings, | 2192 | .set_settings = bnx2x_set_settings, |
@@ -2170,6 +2223,9 @@ static const struct ethtool_ops bnx2x_ethtool_ops = { | |||
2170 | .get_strings = bnx2x_get_strings, | 2223 | .get_strings = bnx2x_get_strings, |
2171 | .phys_id = bnx2x_phys_id, | 2224 | .phys_id = bnx2x_phys_id, |
2172 | .get_ethtool_stats = bnx2x_get_ethtool_stats, | 2225 | .get_ethtool_stats = bnx2x_get_ethtool_stats, |
2226 | .get_rxnfc = bnx2x_get_rxnfc, | ||
2227 | .get_rxfh_indir = bnx2x_get_rxfh_indir, | ||
2228 | .set_rxfh_indir = bnx2x_set_rxfh_indir, | ||
2173 | }; | 2229 | }; |
2174 | 2230 | ||
2175 | void bnx2x_set_ethtool_ops(struct net_device *netdev) | 2231 | void bnx2x_set_ethtool_ops(struct net_device *netdev) |