net/bnxt: add link state operations
authorAjit Khaparde <ajit.khaparde@broadcom.com>
Wed, 15 Jun 2016 21:23:35 +0000 (14:23 -0700)
committerBruce Richardson <bruce.richardson@intel.com>
Mon, 20 Jun 2016 15:21:53 +0000 (17:21 +0200)
Adds dev_ops to set link Up or Down as appropriate.
Uses the bnxt_set_hwrm_link_config() API added previously.

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: Stephen Hurd <stephen.hurd@broadcom.com>
Reviewed-by: David Christensen <david.christensen@broadcom.com>
drivers/net/bnxt/bnxt_ethdev.c

index 34a5873..b04010c 100644 (file)
@@ -380,6 +380,24 @@ error:
        return rc;
 }
 
+static int bnxt_dev_set_link_up_op(struct rte_eth_dev *eth_dev)
+{
+       struct bnxt *bp = (struct bnxt *)eth_dev->data->dev_private;
+
+       eth_dev->data->dev_link.link_status = 1;
+       bnxt_set_hwrm_link_config(bp, true);
+       return 0;
+}
+
+static int bnxt_dev_set_link_down_op(struct rte_eth_dev *eth_dev)
+{
+       struct bnxt *bp = (struct bnxt *)eth_dev->data->dev_private;
+
+       eth_dev->data->dev_link.link_status = 0;
+       bnxt_set_hwrm_link_config(bp, false);
+       return 0;
+}
+
 static void bnxt_dev_close_op(struct rte_eth_dev *eth_dev)
 {
        struct bnxt *bp = (struct bnxt *)eth_dev->data->dev_private;
@@ -574,6 +592,8 @@ static struct eth_dev_ops bnxt_dev_ops = {
        .dev_configure = bnxt_dev_configure_op,
        .dev_start = bnxt_dev_start_op,
        .dev_stop = bnxt_dev_stop_op,
+       .dev_set_link_up = bnxt_dev_set_link_up_op,
+       .dev_set_link_down = bnxt_dev_set_link_down_op,
        .stats_get = bnxt_stats_get_op,
        .stats_reset = bnxt_stats_reset_op,
        .rx_queue_setup = bnxt_rx_queue_setup_op,