DPDK patches and discussions
 help / color / mirror / Atom feed
From: "David Harton (dharton)" <dharton@cisco.com>
To: Ferruh Yigit <ferruh.yigit@intel.com>,
	"jingjing.wu@intel.com" <jingjing.wu@intel.com>,
	"beilei.xing@intel.com" <beilei.xing@intel.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH] i40e: fix i40e_validate_mac_addr to permit multicast addresses
Date: Thu, 31 Aug 2017 16:04:01 +0000	[thread overview]
Message-ID: <bc06b6ee0df146678313bfab8bd453d0@XCH-RCD-016.cisco.com> (raw)
In-Reply-To: <ad0ebe30-a8db-1e5e-1554-efb86fbf999f@intel.com>



> -----Original Message-----
> From: Ferruh Yigit [mailto:ferruh.yigit@intel.com]
> Sent: Thursday, August 31, 2017 11:54 AM
> To: David Harton (dharton) <dharton@cisco.com>; jingjing.wu@intel.com;
> beilei.xing@intel.com
> Cc: dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH] i40e: fix i40e_validate_mac_addr to permit
> multicast addresses
> 
> On 8/22/2017 11:21 PM, David Harton wrote:
> > 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 removing the multicast
> > address check in i40e_validate_mac_addr.
> >
> > Signed-off-by: David Harton <dharton@cisco.com>
> > ---
> >  drivers/net/i40e/base/i40e_common.c | 12 +++++-------
> >  drivers/net/i40e/i40e_ethdev.c      |  3 ++-
> >  2 files changed, 7 insertions(+), 8 deletions(-)
> >
> > diff --git a/drivers/net/i40e/base/i40e_common.c
> > b/drivers/net/i40e/base/i40e_common.c
> > index 900d379..9779854 100644
> > --- a/drivers/net/i40e/base/i40e_common.c
> > +++ b/drivers/net/i40e/base/i40e_common.c
> > @@ -969,10 +969,10 @@ struct i40e_rx_ptype_decoded i40e_ptype_lookup[]
> > = {
> >
> >
> >  /**
> > - * i40e_validate_mac_addr - Validate unicast MAC address
> > + * i40e_validate_mac_addr - Validate MAC address
> >   * @mac_addr: pointer to MAC address
> >   *
> > - * Tests a MAC address to ensure it is a valid Individual Address
> > + * Tests a MAC address to ensure it is a valid Address
> >   **/
> >  enum i40e_status_code i40e_validate_mac_addr(u8 *mac_addr)  { @@
> > -980,13 +980,11 @@ enum i40e_status_code i40e_validate_mac_addr(u8
> > *mac_addr)
> >
> >  	DEBUGFUNC("i40e_validate_mac_addr");
> >
> > -	/* Broadcast addresses ARE multicast addresses
> > -	 * Make sure it is not a multicast address
> > +	/*
> >  	 * Reject the zero address
> >  	 */
> > -	if (I40E_IS_MULTICAST(mac_addr) ||
> > -	    (mac_addr[0] == 0 && mac_addr[1] == 0 && mac_addr[2] == 0 &&
> > -	      mac_addr[3] == 0 && mac_addr[4] == 0 && mac_addr[5] == 0))
> > +	if (mac_addr[0] == 0 && mac_addr[1] == 0 && mac_addr[2] == 0 &&
> > +	    mac_addr[3] == 0 && mac_addr[4] == 0 && mac_addr[5] == 0)
> >  		status = I40E_ERR_INVALID_MAC_ADDR;
> >
> >  	return status;
> > diff --git a/drivers/net/i40e/i40e_ethdev.c
> > b/drivers/net/i40e/i40e_ethdev.c index 5f26e24..00b6082 100644
> > --- a/drivers/net/i40e/i40e_ethdev.c
> > +++ b/drivers/net/i40e/i40e_ethdev.c
> > @@ -1199,7 +1199,8 @@ eth_i40e_dev_init(struct rte_eth_dev *dev)
> >
> >  	/* Get and check the mac address */
> >  	i40e_get_mac_addr(hw, hw->mac.addr);
> > -	if (i40e_validate_mac_addr(hw->mac.addr) != I40E_SUCCESS) {
> > +	if (i40e_validate_mac_addr(hw->mac.addr) != I40E_SUCCESS ||
> > +	    I40E_IS_MULTICAST(hw->mac.addr)) {
> 
> As far as I can see this is to set PF permanent mac address during init(),
> i40e_macaddr_add() can be used to set multicast address filters.
> Why do you want to set multicast address as mac permanent address?
> 
> Any chance that you want to update i40evf_add_mac_addr() to let multicast
> addresses?

No.  I'm preserving the existing behavior here.  The previous call used to ensure that the permanent mac address here was both non-null and not a multi-cast address.

Since I removed the multi cast check from i40e_validate_mac_addr() I added the multicast check here.  If "not valid" or a multicast address fail.

Regards,
Dave

> 
> >  		PMD_INIT_LOG(ERR, "mac address is not valid");
> >  		ret = -EIO;
> >  		goto err_get_mac_addr;
> >


  reply	other threads:[~2017-08-31 16:04 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-22 22:21 David Harton
2017-08-31 15:53 ` Ferruh Yigit
2017-08-31 16:04   ` David Harton (dharton) [this message]
2017-09-08 12:51   ` David Harton (dharton)
2017-09-08 12:56     ` Ferruh Yigit
2017-09-11  5:41 ` Xing, Beilei
2017-09-11 17:22   ` David Harton (dharton)
2017-09-12  3:00     ` Xing, Beilei
2017-09-12 13:02 ` [dpdk-dev] [PATCH v2] i40e: fix i40evf_add_mac_addr " David Harton
2017-09-13  2:20   ` Xing, Beilei
2017-09-13  2:38     ` David Harton (dharton)
2017-09-13  2:43       ` Xing, Beilei
2017-09-13  3:21   ` [dpdk-dev] [PATCH v3] " David Harton
2017-09-13  3:42     ` Xing, Beilei
2017-09-14 18:55       ` Ferruh Yigit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bc06b6ee0df146678313bfab8bd453d0@XCH-RCD-016.cisco.com \
    --to=dharton@cisco.com \
    --cc=beilei.xing@intel.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=jingjing.wu@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).