mpipe: fix link initialization ordering
[dpdk.git] / drivers / net / cxgbe / cxgbe_ethdev.c
index 7884642..97ef152 100644 (file)
@@ -405,23 +405,33 @@ static int cxgbe_dev_configure(struct rte_eth_dev *eth_dev)
 static int cxgbe_dev_tx_queue_start(struct rte_eth_dev *eth_dev,
                                    uint16_t tx_queue_id)
 {
+       int ret;
        struct sge_eth_txq *txq = (struct sge_eth_txq *)
                                  (eth_dev->data->tx_queues[tx_queue_id]);
 
        dev_debug(NULL, "%s: tx_queue_id = %d\n", __func__, tx_queue_id);
 
-       return t4_sge_eth_txq_start(txq);
+       ret = t4_sge_eth_txq_start(txq);
+       if (ret == 0)
+               eth_dev->data->tx_queue_state[tx_queue_id] = RTE_ETH_QUEUE_STATE_STARTED;
+
+       return ret;
 }
 
 static int cxgbe_dev_tx_queue_stop(struct rte_eth_dev *eth_dev,
                                   uint16_t tx_queue_id)
 {
+       int ret;
        struct sge_eth_txq *txq = (struct sge_eth_txq *)
                                  (eth_dev->data->tx_queues[tx_queue_id]);
 
        dev_debug(NULL, "%s: tx_queue_id = %d\n", __func__, tx_queue_id);
 
-       return t4_sge_eth_txq_stop(txq);
+       ret = t4_sge_eth_txq_stop(txq);
+       if (ret == 0)
+               eth_dev->data->tx_queue_state[tx_queue_id] = RTE_ETH_QUEUE_STATE_STOPPED;
+
+       return ret;
 }
 
 static int cxgbe_dev_tx_queue_setup(struct rte_eth_dev *eth_dev,
@@ -497,6 +507,7 @@ static void cxgbe_dev_tx_queue_release(void *q)
 static int cxgbe_dev_rx_queue_start(struct rte_eth_dev *eth_dev,
                                    uint16_t rx_queue_id)
 {
+       int ret;
        struct port_info *pi = (struct port_info *)(eth_dev->data->dev_private);
        struct adapter *adap = pi->adapter;
        struct sge_rspq *q;
@@ -505,12 +516,18 @@ static int cxgbe_dev_rx_queue_start(struct rte_eth_dev *eth_dev,
                  __func__, pi->port_id, rx_queue_id);
 
        q = eth_dev->data->rx_queues[rx_queue_id];
-       return t4_sge_eth_rxq_start(adap, q);
+
+       ret = t4_sge_eth_rxq_start(adap, q);
+       if (ret == 0)
+               eth_dev->data->rx_queue_state[rx_queue_id] = RTE_ETH_QUEUE_STATE_STARTED;
+
+       return ret;
 }
 
 static int cxgbe_dev_rx_queue_stop(struct rte_eth_dev *eth_dev,
                                   uint16_t rx_queue_id)
 {
+       int ret;
        struct port_info *pi = (struct port_info *)(eth_dev->data->dev_private);
        struct adapter *adap = pi->adapter;
        struct sge_rspq *q;
@@ -519,7 +536,11 @@ static int cxgbe_dev_rx_queue_stop(struct rte_eth_dev *eth_dev,
                  __func__, pi->port_id, rx_queue_id);
 
        q = eth_dev->data->rx_queues[rx_queue_id];
-       return t4_sge_eth_rxq_stop(adap, q);
+       ret = t4_sge_eth_rxq_stop(adap, q);
+       if (ret == 0)
+               eth_dev->data->rx_queue_state[rx_queue_id] = RTE_ETH_QUEUE_STATE_STOPPED;
+
+       return ret;
 }
 
 static int cxgbe_dev_rx_queue_setup(struct rte_eth_dev *eth_dev,
@@ -639,18 +660,14 @@ static void cxgbe_dev_stats_get(struct rte_eth_dev *eth_dev,
                              ps.rx_ovflow2 + ps.rx_ovflow3 +
                              ps.rx_trunc0 + ps.rx_trunc1 +
                              ps.rx_trunc2 + ps.rx_trunc3;
-       eth_stats->ibadcrc  = ps.rx_fcs_err;
-       eth_stats->ibadlen  = ps.rx_jabber + ps.rx_too_long + ps.rx_runt;
-       eth_stats->ierrors  = ps.rx_symbol_err + eth_stats->ibadcrc +
-                             eth_stats->ibadlen + ps.rx_len_err +
-                             eth_stats->imissed;
-       eth_stats->rx_pause_xon  = ps.rx_pause;
+       eth_stats->ierrors  = ps.rx_symbol_err + ps.rx_fcs_err +
+                             ps.rx_jabber + ps.rx_too_long + ps.rx_runt +
+                             ps.rx_len_err + eth_stats->imissed;
 
        /* TX Stats */
        eth_stats->opackets = ps.tx_frames;
        eth_stats->obytes   = ps.tx_octets;
        eth_stats->oerrors  = ps.tx_error_frames;
-       eth_stats->tx_pause_xon  = ps.tx_pause;
 
        for (i = 0; i < pi->n_rx_qsets; i++) {
                struct sge_eth_rxq *rxq =
@@ -830,7 +847,7 @@ out_free_adapter:
 }
 
 static struct eth_driver rte_cxgbe_pmd = {
-       {
+       .pci_drv = {
                .name = "rte_cxgbe_pmd",
                .id_table = cxgb4_pci_tbl,
                .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,