aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorBrice Goglin <brice@myri.com>2008-05-08 20:20:25 -0400
committerJeff Garzik <jgarzik@redhat.com>2008-05-13 01:30:30 -0400
commitfa0a90d96b08856203435b051dd1c155b58ccd0f (patch)
treeb3e62b80ec81ca376b024ecabcda76a1a8ab1254 /drivers
parentb53bef84c27e68efac9b608392acd1fc14cb6ce7 (diff)
myri10ge: cleanup retrieving of firmware capabilities
Add myri10ge_get_firmware_capabilities() to retrieve TSO6 and interrupt slots capabilities from the firmware. Signed-off-by: Brice Goglin <brice@myri.com> Signed-off-by: Andrew Gallatin <gallatin@myri.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/myri10ge/myri10ge.c42
1 files changed, 31 insertions, 11 deletions
diff --git a/drivers/net/myri10ge/myri10ge.c b/drivers/net/myri10ge/myri10ge.c
index 5edcbfe93065..054168faf292 100644
--- a/drivers/net/myri10ge/myri10ge.c
+++ b/drivers/net/myri10ge/myri10ge.c
@@ -194,6 +194,7 @@ struct myri10ge_priv {
194 int csum_flag; /* rx_csums? */ 194 int csum_flag; /* rx_csums? */
195 int small_bytes; 195 int small_bytes;
196 int big_bytes; 196 int big_bytes;
197 int max_intr_slots;
197 struct net_device *dev; 198 struct net_device *dev;
198 struct net_device_stats stats; 199 struct net_device_stats stats;
199 spinlock_t stats_lock; 200 spinlock_t stats_lock;
@@ -634,13 +635,38 @@ static int myri10ge_adopt_running_firmware(struct myri10ge_priv *mgp)
634 return status; 635 return status;
635} 636}
636 637
638int myri10ge_get_firmware_capabilities(struct myri10ge_priv *mgp)
639{
640 struct myri10ge_cmd cmd;
641 int status;
642
643 /* probe for IPv6 TSO support */
644 mgp->features = NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_TSO;
645 status = myri10ge_send_cmd(mgp, MXGEFW_CMD_GET_MAX_TSO6_HDR_SIZE,
646 &cmd, 0);
647 if (status == 0) {
648 mgp->max_tso6 = cmd.data0;
649 mgp->features |= NETIF_F_TSO6;
650 }
651
652 status = myri10ge_send_cmd(mgp, MXGEFW_CMD_GET_RX_RING_SIZE, &cmd, 0);
653 if (status != 0) {
654 dev_err(&mgp->pdev->dev,
655 "failed MXGEFW_CMD_GET_RX_RING_SIZE\n");
656 return -ENXIO;
657 }
658
659 mgp->max_intr_slots = 2 * (cmd.data0 / sizeof(struct mcp_dma_addr));
660
661 return 0;
662}
663
637static int myri10ge_load_firmware(struct myri10ge_priv *mgp) 664static int myri10ge_load_firmware(struct myri10ge_priv *mgp)
638{ 665{
639 char __iomem *submit; 666 char __iomem *submit;
640 __be32 buf[16] __attribute__ ((__aligned__(8))); 667 __be32 buf[16] __attribute__ ((__aligned__(8)));
641 u32 dma_low, dma_high, size; 668 u32 dma_low, dma_high, size;
642 int status, i; 669 int status, i;
643 struct myri10ge_cmd cmd;
644 670
645 size = 0; 671 size = 0;
646 status = myri10ge_load_hotplug_firmware(mgp, &size); 672 status = myri10ge_load_hotplug_firmware(mgp, &size);
@@ -672,6 +698,8 @@ static int myri10ge_load_firmware(struct myri10ge_priv *mgp)
672 698
673 mgp->fw_name = "adopted"; 699 mgp->fw_name = "adopted";
674 mgp->tx_boundary = 2048; 700 mgp->tx_boundary = 2048;
701 myri10ge_dummy_rdma(mgp, 1);
702 status = myri10ge_get_firmware_capabilities(mgp);
675 return status; 703 return status;
676 } 704 }
677 705
@@ -714,18 +742,10 @@ static int myri10ge_load_firmware(struct myri10ge_priv *mgp)
714 dev_err(&mgp->pdev->dev, "handoff failed\n"); 742 dev_err(&mgp->pdev->dev, "handoff failed\n");
715 return -ENXIO; 743 return -ENXIO;
716 } 744 }
717 dev_info(&mgp->pdev->dev, "handoff confirmed\n");
718 myri10ge_dummy_rdma(mgp, 1); 745 myri10ge_dummy_rdma(mgp, 1);
746 status = myri10ge_get_firmware_capabilities(mgp);
719 747
720 /* probe for IPv6 TSO support */ 748 return status;
721 mgp->features = NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_TSO;
722 status = myri10ge_send_cmd(mgp, MXGEFW_CMD_GET_MAX_TSO6_HDR_SIZE,
723 &cmd, 0);
724 if (status == 0) {
725 mgp->max_tso6 = cmd.data0;
726 mgp->features |= NETIF_F_TSO6;
727 }
728 return 0;
729} 749}
730 750
731static int myri10ge_update_mac_address(struct myri10ge_priv *mgp, u8 * addr) 751static int myri10ge_update_mac_address(struct myri10ge_priv *mgp, u8 * addr)