From mboxrd@z Thu Jan 1 00:00:00 1970 From: Cian Ferriter Subject: [PATCH] net/pcap: Generate unique MAC addresses for interfaces Date: Mon, 3 Sep 2018 15:08:45 +0100 Message-ID: <1535983725-84966-1-git-send-email-cian.ferriter@intel.com> Cc: dev@dpdk.org, Cian Ferriter To: Ferruh Yigit Return-path: 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) 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]; -- 1.7.0.7