[dpdk-dev] [PATCH v7 01/27] net/i40e: support link status notification
Wu, Jingjing
jingjing.wu at intel.com
Thu Jan 5 06:58:21 CET 2017
> -----Original Message-----
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Wenzhuo Lu
> Sent: Tuesday, January 3, 2017 2:54 PM
> To: dev at dpdk.org
> Cc: Lu, Wenzhuo <wenzhuo.lu at intel.com>
> Subject: [dpdk-dev] [PATCH v7 01/27] net/i40e: support link status notification
>
> Add an API to expose the ability, that PF can notify VF when link status changes,
> to APP.
> So if PF APP doesn't want to enable interruption but check link status by itself, PF
> APP can let VF know link status changed.
>
> Signed-off-by: Wenzhuo Lu <wenzhuo.lu at intel.com>
> ---
> drivers/net/i40e/Makefile | 4 ++-
> drivers/net/i40e/i40e_ethdev.c | 28 +++++++++++++++
> drivers/net/i40e/i40e_pf.c | 4 +--
> drivers/net/i40e/i40e_pf.h | 4 ++-
> drivers/net/i40e/rte_pmd_i40e.h | 58
> +++++++++++++++++++++++++++++++
> drivers/net/i40e/rte_pmd_i40e_version.map | 7 ++++
> 6 files changed, 101 insertions(+), 4 deletions(-) create mode 100644
> drivers/net/i40e/rte_pmd_i40e.h
>
> diff --git a/drivers/net/i40e/Makefile b/drivers/net/i40e/Makefile index
> 66997b6..a2ef53c 100644
> --- a/drivers/net/i40e/Makefile
> +++ b/drivers/net/i40e/Makefile
> @@ -1,6 +1,6 @@
> # BSD LICENSE
> #
> -# Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
> +# Copyright(c) 2010-2016 Intel Corporation. All rights reserved.
> # All rights reserved.
> #
> # Redistribution and use in source and binary forms, with or without
> @@ -111,6 +111,8 @@ ifeq ($(findstring
> RTE_MACHINE_CPUFLAG_SSE4_1,$(CFLAGS)),)
> CFLAGS_i40e_rxtx_vec_sse.o += -msse4.1
> endif
>
> +# install this header file
> +SYMLINK-$(CONFIG_RTE_LIBRTE_I40E_PMD)-include := rte_pmd_i40e.h
>
> # this lib depends upon:
> DEPDIRS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += lib/librte_eal lib/librte_ether
> diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
> index f42f4ba..fc7e987 100644
> --- a/drivers/net/i40e/i40e_ethdev.c
> +++ b/drivers/net/i40e/i40e_ethdev.c
> @@ -62,6 +62,7 @@
> #include "i40e_rxtx.h"
> #include "i40e_pf.h"
> #include "i40e_regs.h"
> +#include "rte_pmd_i40e.h"
>
> #define ETH_I40E_FLOATING_VEB_ARG "enable_floating_veb"
> #define ETH_I40E_FLOATING_VEB_LIST_ARG "floating_veb_list"
> @@ -9695,3 +9696,30 @@ static void i40e_set_default_mac_addr(struct
> rte_eth_dev *dev,
>
> return ret;
> }
> +
> +int
> +rte_pmd_i40e_ping_vfs(uint8_t port, uint16_t vf) {
> + struct rte_eth_dev *dev;
> + struct rte_eth_dev_info dev_info;
> + struct i40e_pf *pf;
> +
> + RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
> +
> + dev = &rte_eth_devices[port];
> + rte_eth_dev_info_get(port, &dev_info);
> +
> + if (vf >= dev_info.max_vfs)
> + return -EINVAL;
> +
> + pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
> +
> + if (vf > pf->vf_num - 1 || !pf->vfs) {
How about
if (!pf->vfs || vf > pf->vf_num - 1) {
because if vf_num is 0, the pf->vfs will be NULL.
Thanks
Jingjing
More information about the dev
mailing list