From: Praveen Shetty <[email protected]>

This patch adds the registration support for a new vCPF PMD.
vCPF PMD is responsible for enabling control and data path
functionality for the CPF VF devices.

Signed-off-by: Praveen Shetty <[email protected]>
Tested-by: Atul Patel  <[email protected]>
Tested-by: Dhananjay Shukla <[email protected]>
---
 drivers/net/intel/cpfl/cpfl_ethdev.c        | 17 +++++++++++++++++
 drivers/net/intel/idpf/idpf_common_device.c |  4 ++--
 drivers/net/intel/idpf/idpf_common_device.h |  1 +
 3 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/drivers/net/intel/cpfl/cpfl_ethdev.c 
b/drivers/net/intel/cpfl/cpfl_ethdev.c
index 6d7b23ad7a..6aa0971941 100644
--- a/drivers/net/intel/cpfl/cpfl_ethdev.c
+++ b/drivers/net/intel/cpfl/cpfl_ethdev.c
@@ -1854,6 +1854,7 @@ cpfl_handle_virtchnl_msg(struct cpfl_adapter_ext *adapter)
 
                switch (mbx_op) {
                case idpf_mbq_opc_send_msg_to_peer_pf:
+               case idpf_mbq_opc_send_msg_to_peer_drv:
                        if (vc_op == VIRTCHNL2_OP_EVENT) {
                                cpfl_handle_vchnl_event_msg(adapter, 
adapter->base.mbx_resp,
                                                            ctlq_msg.data_len);
@@ -2610,6 +2611,11 @@ static const struct rte_pci_id pci_id_cpfl_map[] = {
        { .vendor_id = 0, /* sentinel */ },
 };
 
+static const struct rte_pci_id pci_id_vcpf_map[] = {
+       { RTE_PCI_DEVICE(IDPF_INTEL_VENDOR_ID, IXD_DEV_ID_VCPF) },
+       { .vendor_id = 0, /* sentinel */ },
+};
+
 static struct cpfl_adapter_ext *
 cpfl_find_adapter_ext(struct rte_pci_device *pci_dev)
 {
@@ -2866,6 +2872,14 @@ static struct rte_pci_driver rte_cpfl_pmd = {
        .remove         = cpfl_pci_remove,
 };
 
+static struct rte_pci_driver rte_vcpf_pmd = {
+       .id_table       = pci_id_vcpf_map,
+       .drv_flags      = RTE_PCI_DRV_NEED_MAPPING |
+                         RTE_PCI_DRV_PROBE_AGAIN,
+       .probe          = cpfl_pci_probe,
+       .remove         = cpfl_pci_remove,
+};
+
 /**
  * Driver initialization routine.
  * Invoked once at EAL init time.
@@ -2874,6 +2888,9 @@ static struct rte_pci_driver rte_cpfl_pmd = {
 RTE_PMD_REGISTER_PCI(net_cpfl, rte_cpfl_pmd);
 RTE_PMD_REGISTER_PCI_TABLE(net_cpfl, pci_id_cpfl_map);
 RTE_PMD_REGISTER_KMOD_DEP(net_cpfl, "* igb_uio | vfio-pci");
+RTE_PMD_REGISTER_PCI(net_vcpf, rte_vcpf_pmd);
+RTE_PMD_REGISTER_PCI_TABLE(net_vcpf, pci_id_vcpf_map);
+RTE_PMD_REGISTER_KMOD_DEP(net_vcpf, "vfio-pci");
 RTE_PMD_REGISTER_PARAM_STRING(net_cpfl,
        CPFL_TX_SINGLE_Q "=<0|1> "
        CPFL_RX_SINGLE_Q "=<0|1> "
diff --git a/drivers/net/intel/idpf/idpf_common_device.c 
b/drivers/net/intel/idpf/idpf_common_device.c
index ff1fbcd2b4..8c637a2fb6 100644
--- a/drivers/net/intel/idpf/idpf_common_device.c
+++ b/drivers/net/intel/idpf/idpf_common_device.c
@@ -130,7 +130,7 @@ idpf_init_mbx(struct idpf_hw *hw)
        struct idpf_ctlq_info *ctlq;
        int ret = 0;
 
-       if (hw->device_id == IDPF_DEV_ID_SRIOV)
+       if (hw->device_id == IDPF_DEV_ID_SRIOV || hw->device_id == 
IXD_DEV_ID_VCPF)
                ret = idpf_ctlq_init(hw, IDPF_CTLQ_NUM, vf_ctlq_info);
        else
                ret = idpf_ctlq_init(hw, IDPF_CTLQ_NUM, pf_ctlq_info);
@@ -389,7 +389,7 @@ idpf_adapter_init(struct idpf_adapter *adapter)
        struct idpf_hw *hw = &adapter->hw;
        int ret;
 
-       if (hw->device_id == IDPF_DEV_ID_SRIOV) {
+       if (hw->device_id == IDPF_DEV_ID_SRIOV || hw->device_id == 
IXD_DEV_ID_VCPF) {
                ret = idpf_check_vf_reset_done(hw);
        } else {
                idpf_reset_pf(hw);
diff --git a/drivers/net/intel/idpf/idpf_common_device.h 
b/drivers/net/intel/idpf/idpf_common_device.h
index 5f3e4a4fcf..d536ce7e15 100644
--- a/drivers/net/intel/idpf/idpf_common_device.h
+++ b/drivers/net/intel/idpf/idpf_common_device.h
@@ -11,6 +11,7 @@
 #include "idpf_common_logs.h"
 
 #define IDPF_DEV_ID_SRIOV      0x145C
+#define IXD_DEV_ID_VCPF         0x1203
 
 #define IDPF_RSS_KEY_LEN       52
 
-- 
2.37.3

Reply via email to