Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 314330
b: refs/heads/master
c: 0e8d2ec
h: refs/heads/master
v: v3
  • Loading branch information
Merav Sicron authored and David S. Miller committed Jun 19, 2012
1 parent 8893762 commit b721bee
Show file tree
Hide file tree
Showing 6 changed files with 101 additions and 13 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 60aa0509056616afe9d66cf0fcd290589395032c
refs/heads/master: 0e8d2ec5c6ccf74dbe40216bb62d82c2f73fe836
4 changes: 4 additions & 0 deletions trunk/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h
Original file line number Diff line number Diff line change
Expand Up @@ -1393,6 +1393,7 @@ struct bnx2x {
#define BNX2X_MAX_COS 3
#define BNX2X_MAX_TX_COS 2
int num_queues;
int num_napi_queues;
int disable_tpa;

u32 rx_mode;
Expand Down Expand Up @@ -1680,6 +1681,9 @@ struct bnx2x_func_init_params {
continue; \
else

#define for_each_napi_rx_queue(bp, var) \
for ((var) = 0; (var) < bp->num_napi_queues; (var)++)

/* Skip OOO FP */
#define for_each_tx_queue(bp, var) \
for ((var) = 0; (var) < BNX2X_NUM_QUEUES(bp); (var)++) \
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
Original file line number Diff line number Diff line change
Expand Up @@ -1360,7 +1360,7 @@ void bnx2x_free_irq(struct bnx2x *bp)
free_irq(bp->dev->irq, bp->dev);
}

int __devinit bnx2x_enable_msix(struct bnx2x *bp)
int bnx2x_enable_msix(struct bnx2x *bp)
{
int msix_vec = 0, i, rc, req_cnt;

Expand Down
11 changes: 8 additions & 3 deletions trunk/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
extern int load_count[2][3]; /* per-path: 0-common, 1-port0, 2-port1 */

extern int num_queues;
extern int int_mode;

/************************ Macros ********************************/
#define BNX2X_PCI_FREE(x, y, size) \
Expand Down Expand Up @@ -495,7 +496,7 @@ void bnx2x_netif_start(struct bnx2x *bp);
* fills msix_table, requests vectors, updates num_queues
* according to number of available vectors.
*/
int __devinit bnx2x_enable_msix(struct bnx2x *bp);
int bnx2x_enable_msix(struct bnx2x *bp);

/**
* bnx2x_enable_msi - request msi mode from OS, updated internals accordingly
Expand Down Expand Up @@ -788,8 +789,10 @@ static inline void bnx2x_add_all_napi(struct bnx2x *bp)
{
int i;

bp->num_napi_queues = bp->num_queues;

/* Add NAPI objects */
for_each_rx_queue(bp, i)
for_each_napi_rx_queue(bp, i)
netif_napi_add(bp->dev, &bnx2x_fp(bp, i, napi),
bnx2x_poll, BNX2X_NAPI_WEIGHT);
}
Expand All @@ -798,10 +801,12 @@ static inline void bnx2x_del_all_napi(struct bnx2x *bp)
{
int i;

for_each_rx_queue(bp, i)
for_each_napi_rx_queue(bp, i)
netif_napi_del(&bnx2x_fp(bp, i, napi));
}

void bnx2x_set_int_mode(struct bnx2x *bp);

static inline void bnx2x_disable_msi(struct bnx2x *bp)
{
if (bp->flags & USING_MSIX_FLAG) {
Expand Down
80 changes: 80 additions & 0 deletions trunk/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c
Original file line number Diff line number Diff line change
Expand Up @@ -2796,6 +2796,84 @@ static int bnx2x_set_rxfh_indir(struct net_device *dev, const u32 *indir)
return bnx2x_config_rss_eth(bp, false);
}

/**
* bnx2x_get_channels - gets the number of RSS queues.
*
* @dev: net device
* @channels: returns the number of max / current queues
*/
static void bnx2x_get_channels(struct net_device *dev,
struct ethtool_channels *channels)
{
struct bnx2x *bp = netdev_priv(dev);

channels->max_combined = BNX2X_MAX_RSS_COUNT(bp);
channels->combined_count = BNX2X_NUM_ETH_QUEUES(bp);
}

/**
* bnx2x_change_num_queues - change the number of RSS queues.
*
* @bp: bnx2x private structure
*
* Re-configure interrupt mode to get the new number of MSI-X
* vectors and re-add NAPI objects.
*/
static void bnx2x_change_num_queues(struct bnx2x *bp, int num_rss)
{
bnx2x_del_all_napi(bp);
bnx2x_disable_msi(bp);
BNX2X_NUM_QUEUES(bp) = num_rss + NON_ETH_CONTEXT_USE;
bnx2x_set_int_mode(bp);
bnx2x_add_all_napi(bp);
}

/**
* bnx2x_set_channels - sets the number of RSS queues.
*
* @dev: net device
* @channels: includes the number of queues requested
*/
static int bnx2x_set_channels(struct net_device *dev,
struct ethtool_channels *channels)
{
struct bnx2x *bp = netdev_priv(dev);


DP(BNX2X_MSG_ETHTOOL,
"set-channels command parameters: rx = %d, tx = %d, other = %d, combined = %d\n",
channels->rx_count, channels->tx_count, channels->other_count,
channels->combined_count);

/* We don't support separate rx / tx channels.
* We don't allow setting 'other' channels.
*/
if (channels->rx_count || channels->tx_count || channels->other_count
|| (channels->combined_count == 0) ||
(channels->combined_count > BNX2X_MAX_RSS_COUNT(bp))) {
DP(BNX2X_MSG_ETHTOOL, "command parameters not supported\n");
return -EINVAL;
}

/* Check if there was a change in the active parameters */
if (channels->combined_count == BNX2X_NUM_ETH_QUEUES(bp)) {
DP(BNX2X_MSG_ETHTOOL, "No change in active parameters\n");
return 0;
}

/* Set the requested number of queues in bp context.
* Note that the actual number of queues created during load may be
* less than requested if memory is low.
*/
if (unlikely(!netif_running(dev))) {
bnx2x_change_num_queues(bp, channels->combined_count);
return 0;
}
bnx2x_nic_unload(bp, UNLOAD_NORMAL);
bnx2x_change_num_queues(bp, channels->combined_count);
return bnx2x_nic_load(bp, LOAD_NORMAL);
}

static const struct ethtool_ops bnx2x_ethtool_ops = {
.get_settings = bnx2x_get_settings,
.set_settings = bnx2x_set_settings,
Expand Down Expand Up @@ -2827,6 +2905,8 @@ static const struct ethtool_ops bnx2x_ethtool_ops = {
.get_rxfh_indir_size = bnx2x_get_rxfh_indir_size,
.get_rxfh_indir = bnx2x_get_rxfh_indir,
.set_rxfh_indir = bnx2x_set_rxfh_indir,
.get_channels = bnx2x_get_channels,
.set_channels = bnx2x_set_channels,
.get_eee = bnx2x_get_eee,
.set_eee = bnx2x_set_eee,
};
Expand Down
15 changes: 7 additions & 8 deletions trunk/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ MODULE_PARM_DESC(disable_tpa, " Disable the TPA (LRO) feature");

#define INT_MODE_INTx 1
#define INT_MODE_MSI 2
static int int_mode;
int int_mode;
module_param(int_mode, int, 0);
MODULE_PARM_DESC(int_mode, " Force interrupt mode other than MSI-X "
"(1 INT#x; 2 MSI)");
Expand Down Expand Up @@ -7612,7 +7612,7 @@ int bnx2x_setup_leading(struct bnx2x *bp)
*
* In case of MSI-X it will also try to enable MSI-X.
*/
static void __devinit bnx2x_set_int_mode(struct bnx2x *bp)
void bnx2x_set_int_mode(struct bnx2x *bp)
{
switch (int_mode) {
case INT_MODE_MSI:
Expand All @@ -7623,11 +7623,6 @@ static void __devinit bnx2x_set_int_mode(struct bnx2x *bp)
BNX2X_DEV_INFO("set number of queues to 1\n");
break;
default:
/* Set number of queues for MSI-X mode */
bnx2x_set_num_queues(bp);

BNX2X_DEV_INFO("set number of queues to %d\n", bp->num_queues);

/* if we can't use MSI-X we only need one fp,
* so try to enable MSI-X with the requested number of fp's
* and fallback to MSI or legacy INTx with one fp
Expand Down Expand Up @@ -11883,8 +11878,12 @@ static int __devinit bnx2x_init_one(struct pci_dev *pdev,

#endif


/* Set bp->num_queues for MSI-X mode*/
bnx2x_set_num_queues(bp);

/* Configure interrupt mode: try to enable MSI-X/MSI if
* needed, set bp->num_queues appropriately.
* needed.
*/
bnx2x_set_int_mode(bp);

Expand Down

0 comments on commit b721bee

Please sign in to comment.