net/i40e: support ipn3ke FPGA port bonding

In ipn3ke, each FPGA network side port bonding to an i40e pf,
each i40e pf link status should get data from FPGA network,
side port. This patch provide bonding relationship.

Signed-off-by: Rosen Xu <rosen.xu@intel.com>
Signed-off-by: Andy Pei <andy.pei@intel.com>
This commit is contained in:
Andy Pei 2019-11-14 17:02:49 +08:00 committed by Ferruh Yigit
parent 99eafd1b7a
commit ec26c81df7
5 changed files with 55 additions and 1 deletions

View File

@ -660,6 +660,9 @@ struct i40e_hw {
struct i40e_nvm_info nvm;
struct i40e_fc_info fc;
/* switch device is used to get link status when i40e is in ipn3ke */
struct rte_eth_dev *switch_dev;
/* pci info */
u16 device_id;
u16 vendor_id;

View File

@ -1393,6 +1393,9 @@ eth_i40e_dev_init(struct rte_eth_dev *dev, void *init_params __rte_unused)
hw->adapter_stopped = 0;
hw->adapter_closed = 0;
/* Init switch device pointer */
hw->switch_dev = NULL;
/*
* Switch Tag value should not be identical to either the First Tag
* or Second Tag values. So set something other than common Ethertype
@ -2906,6 +2909,9 @@ i40e_dev_link_update(struct rte_eth_dev *dev,
else
update_link_aq(hw, &link, enable_lse, wait_to_complete);
if (hw->switch_dev)
rte_eth_linkstatus_get(hw->switch_dev, &link);
ret = rte_eth_linkstatus_set(dev, &link);
i40e_notify_all_vfs_link_status(dev);

View File

@ -3207,3 +3207,24 @@ rte_pmd_i40e_inset_set(uint16_t port, uint8_t pctype,
I40E_WRITE_FLUSH(hw);
return 0;
}
int
rte_pmd_i40e_set_switch_dev(uint16_t port_id, struct rte_eth_dev *switch_dev)
{
struct rte_eth_dev *i40e_dev;
struct i40e_hw *hw;
RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
i40e_dev = &rte_eth_devices[port_id];
if (!is_i40e_supported(i40e_dev))
return -ENOTSUP;
hw = I40E_DEV_PRIVATE_TO_HW(i40e_dev->data->dev_private);
if (!hw)
return -1;
hw->switch_dev = switch_dev;
return 0;
}

View File

@ -1061,4 +1061,22 @@ rte_pmd_i40e_inset_field_clear(uint64_t *inset, uint8_t field_idx)
return 0;
}
/**
* For ipn3ke, i40e works with FPGA.
* In this situation, i40e get link status from fpga,
* fpga works as switch_dev for i40e.
* This function set switch_dev for i40e.
*
* @param port_id
* port_id of i40e device to be set switch device.
* @param switch_dev
* target switch device from which i40e device to get link status from.
* @return
* - (less than 0) if failed.
* - (0) if success.
*/
__rte_experimental
int
rte_pmd_i40e_set_switch_dev(uint16_t port_id, struct rte_eth_dev *switch_dev);
#endif /* _PMD_I40E_H_ */

View File

@ -65,3 +65,9 @@ DPDK_18.02 {
rte_pmd_i40e_inset_get;
rte_pmd_i40e_inset_set;
} DPDK_17.11;
EXPERIMENTAL {
global:
rte_pmd_i40e_set_switch_dev;
};