aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/chelsio/cxgb4/sge.c
diff options
context:
space:
mode:
authorKumar Sanghvi <kumaras@chelsio.com>2014-03-13 11:20:46 -0400
committerDavid S. Miller <davem@davemloft.net>2014-03-13 14:36:05 -0400
commit92ddcc7b8f1c14aa9f3ec98b14bcd421b21b01e4 (patch)
tree0a9e2b936dcf308593ea98607d9383f519f78113 /drivers/net/ethernet/chelsio/cxgb4/sge.c
parent433131ba03c511a84e1fda5669c70cf8b44702e1 (diff)
cxgb4: Fix some small bugs in t4_sge_init_soft() when our Page Size is 64KB
We'd come in with SGE_FL_BUFFER_SIZE[0] and [1] both equal to 64KB and the extant logic would flag that as an error. Based on original work by Casey Leedom <leedom@chelsio.com> Signed-off-by: Kumar Sanghvi <kumaras@chelsio.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/chelsio/cxgb4/sge.c')
-rw-r--r--drivers/net/ethernet/chelsio/cxgb4/sge.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/drivers/net/ethernet/chelsio/cxgb4/sge.c b/drivers/net/ethernet/chelsio/cxgb4/sge.c
index af76b25bb606..3a2ecd84afee 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/sge.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/sge.c
@@ -2596,11 +2596,19 @@ static int t4_sge_init_soft(struct adapter *adap)
2596 fl_small_mtu = READ_FL_BUF(RX_SMALL_MTU_BUF); 2596 fl_small_mtu = READ_FL_BUF(RX_SMALL_MTU_BUF);
2597 fl_large_mtu = READ_FL_BUF(RX_LARGE_MTU_BUF); 2597 fl_large_mtu = READ_FL_BUF(RX_LARGE_MTU_BUF);
2598 2598
2599 /* We only bother using the Large Page logic if the Large Page Buffer
2600 * is larger than our Page Size Buffer.
2601 */
2602 if (fl_large_pg <= fl_small_pg)
2603 fl_large_pg = 0;
2604
2599 #undef READ_FL_BUF 2605 #undef READ_FL_BUF
2600 2606
2607 /* The Page Size Buffer must be exactly equal to our Page Size and the
2608 * Large Page Size Buffer should be 0 (per above) or a power of 2.
2609 */
2601 if (fl_small_pg != PAGE_SIZE || 2610 if (fl_small_pg != PAGE_SIZE ||
2602 (fl_large_pg != 0 && (fl_large_pg < fl_small_pg || 2611 (fl_large_pg & (fl_large_pg-1)) != 0) {
2603 (fl_large_pg & (fl_large_pg-1)) != 0))) {
2604 dev_err(adap->pdev_dev, "bad SGE FL page buffer sizes [%d, %d]\n", 2612 dev_err(adap->pdev_dev, "bad SGE FL page buffer sizes [%d, %d]\n",
2605 fl_small_pg, fl_large_pg); 2613 fl_small_pg, fl_large_pg);
2606 return -EINVAL; 2614 return -EINVAL;