From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wi0-f177.google.com (mail-wi0-f177.google.com [209.85.212.177]) by dpdk.org (Postfix) with ESMTP id 2E9DB9AD8 for ; Tue, 2 Jun 2015 14:24:11 +0200 (CEST) Received: by wibut5 with SMTP id ut5so67449571wib.1 for ; Tue, 02 Jun 2015 05:24:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:organization :user-agent:in-reply-to:references:mime-version :content-transfer-encoding:content-type; bh=FOOX3897I93P2lfDTnbkU705w0gBVSfsb67g3N40Vb8=; b=ZQmBEYJI+YsXjOqmLZ9G11Jjyz8YpKauSWPv9Cz/nntkpBSwwpYG7jmTju75PdtHbZ me0ffDyJjpOZz9jX6pdxPTFfSoLjfOBcppaCS8aK2MokQYjjae9mzyWDIdDt+AHnA6CB cx4MVPK5uu3wROcUBu9t7Cmjp1wga/2QdIxgbRD4ALIabyjEaRHdAt+oEAJw889YDzsJ jaZ1pimf9e0kz7hd6+6FgoyK/uliv/JZEw1pfwVAbsY7AS7kXtRhV9qr/AFfzVi36odh RYe6Hrk7/UPInwdDykgEKyGb4vihvQUFD0DAdt01iE7OAV+LkRRxM3ArmuX1U6Jq4sBD zJCQ== X-Gm-Message-State: ALoCoQnc5mZddDRNO72P7mcpcYAZQf25AEmI9BQyP5dAQFb6mfJIGBqlx4QjnFkkPsJyLLcIF4BI X-Received: by 10.180.231.40 with SMTP id td8mr31232312wic.9.1433247850963; Tue, 02 Jun 2015 05:24:10 -0700 (PDT) Received: from xps13.localnet (136-92-190-109.dsl.ovh.fr. [109.190.92.136]) by mx.google.com with ESMTPSA id u6sm26586257wja.40.2015.06.02.05.24.09 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 02 Jun 2015 05:24:10 -0700 (PDT) From: Thomas Monjalon To: "Ananyev, Konstantin" Date: Tue, 02 Jun 2015 14:23:22 +0200 Message-ID: <1821700.XUk45KJcQp@xps13> Organization: 6WIND User-Agent: KMail/4.14.8 (Linux/4.0.4-2-ARCH; KDE/4.14.8; x86_64; ; ) In-Reply-To: <2601191342CEEE43887BDE71AB977258214345AB@irsmsx105.ger.corp.intel.com> References: <1432927612-12244-1-git-send-email-liang-min.wang@intel.com> <1432927612-12244-2-git-send-email-liang-min.wang@intel.com> <2601191342CEEE43887BDE71AB977258214345AB@irsmsx105.ger.corp.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Cc: dev@dpdk.org, "Wang, Liang-min" Subject: Re: [dpdk-dev] [PATCH 1/2] ethdev: add api to set default mac address X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Jun 2015 12:24:11 -0000 2015-06-02 10:52, Ananyev, Konstantin: > From: Wang, Liang-min > > int > > +rte_eth_dev_default_mac_addr_set(uint8_t port_id, struct ether_addr *addr) > > +{ > > + struct rte_eth_dev *dev; > > + > > + if (!rte_eth_dev_is_valid_port(port_id)) { > > + PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); > > + return -ENODEV; > > + } > > + > > + dev = &rte_eth_devices[port_id]; > > + FUNC_PTR_OR_ERR_RET(*dev->dev_ops->mac_addr_set, -ENOTSUP); > > + > > + return (*dev->dev_ops->mac_addr_set)(dev, addr); > > +} > > As I can see mac_addr_set() is implemented now only for virtio. > Which means that for all Intel HW your new rte_eth_dev_default_mac_addr_set() > would not work right now? > Probably rte_eth_dev_default_mac_addr_set() should combine both approaches: > If mac_addr_set() is implemented by dev, then use it, otherwise try to use addr_remove()/addr_add() > (as your first version did)? > Konstantin Not sure it is a good idea to use remove/add to set the default unicast mac address. It would be clearer to add comments to remove/add functions to specify that they don't apply to the default adress but only to secondary ones. Then use the same logic for both API and driver ops. It is the responsibility of the driver implementation to use common functions for default_set and remove/add functions.