From: Ferruh Yigit Subject: Re: [dpdk-stable] [PATCH] net/ixgbe: fix API parameter checking Date: Wed, 11 Jan 2017 15:15:13 +0000 Message-ID: References: <1484144751-10412-1-git-send-email-bernard.iremonger@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit Cc: stable@dpdk.org To: Bernard Iremonger , dev@dpdk.org, wenzhuo.lu@intel.com Return-path: In-Reply-To: <1484144751-10412-1-git-send-email-bernard.iremonger@intel.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On 1/11/2017 2:25 PM, Bernard Iremonger wrote: > Add checks to rte_pmd_ixgbe_* API's to ensure that the port > is an ixgbe port. > > Fixes: 49e248223e9f ("net/ixgbe: add API for VF management") > > CC: stable@dpdk.org > Signed-off-by: Bernard Iremonger > --- > drivers/net/ixgbe/ixgbe_ethdev.c | 71 ++++++++++++++++++++++++++++++++++++++-- > 1 file changed, 69 insertions(+), 2 deletions(-) > > diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c > index b7ddd4f..ca14104 100644 > --- a/drivers/net/ixgbe/ixgbe_ethdev.c > +++ b/drivers/net/ixgbe/ixgbe_ethdev.c > @@ -1,7 +1,7 @@ > /*- > * BSD LICENSE > * > - * Copyright(c) 2010-2016 Intel Corporation. All rights reserved. > + * Copyright(c) 2010-2017 Intel Corporation. All rights reserved. > * All rights reserved. > * > * Redistribution and use in source and binary forms, with or without > @@ -4066,6 +4066,12 @@ rte_pmd_ixgbe_set_vf_mac_addr(uint8_t port, uint16_t vf, > dev = &rte_eth_devices[port]; > rte_eth_dev_info_get(port, &dev_info); > > + if (!strstr(dev_info.driver_name, "ixgbe")) > + return -ENOTSUP; > + > + if (strstr(dev_info.driver_name, "ixgbe_vf")) > + return -ENOTSUP; > + This part seems common for all functions, what do you think exporting this into a static function? Also in the feature if you need to update the method to decide if this port_id is supported or not, only that function will be effected. <...>