lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 6 Feb 2019 14:23:02 +0100
From:   Jiri Pirko <jiri@...nulli.us>
To:     Florian Fainelli <f.fainelli@...il.com>
Cc:     netdev@...r.kernel.org, "David S. Miller" <davem@...emloft.net>,
        Ido Schimmel <idosch@...lanox.com>,
        open list <linux-kernel@...r.kernel.org>,
        "open list:MELLANOX MLX5 core VPI driver" 
        <linux-rdma@...r.kernel.org>,
        "open list:NETRONOME ETHERNET DRIVERS" <oss-drivers@...ronome.com>,
        "open list:STAGING SUBSYSTEM" <devel@...verdev.osuosl.org>,
        "moderated list:ETHERNET BRIDGE" <bridge@...ts.linux-foundation.org>
Subject: Re: [PATCH net-next v3 07/12] nfp: Implement ndo_get_port_parent_id()

Wed, Feb 06, 2019 at 12:53:21AM CET, f.fainelli@...il.com wrote:
>NFP only supports SWITCHDEV_ATTR_ID_PORT_PARENT_ID, which makes it a
>great candidate to be converted to use the ndo_get_port_parent_id() NDO
>instead of implementing switchdev_port_attr_get().
>
>Since NFP uses switchdev_port_same_parent_id() convert it to use
>netdev_port_same_parent_id().
>
>Signed-off-by: Florian Fainelli <f.fainelli@...il.com>

[...]

>@@ -31,34 +31,23 @@ struct nfp_port *nfp_port_from_netdev(struct net_device *netdev)
> 	return NULL;
> }
> 
>-static int
>-nfp_port_attr_get(struct net_device *netdev, struct switchdev_attr *attr)
>+int nfp_port_get_port_parent_id(struct net_device *netdev,
>+				struct netdev_phys_item_id *ppid)
> {
> 	struct nfp_port *port;
>+	const u8 *serial;
> 
> 	port = nfp_port_from_netdev(netdev);
> 	if (!port)
> 		return -EOPNOTSUPP;
> 
>-	switch (attr->id) {
>-	case SWITCHDEV_ATTR_ID_PORT_PARENT_ID: {
>-		const u8 *serial;
>-		/* N.B: attr->u.ppid.id is binary data */
>-		attr->u.ppid.id_len = nfp_cpp_serial(port->app->cpp, &serial);
>-		memcpy(&attr->u.ppid.id, serial, attr->u.ppid.id_len);
>-		break;
>-	}
>-	default:
>-		return -EOPNOTSUPP;
>-	}
>+	/* N.B: attr->u.ppid.id is binary data */

Comment is not updated. But I wonder if we really need it...

Otherwise this looks fine.
Acked-by: Jiri Pirko <jiri@...lanox.com>


>+	ppid->id_len = nfp_cpp_serial(port->app->cpp, &serial);
>+	memcpy(&ppid->id, serial, ppid->id_len);
> 
> 	return 0;
> }
> 
>-const struct switchdev_ops nfp_port_switchdev_ops = {
>-	.switchdev_port_attr_get	= nfp_port_attr_get,
>-};
>-
> int nfp_port_setup_tc(struct net_device *netdev, enum tc_setup_type type,
> 		      void *type_data)
> {

[...]

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ