From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by dpdk.org (Postfix) with ESMTP id 1A4382A62 for ; Wed, 7 Mar 2018 04:32:35 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Mar 2018 19:32:35 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.47,434,1515484800"; d="scan'208";a="36557289" Received: from dna-skx3.jf.intel.com ([10.54.81.173]) by orsmga001.jf.intel.com with ESMTP; 06 Mar 2018 19:32:34 -0800 From: Mallesh Koujalagi To: dev@dpdk.org Cc: mtetsuyah@gmail.com, ferruh.yigit@intel.com, stephen@networkplumber.org, Mallesh Koujalagi Date: Tue, 6 Mar 2018 19:31:54 -0800 Message-Id: <1520393514-25882-1-git-send-email-malleshx.koujalagi@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1517623898-53443-1-git-send-email-malleshx.koujalagi@intel.com> References: <1517623898-53443-1-git-send-email-malleshx.koujalagi@intel.com> Subject: [dpdk-dev] [PATCH v3] net/null:Different mac address support X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Mar 2018 03:32:36 -0000 After attaching two Null device to ovs, seeing "00.00.00.00.00.00" mac address for both null devices. Fix this issue, by setting different mac address. Signed-off-by: Mallesh Koujalagi --- drivers/net/null/rte_eth_null.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/net/null/rte_eth_null.c b/drivers/net/null/rte_eth_null.c index 9385ffd..42e3a77 100644 --- a/drivers/net/null/rte_eth_null.c +++ b/drivers/net/null/rte_eth_null.c @@ -73,6 +73,7 @@ struct pmd_internals { struct null_queue rx_null_queues[RTE_MAX_QUEUES_PER_PORT]; struct null_queue tx_null_queues[RTE_MAX_QUEUES_PER_PORT]; + struct ether_addr eth_addr; /** Bit mask of RSS offloads, the bit offset also means flow type */ uint64_t flow_type_rss_offloads; @@ -84,9 +85,6 @@ struct pmd_internals { uint8_t rss_key[40]; /**< 40-byte hash key. */ }; - - -static struct ether_addr eth_addr = { .addr_bytes = {0} }; static struct rte_eth_link pmd_link = { .link_speed = ETH_SPEED_NUM_10G, .link_duplex = ETH_LINK_FULL_DUPLEX, @@ -519,7 +517,6 @@ eth_dev_null_create(struct rte_vdev_device *dev, rte_free(data); return -ENOMEM; } - /* now put it all together * - store queue data in internals, * - store numa_node info in ethdev data @@ -533,6 +530,7 @@ eth_dev_null_create(struct rte_vdev_device *dev, internals->packet_size = packet_size; internals->packet_copy = packet_copy; internals->port_id = eth_dev->data->port_id; + eth_random_addr(internals->eth_addr.addr_bytes); internals->flow_type_rss_offloads = ETH_RSS_PROTO_MASK; internals->reta_size = RTE_DIM(internals->reta_conf) * RTE_RETA_GROUP_SIZE; @@ -543,7 +541,7 @@ eth_dev_null_create(struct rte_vdev_device *dev, data->nb_rx_queues = (uint16_t)nb_rx_queues; data->nb_tx_queues = (uint16_t)nb_tx_queues; data->dev_link = pmd_link; - data->mac_addrs = ð_addr; + data->mac_addrs = &internals->eth_addr; eth_dev->data = data; eth_dev->dev_ops = &ops; -- 2.7.4