net: add ndo to get id of physical port of the device
[pandora-kernel.git] / include / linux / netdevice.h
index 3ca60b0..875f869 100644 (file)
@@ -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);
 };
 
 /*
@@ -2315,6 +2333,8 @@ extern int                dev_set_mac_address(struct net_device *,
                                            struct sockaddr *);
 extern int             dev_change_carrier(struct net_device *,
                                           bool new_carrier);
+extern int             dev_get_phys_port_id(struct net_device *dev,
+                                            struct netdev_phys_port_id *ppid);
 extern int             dev_hard_start_xmit(struct sk_buff *skb,
                                            struct net_device *dev,
                                            struct netdev_queue *txq);