All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Qiu, Michael" <michael.qiu@intel.com>
To: "Chen, Jing D" <jing.d.chen@intel.com>, "dev@dpdk.org" <dev@dpdk.org>
Cc: "He, Shaopeng" <shaopeng.he@intel.com>
Subject: Re: [PATCH 5/6] fm10k: Do sanity check on mac address
Date: Tue, 16 Jun 2015 12:08:16 +0000	[thread overview]
Message-ID: <533710CFB86FA344BFBF2D6802E602860469C49F@SHSMSX101.ccr.corp.intel.com> (raw)
In-Reply-To: 1432887044-24777-6-git-send-email-jing.d.chen@intel.com

Tested-by: Michael Qiu <michael.qiu@intel.com>

- OS: Fedora20  3.11.10-301
- GCC: gcc version 4.8.3 2014911
- CPU: Intel(R) Xeon(R) CPU E5-2680 v2 @ 2.80GHz
- NIC: Ethernet controller: Intel Corporation Device 15a4 (rev 01)
- Default x86_64-native-linuxapp-gcc configuration


On 5/29/2015 4:11 PM, Chen, Jing D wrote:
> From: "Chen Jing D(Mark)" <jing.d.chen@intel.com>
>
> After acquiring MAC address from HW, it's necessary to validate
> MAC address before use.
>
> Signed-off-by: Chen Jing D(Mark) <jing.d.chen@intel.com>
> ---
>  drivers/net/fm10k/fm10k_ethdev.c |   24 ++++++++++--------------
>  1 files changed, 10 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c
> index dedfbb4..b6e82e3 100644
> --- a/drivers/net/fm10k/fm10k_ethdev.c
> +++ b/drivers/net/fm10k/fm10k_ethdev.c
> @@ -1756,24 +1756,20 @@ eth_fm10k_dev_init(struct rte_eth_dev *dev)
>  	}
>  
>  	diag = fm10k_read_mac_addr(hw);
> -	if (diag != FM10K_SUCCESS) {
> -		/*
> -		 * TODO: remove special handling on VF. Need shared code to
> -		 * fix first.
> -		 */
> -		if (hw->mac.type == fm10k_mac_pf) {
> -			PMD_INIT_LOG(ERR, "Read MAC addr failed: %d", diag);
> -			return -EIO;
> -		} else {
> -			/* Generate a random addr */
> -			eth_random_addr(hw->mac.addr);
> -			memcpy(hw->mac.perm_addr, hw->mac.addr, ETH_ALEN);
> -		}
> -	}
>  
>  	ether_addr_copy((const struct ether_addr *)hw->mac.addr,
>  			&dev->data->mac_addrs[0]);
>  
> +	if (diag != FM10K_SUCCESS ||
> +		!is_valid_assigned_ether_addr(dev->data->mac_addrs)) {
> +
> +		/* Generate a random addr */
> +		eth_random_addr(hw->mac.addr);
> +		memcpy(hw->mac.perm_addr, hw->mac.addr, ETH_ALEN);
> +		ether_addr_copy((const struct ether_addr *)hw->mac.addr,
> +		&dev->data->mac_addrs[0]);
> +	}
> +
>  	/* Reset the hw statistics */
>  	fm10k_stats_reset(dev);
>  


  reply	other threads:[~2015-06-16 12:08 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-29  8:10 [PATCH 0/6] fm10k: A series of bug fixes Chen Jing D(Mark)
2015-05-29  8:10 ` [PATCH 1/6] fm10k: Fix improper RX buffer size assignment Chen Jing D(Mark)
2015-06-16 11:55   ` Qiu, Michael
2015-05-29  8:10 ` [PATCH 2/6] fm10k: Fix jumbo frame issue Chen Jing D(Mark)
2015-06-12  1:15   ` Qiu, Michael
2015-05-29  8:10 ` [PATCH 3/6] fm10k: Fix data integrity issue with multi-segment frame Chen Jing D(Mark)
2015-06-16 12:07   ` Qiu, Michael
2015-05-29  8:10 ` [PATCH 4/6] fm10k: Fix issue that MAC addr can't be set to silicon Chen Jing D(Mark)
2015-06-09 16:23   ` Qiu, Michael
2015-06-10  5:34     ` Chen, Jing D
2015-06-12  2:03   ` Qiu, Michael
2015-05-29  8:10 ` [PATCH 5/6] fm10k: Do sanity check on mac address Chen Jing D(Mark)
2015-06-16 12:08   ` Qiu, Michael [this message]
2015-05-29  8:10 ` [PATCH 6/6] fm10k: Add default mac/vlan filter to SM Chen Jing D(Mark)
2015-06-08  2:39 ` [PATCH 0/6] fm10k: A series of bug fixes He, Shaopeng
2015-06-09 15:21 ` Qiu, Michael
2015-06-22 13:55   ` Thomas Monjalon

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=533710CFB86FA344BFBF2D6802E602860469C49F@SHSMSX101.ccr.corp.intel.com \
    --to=michael.qiu@intel.com \
    --cc=dev@dpdk.org \
    --cc=jing.d.chen@intel.com \
    --cc=shaopeng.he@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.