Hi,

> -----Original Message-----
> From: Zhang, Tianfei <tianfei.zh...@intel.com>
> Sent: Wednesday, November 25, 2020 15:19
> To: dev@dpdk.org; Xu, Rosen <rosen...@intel.com>; Zhang, Qi Z
> <qi.z.zh...@intel.com>
> Cc: Zhang, Tianfei <tianfei.zh...@intel.com>; sta...@dpdk.org
> Subject: [PATCH] raw/ifpga/base: release eth group devices
> 
> From: Tianfei zhang <tianfei.zh...@intel.com>
> 
> Release the eth group resource in fme_eth_group_uinit().
> 
> Fixes: 8a256bef32 ("raw/ifpga/base: add eth group driver")
> Cc: sta...@dpdk.org
> 
> Signed-off-by: Tianfei zhang <tianfei.zh...@intel.com>
> ---
>  drivers/raw/ifpga/base/ifpga_fme.c | 20 +++++++++++++++++++-
>  1 file changed, 19 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/raw/ifpga/base/ifpga_fme.c
> b/drivers/raw/ifpga/base/ifpga_fme.c
> index f29ff31..0a7d3c2 100644
> --- a/drivers/raw/ifpga/base/ifpga_fme.c
> +++ b/drivers/raw/ifpga/base/ifpga_fme.c
> @@ -1288,9 +1288,27 @@ static int fme_eth_group_init(struct ifpga_feature
> *feature)
>       return 0;
>  }
> 
> +static unsigned char fme_eth_group_get_gid(void *base) {
> +     struct eth_group_info_reg info;
> +
> +     info.info = opae_readq((u8 *)base + ETH_GROUP_INFO);
> +
> +     return info.group_id;
> +}
> +
>  static void fme_eth_group_uinit(struct ifpga_feature *feature)  {
> -     UNUSED(feature);
> +     struct ifpga_fme_hw *fme = (struct ifpga_fme_hw *)feature->parent;
> +     struct eth_group_device *dev;
> +     unsigned char group_id = fme_eth_group_get_gid(feature->addr);
> +
> +     if (group_id >= MAX_ETH_GROUP_DEVICES)
> +             return;
> +
> +     dev = fme->eth_dev[group_id];
> +     if (dev)
> +             eth_group_release(dev);
>  }
> 
>  struct ifpga_feature_ops fme_eth_group_ops = {
> --
> 1.8.3.1

Reviewed-by: Rosen Xu <rosen...@intel.com>

Reply via email to