New upstream version 17.11.5
[deb_dpdk.git] / drivers / net / octeontx / octeontx_ethdev.c
index eca3a39..049bc32 100644 (file)
@@ -127,7 +127,7 @@ octeontx_port_open(struct octeontx_nic *nic)
        int res;
 
        res = 0;
-
+       memset(&bgx_port_conf, 0x0, sizeof(bgx_port_conf));
        PMD_INIT_FUNC_TRACE();
 
        res = octeontx_bgx_port_open(nic->port_id, &bgx_port_conf);
@@ -377,6 +377,9 @@ octeontx_dev_close(struct rte_eth_dev *dev)
 
                rte_free(txq);
        }
+
+       dev->tx_pkt_burst = NULL;
+       dev->rx_pkt_burst = NULL;
 }
 
 static int
@@ -470,9 +473,6 @@ octeontx_dev_stop(struct rte_eth_dev *dev)
                             ret);
                return;
        }
-
-       dev->tx_pkt_burst = NULL;
-       dev->rx_pkt_burst = NULL;
 }
 
 static void
@@ -537,7 +537,6 @@ octeontx_dev_link_update(struct rte_eth_dev *dev,
        struct rte_eth_link link;
        int res;
 
-       res = 0;
        PMD_INIT_FUNC_TRACE();
 
        res = octeontx_port_link_status(nic);
@@ -571,6 +570,7 @@ octeontx_dev_link_update(struct rte_eth_dev *dev,
        case OCTEONTX_LINK_SPEED_RESERVE1:
        case OCTEONTX_LINK_SPEED_RESERVE2:
        default:
+               link.link_speed = ETH_SPEED_NUM_NONE;
                octeontx_log_err("incorrect link speed %d", nic->speed);
                break;
        }
@@ -892,10 +892,11 @@ octeontx_dev_rx_queue_setup(struct rte_eth_dev *dev, uint16_t qidx,
                pktbuf_conf.mmask.f_cache_mode = 1;
 
                pktbuf_conf.wqe_skip = OCTTX_PACKET_WQE_SKIP;
-               pktbuf_conf.first_skip = OCTTX_PACKET_FIRST_SKIP;
+               pktbuf_conf.first_skip = OCTTX_PACKET_FIRST_SKIP(mb_pool);
                pktbuf_conf.later_skip = OCTTX_PACKET_LATER_SKIP;
                pktbuf_conf.mbuff_size = (mb_pool->elt_size -
                                        RTE_PKTMBUF_HEADROOM -
+                                       rte_pktmbuf_priv_size(mb_pool) -
                                        sizeof(struct rte_mbuf));
 
                pktbuf_conf.cache_mode = PKI_OPC_MODE_STF2_STT;
@@ -1142,7 +1143,7 @@ octeontx_create(struct rte_vdev_device *dev, int port, uint8_t evdev,
        return data->port_id;
 
 err:
-       if (port)
+       if (nic)
                octeontx_port_close(nic);
 
        if (eth_dev != NULL) {
@@ -1263,15 +1264,8 @@ octeontx_probe(struct rte_vdev_device *dev)
                res = -EINVAL;
                goto parse_error;
        }
-       if (pnum > qnum) {
-               /*
-                * We don't poll on event ports
-                * that do not have any queues assigned.
-                */
-               pnum = qnum;
-               PMD_INIT_LOG(INFO,
-                       "reducing number of active event ports to %d", pnum);
-       }
+
+       /* Enable all queues available */
        for (i = 0; i < qnum; i++) {
                res = rte_event_queue_setup(evdev, i, NULL);
                if (res < 0) {
@@ -1281,6 +1275,7 @@ octeontx_probe(struct rte_vdev_device *dev)
                }
        }
 
+       /* Enable all ports available */
        for (i = 0; i < pnum; i++) {
                res = rte_event_port_setup(evdev, i, NULL);
                if (res < 0) {
@@ -1289,6 +1284,14 @@ octeontx_probe(struct rte_vdev_device *dev)
                                                i, res);
                        goto parse_error;
                }
+       }
+
+       /*
+        * Do 1:1 links for ports & queues. All queues would be mapped to
+        * one port. If there are more ports than queues, then some ports
+        * won't be linked to any queue.
+        */
+       for (i = 0; i < qnum; i++) {
                /* Link one queue to one event port */
                qlist = i;
                res = rte_event_port_link(evdev, i, &qlist, NULL, 1);