net/octeontx: add application domain validation
[dpdk.git] / drivers / net / octeontx / octeontx_ethdev.c
index 00686ea..c2258d1 100644 (file)
@@ -308,7 +308,7 @@ octeontx_dev_configure(struct rte_eth_dev *dev)
 
        nic->num_tx_queues = dev->data->nb_tx_queues;
 
-       ret = octeontx_pko_channel_open(nic->port_id * PKO_VF_NUM_DQ,
+       ret = octeontx_pko_channel_open(nic->pko_vfid * PKO_VF_NUM_DQ,
                                        nic->num_tx_queues,
                                        nic->base_ochan);
        if (ret) {
@@ -719,7 +719,7 @@ octeontx_dev_tx_queue_setup(struct rte_eth_dev *dev, uint16_t qidx,
        RTE_SET_USED(nb_desc);
        RTE_SET_USED(socket_id);
 
-       dq_num = (nic->port_id * PKO_VF_NUM_DQ) + qidx;
+       dq_num = (nic->pko_vfid * PKO_VF_NUM_DQ) + qidx;
 
        /* Socket id check */
        if (socket_id != (unsigned int)SOCKET_ID_ANY &&
@@ -1001,6 +1001,7 @@ octeontx_create(struct rte_vdev_device *dev, int port, uint8_t evdev,
                        int socket_id)
 {
        int res;
+       size_t pko_vfid;
        char octtx_name[OCTEONTX_MAX_NAME_LEN];
        struct octeontx_nic *nic = NULL;
        struct rte_eth_dev *eth_dev = NULL;
@@ -1039,7 +1040,15 @@ octeontx_create(struct rte_vdev_device *dev, int port, uint8_t evdev,
                goto err;
        }
        data->dev_private = nic;
+       pko_vfid = octeontx_pko_get_vfid();
 
+       if (pko_vfid == SIZE_MAX) {
+               octeontx_log_err("failed to get pko vfid");
+               res = -ENODEV;
+               goto err;
+       }
+
+       nic->pko_vfid = pko_vfid;
        nic->port_id = port;
        nic->evdev = evdev;