DPDK patches and discussions
 help / color / mirror / Atom feed
From: Helin Zhang <helin.zhang@intel.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH v2 1/2] i40e: generate MAC address for VF
Date: Tue,  8 Mar 2016 14:42:08 +0800	[thread overview]
Message-ID: <1457419329-11915-2-git-send-email-helin.zhang@intel.com> (raw)
In-Reply-To: <1457419329-11915-1-git-send-email-helin.zhang@intel.com>

It generates a MAC address for each VFs during PF host
initialization.

Signed-off-by: Helin Zhang <helin.zhang@intel.com>
---
 doc/guides/rel_notes/release_16_04.rst | 5 +++++
 drivers/net/i40e/i40e_ethdev.h         | 1 +
 drivers/net/i40e/i40e_pf.c             | 3 +++
 3 files changed, 9 insertions(+)

v2:
 - It just generates a MAC address for each VFs during PF host
   initialization, and removes configuring from users.
 - Reworded the release notes.

diff --git a/doc/guides/rel_notes/release_16_04.rst b/doc/guides/rel_notes/release_16_04.rst
index 73494f9..1b9061d 100644
--- a/doc/guides/rel_notes/release_16_04.rst
+++ b/doc/guides/rel_notes/release_16_04.rst
@@ -137,6 +137,11 @@ Drivers
 
 * **vmxnet3: add TSO support.**
 
+* **i40e: Generates MAC address for each VFs.**
+
+  It generates a MAC address for each VFs during PF host initialization,
+  and keeps the VF MAC address the same among different VF launch.
+
 
 Libraries
 ~~~~~~~~~
diff --git a/drivers/net/i40e/i40e_ethdev.h b/drivers/net/i40e/i40e_ethdev.h
index db6173a..9109cd9 100644
--- a/drivers/net/i40e/i40e_ethdev.h
+++ b/drivers/net/i40e/i40e_ethdev.h
@@ -312,6 +312,7 @@ struct i40e_pf_vf {
 	uint16_t vf_idx; /* VF index in pf->vfs */
 	uint16_t lan_nb_qps; /* Actual queues allocated */
 	uint16_t reset_cnt; /* Total vf reset times */
+	struct ether_addr mac_addr;  /* Default MAC address */
 };
 
 /*
diff --git a/drivers/net/i40e/i40e_pf.c b/drivers/net/i40e/i40e_pf.c
index cbf4e5b..5790377 100644
--- a/drivers/net/i40e/i40e_pf.c
+++ b/drivers/net/i40e/i40e_pf.c
@@ -315,6 +315,8 @@ i40e_pf_host_process_cmd_get_vf_resource(struct i40e_pf_vf *vf)
 	/* As assume Vf only has single VSI now, always return 0 */
 	vf_res->vsi_res[0].vsi_id = 0;
 	vf_res->vsi_res[0].num_queue_pairs = vf->vsi->nb_qps;
+	ether_addr_copy(&vf->mac_addr,
+		(struct ether_addr *)vf_res->vsi_res[0].default_mac_addr);
 
 send_msg:
 	i40e_pf_host_send_msg_to_vf(vf, I40E_VIRTCHNL_OP_GET_VF_RESOURCES,
@@ -1045,6 +1047,7 @@ i40e_pf_host_init(struct rte_eth_dev *dev)
 		ret = i40e_pf_host_vf_reset(&pf->vfs[i], 0);
 		if (ret != I40E_SUCCESS)
 			goto fail;
+		eth_random_addr(pf->vfs[i].mac_addr.addr_bytes);
 	}
 
 	/* restore irq0 */
-- 
2.5.0

  parent reply	other threads:[~2016-03-08  6:42 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-28  8:40 [dpdk-dev] [PATCH 0/3] support setting i40e VF MAC address from DPDK host side Helin Zhang
2016-01-28  8:40 ` [dpdk-dev] [PATCH 1/3] i40e: add setting VF MAC address in DPDK PF host Helin Zhang
2016-01-28  8:40 ` [dpdk-dev] [PATCH 2/3] i40evf: use ether interface for validating MAC address Helin Zhang
2016-01-28  8:40 ` [dpdk-dev] [PATCH 3/3] app/testpmd: set default MAC addresses for each VF Helin Zhang
2016-02-26  8:14 ` [dpdk-dev] [PATCH 0/3] support setting i40e VF MAC address from DPDK host side Pei, Yulong
2016-03-08  6:42 ` [dpdk-dev] [PATCH v2 0/2] add VF MAC address generation Helin Zhang
2016-03-08  0:43   ` Zhe Tao
2016-03-08 10:48     ` Bruce Richardson
2016-03-08  6:42   ` Helin Zhang [this message]
2016-03-08  6:42   ` [dpdk-dev] [PATCH v2 2/2] i40evf: use ether API to validate MAC address Helin Zhang

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=1457419329-11915-2-git-send-email-helin.zhang@intel.com \
    --to=helin.zhang@intel.com \
    --cc=dev@dpdk.org \
    /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).