aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/cxgb3/cxgb3_main.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/cxgb3/cxgb3_main.c')
-rw-r--r--drivers/net/cxgb3/cxgb3_main.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/net/cxgb3/cxgb3_main.c b/drivers/net/cxgb3/cxgb3_main.c
index d55383610559..b82544e08689 100644
--- a/drivers/net/cxgb3/cxgb3_main.c
+++ b/drivers/net/cxgb3/cxgb3_main.c
@@ -485,12 +485,14 @@ static ssize_t show_##name(struct device *d, struct device_attribute *attr, \
485static ssize_t set_nfilters(struct net_device *dev, unsigned int val) 485static ssize_t set_nfilters(struct net_device *dev, unsigned int val)
486{ 486{
487 struct adapter *adap = dev->priv; 487 struct adapter *adap = dev->priv;
488 int min_tids = is_offload(adap) ? MC5_MIN_TIDS : 0;
488 489
489 if (adap->flags & FULL_INIT_DONE) 490 if (adap->flags & FULL_INIT_DONE)
490 return -EBUSY; 491 return -EBUSY;
491 if (val && adap->params.rev == 0) 492 if (val && adap->params.rev == 0)
492 return -EINVAL; 493 return -EINVAL;
493 if (val > t3_mc5_size(&adap->mc5) - adap->params.mc5.nservers) 494 if (val > t3_mc5_size(&adap->mc5) - adap->params.mc5.nservers -
495 min_tids)
494 return -EINVAL; 496 return -EINVAL;
495 adap->params.mc5.nfilters = val; 497 adap->params.mc5.nfilters = val;
496 return 0; 498 return 0;
@@ -508,7 +510,8 @@ static ssize_t set_nservers(struct net_device *dev, unsigned int val)
508 510
509 if (adap->flags & FULL_INIT_DONE) 511 if (adap->flags & FULL_INIT_DONE)
510 return -EBUSY; 512 return -EBUSY;
511 if (val > t3_mc5_size(&adap->mc5) - adap->params.mc5.nfilters) 513 if (val > t3_mc5_size(&adap->mc5) - adap->params.mc5.nfilters -
514 MC5_MIN_TIDS)
512 return -EINVAL; 515 return -EINVAL;
513 adap->params.mc5.nservers = val; 516 adap->params.mc5.nservers = val;
514 return 0; 517 return 0;