OSDN Git Service

be2net: support ndo_get_phys_port_id()
[android-x86/kernel.git] / drivers / net / ethernet / emulex / benet / be_main.c
index c996dd7..5e92db8 100644 (file)
@@ -5219,6 +5219,27 @@ static netdev_features_t be_features_check(struct sk_buff *skb,
 }
 #endif
 
+static int be_get_phys_port_id(struct net_device *dev,
+                              struct netdev_phys_item_id *ppid)
+{
+       int i, id_len = CNTL_SERIAL_NUM_WORDS * CNTL_SERIAL_NUM_WORD_SZ + 1;
+       struct be_adapter *adapter = netdev_priv(dev);
+       u8 *id;
+
+       if (MAX_PHYS_ITEM_ID_LEN < id_len)
+               return -ENOSPC;
+
+       ppid->id[0] = adapter->hba_port_num + 1;
+       id = &ppid->id[1];
+       for (i = CNTL_SERIAL_NUM_WORDS - 1; i >= 0;
+            i--, id += CNTL_SERIAL_NUM_WORD_SZ)
+               memcpy(id, &adapter->serial_num[i], CNTL_SERIAL_NUM_WORD_SZ);
+
+       ppid->id_len = id_len;
+
+       return 0;
+}
+
 static const struct net_device_ops be_netdev_ops = {
        .ndo_open               = be_open,
        .ndo_stop               = be_close,
@@ -5249,6 +5270,7 @@ static const struct net_device_ops be_netdev_ops = {
        .ndo_del_vxlan_port     = be_del_vxlan_port,
        .ndo_features_check     = be_features_check,
 #endif
+       .ndo_get_phys_port_id   = be_get_phys_port_id,
 };
 
 static void be_netdev_init(struct net_device *netdev)