aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/enic/enic_main.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/enic/enic_main.c')
-rw-r--r--drivers/net/enic/enic_main.c56
1 files changed, 3 insertions, 53 deletions
diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c
index d6cdecc7d1e..0c243704ca4 100644
--- a/drivers/net/enic/enic_main.c
+++ b/drivers/net/enic/enic_main.c
@@ -1348,50 +1348,6 @@ static int enic_rq_alloc_buf(struct vnic_rq *rq)
1348 return 0; 1348 return 0;
1349} 1349}
1350 1350
1351static int enic_rq_alloc_buf_a1(struct vnic_rq *rq)
1352{
1353 struct rq_enet_desc *desc = vnic_rq_next_desc(rq);
1354
1355 if (vnic_rq_posting_soon(rq)) {
1356
1357 /* SW workaround for A0 HW erratum: if we're just about
1358 * to write posted_index, insert a dummy desc
1359 * of type resvd
1360 */
1361
1362 rq_enet_desc_enc(desc, 0, RQ_ENET_TYPE_RESV2, 0);
1363 vnic_rq_post(rq, 0, 0, 0, 0);
1364 } else {
1365 return enic_rq_alloc_buf(rq);
1366 }
1367
1368 return 0;
1369}
1370
1371static int enic_set_rq_alloc_buf(struct enic *enic)
1372{
1373 enum vnic_dev_hw_version hw_ver;
1374 int err;
1375
1376 err = enic_dev_hw_version(enic, &hw_ver);
1377 if (err)
1378 return err;
1379
1380 switch (hw_ver) {
1381 case VNIC_DEV_HW_VER_A1:
1382 enic->rq_alloc_buf = enic_rq_alloc_buf_a1;
1383 break;
1384 case VNIC_DEV_HW_VER_A2:
1385 case VNIC_DEV_HW_VER_UNKNOWN:
1386 enic->rq_alloc_buf = enic_rq_alloc_buf;
1387 break;
1388 default:
1389 return -ENODEV;
1390 }
1391
1392 return 0;
1393}
1394
1395static void enic_rq_indicate_buf(struct vnic_rq *rq, 1351static void enic_rq_indicate_buf(struct vnic_rq *rq,
1396 struct cq_desc *cq_desc, struct vnic_rq_buf *buf, 1352 struct cq_desc *cq_desc, struct vnic_rq_buf *buf,
1397 int skipped, void *opaque) 1353 int skipped, void *opaque)
@@ -1528,7 +1484,7 @@ static int enic_poll(struct napi_struct *napi, int budget)
1528 0 /* don't unmask intr */, 1484 0 /* don't unmask intr */,
1529 0 /* don't reset intr timer */); 1485 0 /* don't reset intr timer */);
1530 1486
1531 err = vnic_rq_fill(&enic->rq[0], enic->rq_alloc_buf); 1487 err = vnic_rq_fill(&enic->rq[0], enic_rq_alloc_buf);
1532 1488
1533 /* Buffer allocation failed. Stay in polling 1489 /* Buffer allocation failed. Stay in polling
1534 * mode so we can try to fill the ring again. 1490 * mode so we can try to fill the ring again.
@@ -1578,7 +1534,7 @@ static int enic_poll_msix(struct napi_struct *napi, int budget)
1578 0 /* don't unmask intr */, 1534 0 /* don't unmask intr */,
1579 0 /* don't reset intr timer */); 1535 0 /* don't reset intr timer */);
1580 1536
1581 err = vnic_rq_fill(&enic->rq[rq], enic->rq_alloc_buf); 1537 err = vnic_rq_fill(&enic->rq[rq], enic_rq_alloc_buf);
1582 1538
1583 /* Buffer allocation failed. Stay in polling mode 1539 /* Buffer allocation failed. Stay in polling mode
1584 * so we can try to fill the ring again. 1540 * so we can try to fill the ring again.
@@ -1781,7 +1737,7 @@ static int enic_open(struct net_device *netdev)
1781 } 1737 }
1782 1738
1783 for (i = 0; i < enic->rq_count; i++) { 1739 for (i = 0; i < enic->rq_count; i++) {
1784 vnic_rq_fill(&enic->rq[i], enic->rq_alloc_buf); 1740 vnic_rq_fill(&enic->rq[i], enic_rq_alloc_buf);
1785 /* Need at least one buffer on ring to get going */ 1741 /* Need at least one buffer on ring to get going */
1786 if (vnic_rq_desc_used(&enic->rq[i]) == 0) { 1742 if (vnic_rq_desc_used(&enic->rq[i]) == 0) {
1787 netdev_err(netdev, "Unable to alloc receive buffers\n"); 1743 netdev_err(netdev, "Unable to alloc receive buffers\n");
@@ -2347,12 +2303,6 @@ static int enic_dev_init(struct enic *enic)
2347 2303
2348 enic_init_vnic_resources(enic); 2304 enic_init_vnic_resources(enic);
2349 2305
2350 err = enic_set_rq_alloc_buf(enic);
2351 if (err) {
2352 dev_err(dev, "Failed to set RQ buffer allocator, aborting\n");
2353 goto err_out_free_vnic_resources;
2354 }
2355
2356 err = enic_set_rss_nic_cfg(enic); 2306 err = enic_set_rss_nic_cfg(enic);
2357 if (err) { 2307 if (err) {
2358 dev_err(dev, "Failed to config nic, aborting\n"); 2308 dev_err(dev, "Failed to config nic, aborting\n");