From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf0-f194.google.com (mail-pf0-f194.google.com [209.85.192.194]) by dpdk.org (Postfix) with ESMTP id BEBC3E5D for ; Tue, 6 Mar 2018 05:26:43 +0100 (CET) Received: by mail-pf0-f194.google.com with SMTP id h19so7386988pfd.12 for ; Mon, 05 Mar 2018 20:26:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ALglFuVe1FMSB+RYMZD8ix3N0n15GtmOAdBmS/P8xeU=; b=SraCEjd5/ThNz3C3PWs3i4ztlYPMMm+IsThLWIH+jjX3qDtDirHrgtTiq4n28X7nmZ 9Kr3EiAK0OLJaQ3k7iNdaslXmY63Q5aV88TC7C6vI+9Ghd69zQR8QS0jcbeqX3SFjWBM PQI7d1kAUBkJo+LcgYT4qh7kNK4rt0o+FQJoMRBbJVtIgZoilkBBVGIGb+/l8n1STMui xYZKACOgLl3HwiBlzZxKTj+1uGDzJBthRJQIUcJndjHDa2fRwftQ+ZprxaadXzlX1MEo QaCPn3cy8TdylwEJ19PNm5W9q0RLTL9IydTzAnURMCT0nTATbg14Dou6KstbN9d6uSid 3Faw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ALglFuVe1FMSB+RYMZD8ix3N0n15GtmOAdBmS/P8xeU=; b=SPiFpsTOVhQYfQxTxjiDYT65HSyXZWRKfyCg1EU9DG0PSRFFGTh2l2giyBJkNKX39i eYBO8Giqip1AQJlPyw6mZUJ3rit2D/4I4PXblEzWY0X+pupfrUBtj76UyUF1b0vzOkXP xd82G18FWojtHC1xeqydR6Iv9hsdOJyE4l5wn8xnqmt/a4HJnAS2uV8HSz5w5hTJ5gzm rOzUiI7OQaRARD4ony+1EeFHp11pM3O2A+Fcsxx9i6E3XKX2SJuNrr02TupJJVfnSfrc oi9XCaVoBZfNImA1L31b48vGb7dBVSNgJtuTKqI2VveUzdFNDRYAIgxn72OFSvBNt2d8 7Eaw== X-Gm-Message-State: APf1xPBFI4sJKxuv7hW8dg0ABGaru5pdtFKNJGzaeV0i70r5CmEJDcFE JgwAbkA7iWwQh3jFyN6adiZjtg== X-Google-Smtp-Source: AG47ELuLWig/KaCRFMcQi5lMlEEN8KRtQAIDi+S/lTskq/vp7ZM0TX8lshyWqaSQxo8b9c5amrXqTQ== X-Received: by 10.99.100.196 with SMTP id y187mr14169426pgb.362.1520310402574; Mon, 05 Mar 2018 20:26:42 -0800 (PST) Received: from xeon-e3 (204-195-71-95.wavecable.com. [204.195.71.95]) by smtp.gmail.com with ESMTPSA id x13sm18803636pfh.115.2018.03.05.20.26.41 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 05 Mar 2018 20:26:42 -0800 (PST) Date: Mon, 5 Mar 2018 20:26:40 -0800 From: Stephen Hemminger To: Mallesh Koujalagi Cc: dev@dpdk.org, mtetsuyah@gmail.com, ferruh.yigit@intel.com Message-ID: <20180305202640.6d372481@xeon-e3> In-Reply-To: <1520307314-25049-1-git-send-email-malleshx.koujalagi@intel.com> References: <1517623898-53443-1-git-send-email-malleshx.koujalagi@intel.com> <1520307314-25049-1-git-send-email-malleshx.koujalagi@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH v2] 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: Tue, 06 Mar 2018 04:26:44 -0000 On Mon, 5 Mar 2018 19:35:14 -0800 Mallesh Koujalagi wrote: > 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 | 26 +++++++++++++++++++++++--- > 1 file changed, 23 insertions(+), 3 deletions(-) > > diff --git a/drivers/net/null/rte_eth_null.c b/drivers/net/null/rte_eth_null.c > index 9385ffd..599b513 100644 > --- a/drivers/net/null/rte_eth_null.c > +++ b/drivers/net/null/rte_eth_null.c > @@ -85,8 +85,17 @@ struct pmd_internals { > uint8_t rss_key[40]; /**< 40-byte hash key. */ > }; > > +static struct ether_addr base_eth_addr = { > + .addr_bytes = { > + 0x4E /* N */, > + 0x55 /* U */, > + 0x4C /* L */, > + 0x4C /* L */, > + 0x00, > + 0x00 > + } > +}; Cute, but since first octets of Ethernet are the vendor id (OUI) it might be confusing. At least 'N' is 4E which does not have the group address (multicast) set; and it does have the local admin address bit set. You really should be using a random locally assigned value. > -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, > @@ -492,6 +501,7 @@ eth_dev_null_create(struct rte_vdev_device *dev, > struct rte_eth_dev_data *data = NULL; > struct pmd_internals *internals = NULL; > struct rte_eth_dev *eth_dev = NULL; > + struct ether_addr *eth_addr = NULL; > > static const uint8_t default_rss_key[40] = { > 0x6D, 0x5A, 0x56, 0xDA, 0x25, 0x5B, 0x0E, 0xC2, 0x41, 0x67, 0x25, 0x3D, > @@ -514,12 +524,21 @@ eth_dev_null_create(struct rte_vdev_device *dev, > if (!data) > return -ENOMEM; > > + eth_addr = rte_zmalloc_socket(rte_vdev_device_name(dev), > + sizeof(*eth_addr), 0, dev->device.numa_node); > + if (eth_addr == NULL) { > + rte_free(data); > + return -ENOMEM; > + } > + > eth_dev = rte_eth_vdev_allocate(dev, sizeof(*internals)); > if (!eth_dev) { > + rte_free(eth_addr); > rte_free(data); > return -ENOMEM; > } > - > + *eth_addr = base_eth_addr; > + eth_addr->addr_bytes[5] = eth_dev->data->port_id; > /* now put it all together > * - store queue data in internals, > * - store numa_node info in ethdev data > @@ -543,7 +562,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 = eth_addr; > > eth_dev->data = data; > eth_dev->dev_ops = &ops; > @@ -662,6 +681,7 @@ rte_pmd_null_remove(struct rte_vdev_device *dev) > if (eth_dev == NULL) > return -1; > > + rte_free(eth_dev->data->mac_addrs); > rte_free(eth_dev->data->dev_private); > rte_free(eth_dev->data); >