From patchwork Fri Jul 19 13:55:49 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Pirko X-Patchwork-Id: 260267 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id CAC162C007B for ; Fri, 19 Jul 2013 23:56:13 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759847Ab3GSN4G (ORCPT ); Fri, 19 Jul 2013 09:56:06 -0400 Received: from mail-ee0-f47.google.com ([74.125.83.47]:45785 "EHLO mail-ee0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759294Ab3GSN4B (ORCPT ); Fri, 19 Jul 2013 09:56:01 -0400 Received: by mail-ee0-f47.google.com with SMTP id e49so2389170eek.34 for ; Fri, 19 Jul 2013 06:55:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=EDvWDHlCNjpy3oPYyEWAvGebnAUJfpiuCoXZhuUsj0k=; b=pflrlxgtIuIGegBtTSW5N3SAU9WEOhFR384i2E2pE8E2Q8oZhqWl+ZE63rPy2STpH+ jajKgKDwMJ5thXX9Wotao7aPXjA302OwnekieQBUY9HJOUElIZgyMut96oemWWn5TLmr mbHgla5cqCCV6PBxVQc2+b+eZ547uA1LJH8f458VSs9qi/EUgLk0f4MAEg7XqMNodnIM ePZEGeP5cEdavMiA6fBtXVomB5T38PIfXF/rch373fv0qMdDo6ufN3pUSbnkLpKjtUgh I+J2gJyK2/amPs/fre7+7qdvHcpj50pguWuvI5neMrsC8Zth4odCVldmPHriMXYWt4vG eIyw== X-Received: by 10.15.22.199 with SMTP id f47mr16232245eeu.47.1374242158735; Fri, 19 Jul 2013 06:55:58 -0700 (PDT) Received: from localhost (ip-89-176-153-53.net.upcbroadband.cz. [89.176.153.53]) by mx.google.com with ESMTPSA id n42sm27559230eeh.15.2013.07.19.06.55.57 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 19 Jul 2013 06:55:58 -0700 (PDT) From: Jiri Pirko To: netdev@vger.kernel.org Cc: davem@davemloft.net, stephen@networkplumber.org, Narendra_K@Dell.com, bhutchings@solarflare.com, john.r.fastabend@intel.com Subject: [patch net-next 1/3] net: add ndo to get id of physical port of the device Date: Fri, 19 Jul 2013 15:55:49 +0200 Message-Id: <1374242152-10325-2-git-send-email-jiri@resnulli.us> X-Mailer: git-send-email 1.8.1.4 In-Reply-To: <1374242152-10325-1-git-send-email-jiri@resnulli.us> References: <1374242152-10325-1-git-send-email-jiri@resnulli.us> X-Gm-Message-State: ALoCoQnWeOjoFJhQtE1QHZ7SkzhTnFe5zwoF5wk+KrNc5R6axypFJkWi2dI4odUkH1cOhidsRiJB Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org This patch adds a ndo for getting physical port of the device. Driver which is aware of being virtual function of some physical port should implement this ndo. Signed-off-by: Jiri Pirko --- include/linux/netdevice.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 0741a1e..c992741 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -728,6 +728,16 @@ struct netdev_fcoe_hbainfo { }; #endif +#define MAX_PHYS_PORT_ID_LEN 32 + +/* This structure holds a unique identifier to identify the + * physical port used by a netdevice. + */ +struct netdev_phys_port_id { + unsigned char id[MAX_PHYS_PORT_ID_LEN]; + unsigned char id_len; +}; + /* * This structure defines the management hooks for network devices. * The following hooks can be defined; unless noted otherwise, they are @@ -932,6 +942,12 @@ struct netdev_fcoe_hbainfo { * that determine carrier state from physical hardware properties (eg * network cables) or protocol-dependent mechanisms (eg * USB_CDC_NOTIFY_NETWORK_CONNECTION) should NOT implement this function. + * + * int (*ndo_get_phys_port_id)(struct net_device *dev, + * struct netdev_phys_port_id *ppid); + * Called to get ID of physical port of this device. If driver does + * not implement this, it is assumed that the hw is not able to have + * multiple net devices on single physical port. */ struct net_device_ops { int (*ndo_init)(struct net_device *dev); @@ -1060,6 +1076,8 @@ struct net_device_ops { struct nlmsghdr *nlh); int (*ndo_change_carrier)(struct net_device *dev, bool new_carrier); + int (*ndo_get_phys_port_id)(struct net_device *dev, + struct netdev_phys_port_id *ppid); }; /*