DPDK patches and discussions
 help / color / mirror / Atom feed
From: Helin Zhang <helin.zhang@intel.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH 3/3] app/testpmd: set default MAC addresses for each VF
Date: Thu, 28 Jan 2016 16:40:23 +0800	[thread overview]
Message-ID: <1453970423-15234-4-git-send-email-helin.zhang@intel.com> (raw)
In-Reply-To: <1453970423-15234-1-git-send-email-helin.zhang@intel.com>

It generates MAC addresses during host port initialization, which
will be set as default MAC addresses for corresponding VFs.

Signed-off-by: Helin Zhang <helin.zhang@intel.com>
---
 app/test-pmd/testpmd.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 1319917..f7aac81 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -1762,6 +1762,23 @@ rxtx_port_config(struct rte_port *port)
 		port->tx_conf.txq_flags = txq_flags;
 }
 
+static void
+generate_default_vf_mac_addr(portid_t pid, struct rte_vf_conf *vf_conf,
+			     uint8_t vf_num)
+{
+	uint8_t i;
+	uint8_t addr[ETHER_ADDR_LEN] = {0x68, 0x05, 0xca, 0x25, 0x00, 0x00};
+
+	if (vf_num >= ETH_VF_NUM_MAX)
+		return;
+
+	addr[4] = (uint8_t)pid;
+	for (i = 0; i < vf_num; i++) {
+		addr[5] = i;
+		memcpy(vf_conf[i].mac_addr.addr_bytes, addr, sizeof(addr));
+	}
+}
+
 void
 init_port_config(void)
 {
@@ -1772,6 +1789,8 @@ init_port_config(void)
 		port = &ports[pid];
 		port->dev_conf.rxmode = rx_mode;
 		port->dev_conf.fdir_conf = fdir_conf;
+		generate_default_vf_mac_addr(pid, port->dev_conf.vf_conf, 32);
+
 		if (nb_rxq > 1) {
 			port->dev_conf.rx_adv_conf.rss_conf.rss_key = NULL;
 			port->dev_conf.rx_adv_conf.rss_conf.rss_hf = rss_hf;
-- 
2.5.0

  parent reply	other threads:[~2016-01-28  8:40 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 ` Helin Zhang [this message]
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   ` [dpdk-dev] [PATCH v2 1/2] i40e: generate MAC address for VF Helin Zhang
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=1453970423-15234-4-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).