From patchwork Mon Sep 3 14:08:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cian Ferriter X-Patchwork-Id: 44170 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id EAF365F25; Mon, 3 Sep 2018 16:09:00 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id F40005F20 for ; Mon, 3 Sep 2018 16:08:58 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Sep 2018 07:08:57 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.53,325,1531810800"; d="scan'208";a="80519694" Received: from silpixa00393943.ir.intel.com ([10.237.222.21]) by orsmga003.jf.intel.com with ESMTP; 03 Sep 2018 07:08:56 -0700 From: Cian Ferriter To: Ferruh Yigit Cc: dev@dpdk.org, Cian Ferriter Date: Mon, 3 Sep 2018 15:08:45 +0100 Message-Id: <1535983725-84966-1-git-send-email-cian.ferriter@intel.com> X-Mailer: git-send-email 2.7.4 Subject: [dpdk-dev] [PATCH] net/pcap: Generate unique MAC addresses for interfaces 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" The MAC addresses are generated in the same manner as in the TAP PMD, where the address is based on the number of PCAP ports created. Signed-off-by: Cian Ferriter --- drivers/net/pcap/rte_eth_pcap.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/drivers/net/pcap/rte_eth_pcap.c b/drivers/net/pcap/rte_eth_pcap.c index e8810a1..ced9cd9 100644 --- a/drivers/net/pcap/rte_eth_pcap.c +++ b/drivers/net/pcap/rte_eth_pcap.c @@ -417,11 +417,17 @@ struct pmd_devargs { static int eth_dev_start(struct rte_eth_dev *dev) { + static int iface_idx; unsigned int i; struct pmd_internals *internals = dev->data->dev_private; struct pcap_tx_queue *tx; struct pcap_rx_queue *rx; + /* Interface MAC = 00:70:63:61:70: */ + memcpy((char *)dev->data->mac_addrs->addr_bytes, "\0pcap", + ETHER_ADDR_LEN); + dev->data->mac_addrs->addr_bytes[ETHER_ADDR_LEN - 1] = iface_idx++; + /* Special iface case. Single pcap is open and shared between tx/rx. */ if (internals->single_iface) { tx = &internals->tx_queue[0];