[dpdk-dev] [PATCH v4 3/5] drivers/net/i40e: add Port Representor functionality

Xing, Beilei beilei.xing at intel.com
Wed Jan 10 08:56:47 CET 2018



> -----Original Message-----
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Remy Horton
> Sent: Monday, January 8, 2018 10:37 PM
> To: dev at dpdk.org
> Cc: Mcnamara, John <john.mcnamara at intel.com>; Lu, Wenzhuo
> <wenzhuo.lu at intel.com>; Wu, Jingjing <jingjing.wu at intel.com>; Doherty,
> Declan <declan.doherty at intel.com>; Awal, Mohammad Abdul
> <mohammad.abdul.awal at intel.com>
> Subject: [dpdk-dev] [PATCH v4 3/5] drivers/net/i40e: add Port Representor
> functionality
> 
> Port Representors provide a logical presentation in DPDK of VF (virtual
> function) ports for the purposes of control and monitoring. Each port
> representor device represents a single VF and is associated with it's parent
> physical function (PF) PMD which provides the back-end hooks for the
> representor device ops and defines the control domain to which that port
> belongs. This allows to use existing DPDK APIs to monitor and control the
> port without the need to create and maintain VF specific APIs.
> 
> This patch adds to the i40e PMD the functions required to enable port
> representor functionality.
> 
> Signed-off-by: Declan Doherty <declan.doherty at intel.com>
> Signed-off-by: Mohammad Abdul Awal <mohammad.abdul.awal at intel.com>
> Signed-off-by: Remy Horton <remy.horton at intel.com>
> ---
>  MAINTAINERS                      |   2 +
>  drivers/net/i40e/Makefile        |   1 +
>  drivers/net/i40e/i40e_ethdev.c   |  16 ++
>  drivers/net/i40e/i40e_ethdev.h   |   1 +
>  drivers/net/i40e/i40e_prep_ops.c | 495
> +++++++++++++++++++++++++++++++++++++++
>  drivers/net/i40e/i40e_prep_ops.h |  15 ++
> drivers/net/i40e/rte_pmd_i40e.c  |  47 ++++
> drivers/net/i40e/rte_pmd_i40e.h  |  18 ++
>  8 files changed, 595 insertions(+)
>  create mode 100644 drivers/net/i40e/i40e_prep_ops.c  create mode 100644
> drivers/net/i40e/i40e_prep_ops.h

<...>

> +	dev_info->rx_offload_capa =
> +		DEV_RX_OFFLOAD_VLAN_STRIP |
> +		DEV_RX_OFFLOAD_QINQ_STRIP |
> +		DEV_RX_OFFLOAD_IPV4_CKSUM |
> +		DEV_RX_OFFLOAD_UDP_CKSUM |
> +		DEV_RX_OFFLOAD_TCP_CKSUM;
> +	dev_info->tx_offload_capa =
> +		DEV_TX_OFFLOAD_VLAN_INSERT |
> +		DEV_TX_OFFLOAD_QINQ_INSERT |
> +		DEV_TX_OFFLOAD_IPV4_CKSUM |
> +		DEV_TX_OFFLOAD_UDP_CKSUM |
> +		DEV_TX_OFFLOAD_TCP_CKSUM |
> +		DEV_TX_OFFLOAD_SCTP_CKSUM;

Tunnel TSO and outer IP checksum are also supported.

<...>

> +static const struct ether_addr null_mac_addr;
> +
> +int
> +rte_pmd_i40e_remove_vf_mac_addr(uint8_t port, uint16_t vf_id,
> +	struct ether_addr *mac_addr)
> +{
> +	struct rte_eth_dev *dev;
> +	struct i40e_pf_vf *vf;
> +	struct i40e_vsi *vsi;
> +	struct i40e_pf *pf;
> +
> +	if (i40e_validate_mac_addr((u8 *)mac_addr) != I40E_SUCCESS)
> +		return -EINVAL;
> +
> +	RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
> +
> +	dev = &rte_eth_devices[port];
> +
> +	if (!is_i40e_supported(dev))
> +		return -ENOTSUP;
> +
> +	pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
> +
> +	if (vf_id >= pf->vf_num || !pf->vfs)
> +		return -EINVAL;
> +
> +	vf = &pf->vfs[vf_id];
> +	vsi = vf->vsi;
> +	if (!vsi) {
> +		PMD_DRV_LOG(ERR, "Invalid VSI.");
> +		return -EINVAL;
> +	}
> +
> +	if (!is_same_ether_addr(mac_addr, &vf->mac_addr)) {
> +		PMD_DRV_LOG(ERR, "Mac address does not match.");
> +		return -EINVAL;
> +	}

Not very understand why only vf->mac_addr can be moved? I think any mac address in vsi->mac_list can be removed.

> +
> +	/* reset the mac with null mac */
> +	ether_addr_copy(&null_mac_addr, &vf->mac_addr);
> +
> +	/* Remove the mac */
> +	i40e_vsi_delete_mac(vsi, mac_addr);
> +
> +	return 0;
> +}
> +


More information about the dev mailing list