ixgbe: negotiate VF API version
authorOuyang Changchun <changchun.ouyang@intel.com>
Mon, 12 Jan 2015 05:59:08 +0000 (13:59 +0800)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Sun, 18 Jan 2015 22:11:41 +0000 (23:11 +0100)
Negotiate API version with VF when receiving the IXGBE_VF_API_NEGOTIATE message.

Signed-off-by: Changchun Ouyang <changchun.ouyang@intel.com>
Reviewed-by: Vlad Zolotarov <vladz@cloudius-systems.com>
lib/librte_pmd_ixgbe/ixgbe_ethdev.h
lib/librte_pmd_ixgbe/ixgbe_pf.c

index ca99170..730098d 100644 (file)
@@ -159,6 +159,7 @@ struct ixgbe_vf_info {
        uint16_t tx_rate[IXGBE_MAX_QUEUE_NUM_PER_VF];
        uint16_t vlan_count;
        uint8_t spoofchk_enabled;
+       uint8_t api_version;
 };
 
 /*
index 51da1fd..495aff5 100644 (file)
@@ -468,6 +468,28 @@ ixgbe_set_vf_lpe(struct rte_eth_dev *dev, __rte_unused uint32_t vf, uint32_t *ms
        return 0;
 }
 
+static int
+ixgbe_negotiate_vf_api(struct rte_eth_dev *dev, uint32_t vf, uint32_t *msgbuf)
+{
+       uint32_t api_version = msgbuf[1];
+       struct ixgbe_vf_info *vfinfo =
+               *IXGBE_DEV_PRIVATE_TO_P_VFDATA(dev->data->dev_private);
+
+       switch (api_version) {
+       case ixgbe_mbox_api_10:
+       case ixgbe_mbox_api_11:
+               vfinfo[vf].api_version = (uint8_t)api_version;
+               return 0;
+       default:
+               break;
+       }
+
+       RTE_LOG(ERR, PMD, "Negotiate invalid api version %u from VF %d\n",
+               api_version, vf);
+
+       return -1;
+}
+
 static int
 ixgbe_rcv_msg_from_vf(struct rte_eth_dev *dev, uint16_t vf)
 {
@@ -512,6 +534,9 @@ ixgbe_rcv_msg_from_vf(struct rte_eth_dev *dev, uint16_t vf)
        case IXGBE_VF_SET_VLAN:
                retval = ixgbe_vf_set_vlan(dev, vf, msgbuf);
                break;
+       case IXGBE_VF_API_NEGOTIATE:
+               retval = ixgbe_negotiate_vf_api(dev, vf, msgbuf);
+               break;
        default:
                PMD_DRV_LOG(DEBUG, "Unhandled Msg %8.8x", (unsigned)msgbuf[0]);
                retval = IXGBE_ERR_MBX;