Received: by 2002:ac0:8c8e:0:0:0:0:0 with SMTP id r14csp616786ima; Wed, 6 Feb 2019 05:44:08 -0800 (PST) X-Google-Smtp-Source: AHgI3IZjU/wXcrjxgtcpWZJMEY3hgNaZNE7xGNoZwFVFBY5hrl0BrhyUndzHd25mXdZav08ezg7G X-Received: by 2002:a63:e655:: with SMTP id p21mr9603734pgj.70.1549460648259; Wed, 06 Feb 2019 05:44:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549460648; cv=none; d=google.com; s=arc-20160816; b=Om0hR8Zn7/R6ZnnWx53QfpXwdXE8OV+AhApuAUb8Op9hNOubEyMQM7rUJx9hkNuUVk ttLlU1+b/4SFMpmPoFITSiVGvEx0ZvFUlLrcC4srm9Hoxw+BRJQTnN7C/tE6nzzmKdxu yx4SdjEsApqIUGqTI4XPVZrd5x7xdf5tx0pQngS9Q6/1iiEEOIo9olg80V5XSeStQTNQ 7tuPmvarBKobuTLf6byjMUacKwK0llMPJWJjnQUtkZQyAnX/uXy55Ix2KkUhvnOmEty+ mO+QYf2oV/c1TnQ4x7F6IUK4Ndst0LH/houRaMrZ/4aQ/pVJ+0C02+971/qmiIe1oV1f qUKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=Ea8KLwt7ZKSqHUShsrcmEDqwMxkJhQyNCqQz+/bcxtg=; b=qqg3hOLfR8PX8U6Nvp1VCiPiC2YvBmuP4MZLS6lHmE6gaBW+6VGUjioNJxUArQJu/r lkrABwq6V15gzgtfN5eF9TWsvtiynPNlR9GiHM23l67M02yBHUyy6Ae7Q/jYK4Q8ZIFr H5YH2nrukYHCIRMCzvvU2wNF12UTcXJNynYYEUEwBwo+YFqsO7YWdGTQgeVTYv29hnW3 WcIcqjkINiPlYsrIV3GGJUbBfVgxiV88GAjewf50OldsIOf9driZ1OcuLqE+cFFS44WB fzE2pN1GhIxuIjkZv2gYqj3sEiTYOkFZw++PKfrUFPnOi+hcvaK0LK4EejE9NWK6lJED laFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@resnulli-us.20150623.gappssmtp.com header.s=20150623 header.b=PUDiD8Lt; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 3si663553plo.217.2019.02.06.05.43.52; Wed, 06 Feb 2019 05:44:08 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@resnulli-us.20150623.gappssmtp.com header.s=20150623 header.b=PUDiD8Lt; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730624AbfBFNnp (ORCPT + 99 others); Wed, 6 Feb 2019 08:43:45 -0500 Received: from mail-wm1-f67.google.com ([209.85.128.67]:55696 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727179AbfBFNnp (ORCPT ); Wed, 6 Feb 2019 08:43:45 -0500 Received: by mail-wm1-f67.google.com with SMTP id y139so2501804wmc.5 for ; Wed, 06 Feb 2019 05:43:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=resnulli-us.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=Ea8KLwt7ZKSqHUShsrcmEDqwMxkJhQyNCqQz+/bcxtg=; b=PUDiD8LtXtusVPMhZXzBHr79w7dFirxJJ50XDlKT3CTF+GknXGH4c/RrW4f8Ydo+N+ vfPfQslUAxu+L+SzFU/sJfimux139XRPUaAbFGhaQUlu1ELEFQZnFMC2bOgjfPyH+Lq3 r+snBSDomdONDx7Bz3RewPppcheJdR062JkDz8urtfx+hWkBOuF6KB6w8cj9PWU2+H9M LPMwBKFeQgGvGqUHXHYWUdowY5m6yUDdcLM5dX9lfk1zLe5PnsvbjpgYrAWsdI35NjzR L4VPxONhcS19bd/lZ8tIOhLebgzYCTMhZAM92ysKtE9YBSZ2En2lAMnyKgfMJKyTyg/3 CB1g== 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:references :mime-version:content-disposition:in-reply-to:user-agent; bh=Ea8KLwt7ZKSqHUShsrcmEDqwMxkJhQyNCqQz+/bcxtg=; b=p0dStqVqkhF94hsnDo4HdFhMpdZJf+aMuAYLRxAR5bv2Hsl1ESXWvB3vIgFXIBhIFb unqurtP4Wq5P5/epywr/v8mm6spoIIdAElPO+D1RIpZb1+GZXmnkDLbRhd9k8epH6xbS zNH2zS65mWltBMYy/nObHkw2HdnRRkV9ymjwgF4o2ybrFk+sa08UrZqexAliMSJrggWQ Lb5/hI5AICnQV8TpPdaXzt3u8GK0gg6J/TXPIQBmJ2tSe0XzgJFnjWAFs9vTWTcHyjgU g1Z9rmptianmsLwkWcuFLrpbr6rOseAW+KROTZ53drUmZd368dZbjI/5OEJ+zH0eCUos 8YkQ== X-Gm-Message-State: AHQUAuaaZo23yGJFYaX/zYcfn5Lef3vD2arGFu9e5PgikfwML+JQUclR 93ssv3h4VxYGUPpvTr5AMgOTedD+qAA= X-Received: by 2002:a1c:48d:: with SMTP id 135mr3171889wme.1.1549460622858; Wed, 06 Feb 2019 05:43:42 -0800 (PST) Received: from localhost (mail.chocen-mesto.cz. [85.163.43.2]) by smtp.gmail.com with ESMTPSA id u25sm14013736wml.31.2019.02.06.05.43.42 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 06 Feb 2019 05:43:42 -0800 (PST) Date: Wed, 6 Feb 2019 14:34:31 +0100 From: Jiri Pirko To: Florian Fainelli Cc: netdev@vger.kernel.org, "David S. Miller" , Ido Schimmel , open list , "open list:MELLANOX MLX5 core VPI driver" , "open list:NETRONOME ETHERNET DRIVERS" , "open list:STAGING SUBSYSTEM" , "moderated list:ETHERNET BRIDGE" Subject: Re: [PATCH net-next v3 12/12] net: Get rid of SWITCHDEV_ATTR_ID_PORT_PARENT_ID Message-ID: <20190206133431.GL2189@nanopsycho> References: <20190205235326.14600-1-f.fainelli@gmail.com> <20190205235326.14600-13-f.fainelli@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190205235326.14600-13-f.fainelli@gmail.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Wed, Feb 06, 2019 at 12:53:26AM CET, f.fainelli@gmail.com wrote: >Now that we have a dedicated NDO for getting a port's parent ID, get rid >of SWITCHDEV_ATTR_ID_PORT_PARENT_ID and convert all callers to use the >NDO exclusively. This is a preliminary change to getting rid of >switchdev_ops eventually. > >Signed-off-by: Florian Fainelli [...] >@@ -24,19 +23,12 @@ static int br_switchdev_mark_get(struct net_bridge *br, struct net_device *dev) > > int nbp_switchdev_mark_set(struct net_bridge_port *p) > { >- const struct net_device_ops *ops = p->dev->netdev_ops; >- struct switchdev_attr attr = { >- .orig_dev = p->dev, >- .id = SWITCHDEV_ATTR_ID_PORT_PARENT_ID, >- }; >- int err; >+ struct netdev_phys_item_id ppid = { }; >+ int err = -EOPNOTSUPP; Pointless init. > > ASSERT_RTNL(); > >- if (ops->ndo_get_port_parent_id) >- err = dev_get_port_parent_id(p->dev, &attr.u.ppid, true); >- else >- err = switchdev_port_attr_get(p->dev, &attr); >+ err = dev_get_port_parent_id(p->dev, &ppid, true); > if (err) { > if (err == -EOPNOTSUPP) > return 0; [...] >@@ -1146,26 +1145,17 @@ static int rtnl_phys_port_name_fill(struct sk_buff *skb, struct net_device *dev) > > static int rtnl_phys_switch_id_fill(struct sk_buff *skb, struct net_device *dev) > { >- const struct net_device_ops *ops = dev->netdev_ops; >- int err; >- struct switchdev_attr attr = { >- .orig_dev = dev, >- .id = SWITCHDEV_ATTR_ID_PORT_PARENT_ID, >- .flags = SWITCHDEV_F_NO_RECURSE, >- }; >+ struct netdev_phys_item_id ppid = { }; >+ int err = -EOPNOTSUPP; Pointless init. > >- if (ops->ndo_get_port_parent_id) >- err = dev_get_port_parent_id(dev, &attr.u.ppid, false); >- else >- err = switchdev_port_attr_get(dev, &attr); >+ err = dev_get_port_parent_id(dev, &ppid, false); > if (err) { > if (err == -EOPNOTSUPP) > return 0; > return err; > } > >- if (nla_put(skb, IFLA_PHYS_SWITCH_ID, attr.u.ppid.id_len, >- attr.u.ppid.id)) >+ if (nla_put(skb, IFLA_PHYS_SWITCH_ID, ppid.id_len, ppid.id)) > return -EMSGSIZE; > > return 0; [...] >@@ -920,15 +917,10 @@ static int vif_add(struct net *net, struct mr_table *mrt, > vifc->vifc_flags | (!mrtsock ? VIFF_STATIC : 0), > (VIFF_TUNNEL | VIFF_REGISTER)); > >- attr.orig_dev = dev; > ops = dev->netdev_ops; >- if (ops->ndo_get_port_parent_id && >- !dev_get_port_parent_id(dev, &attr.u.ppid, true)) { >- memcpy(v->dev_parent_id.id, attr.u.ppid.id, attr.u.ppid.id_len); >- v->dev_parent_id.id_len = attr.u.ppid.id_len; >- } else if (!switchdev_port_attr_get(dev, &attr)) { >- memcpy(v->dev_parent_id.id, attr.u.ppid.id, attr.u.ppid.id_len); >- v->dev_parent_id.id_len = attr.u.ppid.id_len; >+ if (!dev_get_port_parent_id(dev, &ppid, true)) { Please split this to: err = dev_get_port_parent_id(dev, &ppid, true); if (err) { >+ memcpy(v->dev_parent_id.id, ppid.id, ppid.id_len); >+ v->dev_parent_id.id_len = ppid.id_len; > } else { > v->dev_parent_id.id_len = 0; > } [...]