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: sta...@dpdk.org > Signed-off-by: Bernard Iremonger <bernard.iremon...@intel.com> > --- > 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. <...>