[dpdk-dev,v2] i40e: fix i40evf_add_mac_addr to permit multicast addresses
Checks
Commit Message
From: David Harton <dharton@cisco.com>
The i40e maintains a single MAC filter table for both
unicast and multicast addresses. The i40e_validate_mac_addr
function was preventing multicast addresses from being added
to the table via i40evf_add_mac_addr. Fixed the issue by
adjusting the check in i40evf_add_mac_addr.
Fixes: 4861cde46116 ("i40e: new poll mode driver")
Fixes: 97ac72aa71a9 ("i40e: support setting VF MAC address")
Signed-off-by: David Harton <dharton@cisco.com>
---
v2
* Removed multicast check in i40evf_add_mac_addr.
v1
* Removed multicast check in i40e_validate_mac_addr.
drivers/net/i40e/i40e_ethdev_vf.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
Hi Harton,
> -----Original Message-----
> From: David Harton [mailto:dharton@cpp-rtpbld-31.cpprtplab]
> Sent: Tuesday, September 12, 2017 9:02 PM
> To: Xing, Beilei <beilei.xing@intel.com>; Wu, Jingjing <jingjing.wu@intel.com>
> Cc: dev@dpdk.org; David Harton <dharton@cisco.com>
> Subject: [PATCH v2] i40e: fix i40evf_add_mac_addr to permit multicast
> addresses
>
> From: David Harton <dharton@cisco.com>
>
> The i40e maintains a single MAC filter table for both unicast and multicast
> addresses. The i40e_validate_mac_addr function was preventing multicast
> addresses from being added to the table via i40evf_add_mac_addr. Fixed
> the issue by adjusting the check in i40evf_add_mac_addr.
>
> Fixes: 4861cde46116 ("i40e: new poll mode driver")
> Fixes: 97ac72aa71a9 ("i40e: support setting VF MAC address")
>
> Signed-off-by: David Harton <dharton@cisco.com>
> ---
>
> v2
> * Removed multicast check in i40evf_add_mac_addr.
>
> v1
> * Removed multicast check in i40e_validate_mac_addr.
>
> drivers/net/i40e/i40e_ethdev_vf.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/i40e/i40e_ethdev_vf.c
> b/drivers/net/i40e/i40e_ethdev_vf.c
> index f6d8293..5916d11 100644
> --- a/drivers/net/i40e/i40e_ethdev_vf.c
> +++ b/drivers/net/i40e/i40e_ethdev_vf.c
> @@ -888,7 +888,7 @@ i40evf_add_mac_addr(struct rte_eth_dev *dev,
> int err;
> struct vf_cmd_info args;
>
> - if (i40e_validate_mac_addr(addr->addr_bytes) != I40E_SUCCESS) {
> + if (is_zero_ether_addr(addr) != I40E_SUCCESS) {
Thanks for the patch, there's some mistake with my last comment.
* @return
* True (1) if the given ethernet address is filled with zeros;
* false (0) otherwise.
*/
According to the comment of is_zero_ether_addr function, return value should be 0 or 1.
So you should use if (!is_zero_ether_addr(addr)) here.
> PMD_DRV_LOG(ERR, "Invalid mac:%x:%x:%x:%x:%x:%x",
> addr->addr_bytes[0], addr->addr_bytes[1],
> addr->addr_bytes[2], addr->addr_bytes[3],
> --
> 2.10.3.dirty
Hi Beilei,
> -----Original Message-----
> From: Xing, Beilei [mailto:beilei.xing@intel.com]
>
> Hi Harton,
>
> > -----Original Message-----
> > From: David Harton [mailto:dharton@cpp-rtpbld-31.cpprtplab]
> >
> > From: David Harton <dharton@cisco.com>
> >
> > The i40e maintains a single MAC filter table for both unicast and
> > multicast addresses. The i40e_validate_mac_addr function was
> > preventing multicast addresses from being added to the table via
> > i40evf_add_mac_addr. Fixed the issue by adjusting the check in
> i40evf_add_mac_addr.
> >
> > Fixes: 4861cde46116 ("i40e: new poll mode driver")
> > Fixes: 97ac72aa71a9 ("i40e: support setting VF MAC address")
> >
> > Signed-off-by: David Harton <dharton@cisco.com>
> > ---
> >
> > v2
> > * Removed multicast check in i40evf_add_mac_addr.
> >
> > v1
> > * Removed multicast check in i40e_validate_mac_addr.
> >
> > drivers/net/i40e/i40e_ethdev_vf.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/net/i40e/i40e_ethdev_vf.c
> > b/drivers/net/i40e/i40e_ethdev_vf.c
> > index f6d8293..5916d11 100644
> > --- a/drivers/net/i40e/i40e_ethdev_vf.c
> > +++ b/drivers/net/i40e/i40e_ethdev_vf.c
> > @@ -888,7 +888,7 @@ i40evf_add_mac_addr(struct rte_eth_dev *dev,
> > int err;
> > struct vf_cmd_info args;
> >
> > - if (i40e_validate_mac_addr(addr->addr_bytes) != I40E_SUCCESS) {
> > + if (is_zero_ether_addr(addr) != I40E_SUCCESS) {
>
> Thanks for the patch, there's some mistake with my last comment.
Actually, I think the logic above works but I do agree it is confusing
but I wanted to use your suggestion to speed up the process. :)
> * @return
> * True (1) if the given ethernet address is filled with zeros;
> * false (0) otherwise.
> */
> According to the comment of is_zero_ether_addr function, return value
> should be 0 or 1.
> So you should use if (!is_zero_ether_addr(addr)) here.
I don't think so. I think the logic that should be used is
if (is_zero_ether_addr(addr)) {
because we want to report an error if the addr is all 0's.
Please let me know if you agree and I'll post this patch instead.
Thanks,
Dave
>
> > PMD_DRV_LOG(ERR, "Invalid mac:%x:%x:%x:%x:%x:%x",
> > addr->addr_bytes[0], addr->addr_bytes[1],
> > addr->addr_bytes[2], addr->addr_bytes[3],
> > --
> > 2.10.3.dirty
> -----Original Message-----
> From: David Harton (dharton) [mailto:dharton@cisco.com]
> Sent: Wednesday, September 13, 2017 10:38 AM
> To: Xing, Beilei <beilei.xing@intel.com>; David Harton <dharton@cpp-rtpbld-
> 31.cpprtplab>; Wu, Jingjing <jingjing.wu@intel.com>
> Cc: dev@dpdk.org
> Subject: RE: [PATCH v2] i40e: fix i40evf_add_mac_addr to permit multicast
> addresses
>
> Hi Beilei,
>
> > -----Original Message-----
> > From: Xing, Beilei [mailto:beilei.xing@intel.com]
> >
> > Hi Harton,
> >
> > > -----Original Message-----
> > > From: David Harton [mailto:dharton@cpp-rtpbld-31.cpprtplab]
> > >
> > > From: David Harton <dharton@cisco.com>
> > >
> > > The i40e maintains a single MAC filter table for both unicast and
> > > multicast addresses. The i40e_validate_mac_addr function was
> > > preventing multicast addresses from being added to the table via
> > > i40evf_add_mac_addr. Fixed the issue by adjusting the check in
> > i40evf_add_mac_addr.
> > >
> > > Fixes: 4861cde46116 ("i40e: new poll mode driver")
> > > Fixes: 97ac72aa71a9 ("i40e: support setting VF MAC address")
> > >
> > > Signed-off-by: David Harton <dharton@cisco.com>
> > > ---
> > >
> > > v2
> > > * Removed multicast check in i40evf_add_mac_addr.
> > >
> > > v1
> > > * Removed multicast check in i40e_validate_mac_addr.
> > >
> > > drivers/net/i40e/i40e_ethdev_vf.c | 2 +-
> > > 1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/net/i40e/i40e_ethdev_vf.c
> > > b/drivers/net/i40e/i40e_ethdev_vf.c
> > > index f6d8293..5916d11 100644
> > > --- a/drivers/net/i40e/i40e_ethdev_vf.c
> > > +++ b/drivers/net/i40e/i40e_ethdev_vf.c
> > > @@ -888,7 +888,7 @@ i40evf_add_mac_addr(struct rte_eth_dev *dev,
> > > int err;
> > > struct vf_cmd_info args;
> > >
> > > - if (i40e_validate_mac_addr(addr->addr_bytes) != I40E_SUCCESS) {
> > > + if (is_zero_ether_addr(addr) != I40E_SUCCESS) {
> >
> > Thanks for the patch, there's some mistake with my last comment.
>
> Actually, I think the logic above works but I do agree it is confusing but I
> wanted to use your suggestion to speed up the process. :)
>
> > * @return
> > * True (1) if the given ethernet address is filled with zeros;
> > * false (0) otherwise.
> > */
> > According to the comment of is_zero_ether_addr function, return value
> > should be 0 or 1.
> > So you should use if (!is_zero_ether_addr(addr)) here.
>
> I don't think so. I think the logic that should be used is if
> (is_zero_ether_addr(addr)) { because we want to report an error if the addr
> is all 0's.
>
Yes, correct:)
> Please let me know if you agree and I'll post this patch instead.
>
> Thanks,
> Dave
>
> >
> > > PMD_DRV_LOG(ERR, "Invalid mac:%x:%x:%x:%x:%x:%x",
> > > addr->addr_bytes[0], addr->addr_bytes[1],
> > > addr->addr_bytes[2], addr->addr_bytes[3],
> > > --
> > > 2.10.3.dirty
@@ -888,7 +888,7 @@ i40evf_add_mac_addr(struct rte_eth_dev *dev,
int err;
struct vf_cmd_info args;
- if (i40e_validate_mac_addr(addr->addr_bytes) != I40E_SUCCESS) {
+ if (is_zero_ether_addr(addr) != I40E_SUCCESS) {
PMD_DRV_LOG(ERR, "Invalid mac:%x:%x:%x:%x:%x:%x",
addr->addr_bytes[0], addr->addr_bytes[1],
addr->addr_bytes[2], addr->addr_bytes[3],