From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 9BB5BC3D8 for ; Thu, 28 Jan 2016 09:40:39 +0100 (CET) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga102.jf.intel.com with ESMTP; 28 Jan 2016 00:40:37 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,357,1449561600"; d="scan'208";a="890845376" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by fmsmga001.fm.intel.com with ESMTP; 28 Jan 2016 00:40:35 -0800 Received: from shecgisg004.sh.intel.com (shecgisg004.sh.intel.com [10.239.29.89]) by shvmail01.sh.intel.com with ESMTP id u0S8eWNR004546; Thu, 28 Jan 2016 16:40:32 +0800 Received: from shecgisg004.sh.intel.com (localhost [127.0.0.1]) by shecgisg004.sh.intel.com (8.13.6/8.13.6/SuSE Linux 0.8) with ESMTP id u0S8eUfI015405; Thu, 28 Jan 2016 16:40:32 +0800 Received: (from hzhan75@localhost) by shecgisg004.sh.intel.com (8.13.6/8.13.6/Submit) id u0S8eUmY015401; Thu, 28 Jan 2016 16:40:30 +0800 From: Helin Zhang To: dev@dpdk.org Date: Thu, 28 Jan 2016 16:40:23 +0800 Message-Id: <1453970423-15234-4-git-send-email-helin.zhang@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1453970423-15234-1-git-send-email-helin.zhang@intel.com> References: <1453970423-15234-1-git-send-email-helin.zhang@intel.com> Subject: [dpdk-dev] [PATCH 3/3] app/testpmd: set default MAC addresses for each VF X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Jan 2016 08:40:40 -0000 It generates MAC addresses during host port initialization, which will be set as default MAC addresses for corresponding VFs. Signed-off-by: Helin Zhang --- 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