From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id D98CA45E16; Tue, 3 Dec 2024 18:57:00 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id AEC3040261; Tue, 3 Dec 2024 18:57:00 +0100 (CET) Received: from mail-pf1-f177.google.com (mail-pf1-f177.google.com [209.85.210.177]) by mails.dpdk.org (Postfix) with ESMTP id 27F164025D for ; Tue, 3 Dec 2024 18:56:58 +0100 (CET) Received: by mail-pf1-f177.google.com with SMTP id d2e1a72fcca58-7252fba4de1so5113980b3a.0 for ; Tue, 03 Dec 2024 09:56:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1733248617; x=1733853417; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=3eBwG65sr6m+A7sNgw7Whou8ZP5zCR4P27zJ4rI0M8g=; b=oZdBHlitMSlY2rVZ3iGgoHdShpXq8oVICZ0Gn5u/vC4CG3wC66U6DWUZaSU8ThLguZ 7j6weS34DbEWcNIKdSOcit+LQAiR2GRd54aLW788Li/8hei0JU/6bTGPvgVIVnw6ksur rTUAE+n3Omo/COAIhKMcAT/x6T3Q+BM51pxDayMLhVSW03jmbdKrRSYxmO9zRm4c+4XX FXxJbrCORGmRAtBgvdZRNMcJsjN0B/9HGTKKSJHo+lmM3/YL1NTqP5Iy+kOhZRvP8tjl eYGKeOwHTlwu5FkZzHgtq8j5SJyXXKixq/asACIPpSZ1B3og+8AxbGus+hn68E7E5FQx W3vw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733248617; x=1733853417; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3eBwG65sr6m+A7sNgw7Whou8ZP5zCR4P27zJ4rI0M8g=; b=KXD1Q/fpfbNZ50YWqqEXL1cUshjlNXtl/vwlx0bfCxndSWrnHTgcVWd9FXqyTrGYkl o+W8QhSxhMqj0Otp16NqRiv+U3alR+1DFKJtvWD23YybhoCisIehlqETMd/ea8iJDIii UFQ9dnuAFc2+dn9SmiEb5JccMLkr/X8FmuxaDxOLW0s6OMh8ECFUH1783XvJY9VMch9V 5MBsipG2LMFm/1b+RdbOCERiVFOr2E7UDdmh68F9A0ILJoZeBjr3KkyJdjbJEAfRoefW VftC/mPN6YFqL/+PEiCOk168kY20FgCF7VVyhLJs5zduqLFlOFcj/OwGTvObwtWLNHqt ka7w== X-Gm-Message-State: AOJu0YwW8JRjEnFhVbkI5i9aRsqE+5I3YBNjeTfJD5BO4bOZa0AZtNxW oqotBSVFmpY5L/s8ac6mE2MfJJVxtpOC/V1NuzKmbuHby2J1mWbozQHvNzlpOCE= X-Gm-Gg: ASbGnctnw3kik2H6MnKgtMOTAr2PjSud/z6tPp1iw6MGBI2GH286IZLhXczobAT/8Kb npa5VPUDxRJRIeGSJ++rU346l7/alEJvud6dg2Gw2hmt7V5dNRveQbMQ+IHzl3HOLRX/rZqZ9zX 2gUW6afkZ8/xBrQrG53zmgD8k0afxhpeTaHbsGz3TwPit6C3BOgdok8e9sIcthaADi8KRArB4EQ jS7OT+NLGa6LsPLxWlp/S4U+CDQ2zDtGyXRbInBqdH8L8wCx3jdWD5slu/uEi0/oPmtiIrWVVtv vvsiUI7JnoBtBanwzBXaxiSZJhQ= X-Google-Smtp-Source: AGHT+IGtnf8tutahzkk84Lgsc5bKlT1TkD7Q/pP3gaZcnOY2OfFCVfiGssqxCfJlhjXkKoPLZKAlrA== X-Received: by 2002:a17:90b:4c81:b0:2ee:8430:b847 with SMTP id 98e67ed59e1d1-2ef011e491bmr4686951a91.6.1733248617258; Tue, 03 Dec 2024 09:56:57 -0800 (PST) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2eee981e8f5sm3010189a91.5.2024.12.03.09.56.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Dec 2024 09:56:57 -0800 (PST) Date: Tue, 3 Dec 2024 09:56:54 -0800 From: Stephen Hemminger To: Isaac Boukris Cc: dev@dpdk.org, mb@smartsharesystems.com Subject: Re: [PATCH] net/tap: add new macpair option for split MAC address Message-ID: <20241203095654.1f050da2@hermes.local> In-Reply-To: <20240917115147.378146-1-iboukris@gmail.com> References: <20240917115147.378146-1-iboukris@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On Tue, 17 Sep 2024 14:51:47 +0300 Isaac Boukris wrote: > Normally, the MAC address of the kernel interface is the same as in the > interface in dpdk, as they represent the same interface. It is useful > to allow viewing them as separate connected interfaces (like ip's veth). > > This solves a problem I have running a freebsd-based IPv6 stack on top > of dpdk and using the tap interface, as both the kernel and freebsd > stacks configure the MAC derived IPv6 address on the interface (as can > be seen with ifconfig for the kernel), and they both complain about > duplicate IPv6 address and the freebsd disables IPv6 as a result. > > Signed-off-by: Isaac Boukris Makes sense but a couple of small comments and rebase needed. 1. Could use rte_ether_addr_copy hear as is done elsewhere. And {} non needed. @@ -2023,12 +2031,20 @@ eth_dev_tap_create(struct rte_vdev_device *vdev, const char *tap_name, if (pmd->type == ETH_TUNTAP_TYPE_TAP) { memset(&ifr, 0, sizeof(struct ifreq)); ifr.ifr_hwaddr.sa_family = AF_LOCAL; - rte_memcpy(ifr.ifr_hwaddr.sa_data, &pmd->eth_addr, - RTE_ETHER_ADDR_LEN); + + if (mac_pair) { + rte_eth_random_addr((uint8_t *)ifr.ifr_hwaddr.sa_data); + } else { + memcpy(ifr.ifr_hwaddr.sa_data, &pmd->eth_addr, + RTE_ETHER_ADDR_LEN); rte_ether_addr_copy(&pmd->eth_addr, (struct rte_ether_addr *)&ifr.ifr_hwaddr.sa_data); 2. Need more error checks. macpair won't work with TUN device. and what happens if mac address is specified? 3. Should the mac address devarg, take two args?