aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/ulp
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/infiniband/ulp')
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib.h6
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_ib.c73
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_main.c6
3 files changed, 20 insertions, 65 deletions
diff --git a/drivers/infiniband/ulp/ipoib/ipoib.h b/drivers/infiniband/ulp/ipoib/ipoib.h
index c639f90cfda4..683d23ac7cbf 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib.h
+++ b/drivers/infiniband/ulp/ipoib/ipoib.h
@@ -86,7 +86,6 @@ enum {
86 IPOIB_FLAG_INITIALIZED = 1, 86 IPOIB_FLAG_INITIALIZED = 1,
87 IPOIB_FLAG_ADMIN_UP = 2, 87 IPOIB_FLAG_ADMIN_UP = 2,
88 IPOIB_PKEY_ASSIGNED = 3, 88 IPOIB_PKEY_ASSIGNED = 3,
89 IPOIB_PKEY_STOP = 4,
90 IPOIB_FLAG_SUBINTERFACE = 5, 89 IPOIB_FLAG_SUBINTERFACE = 5,
91 IPOIB_MCAST_RUN = 6, 90 IPOIB_MCAST_RUN = 6,
92 IPOIB_STOP_REAPER = 7, 91 IPOIB_STOP_REAPER = 7,
@@ -312,7 +311,6 @@ struct ipoib_dev_priv {
312 struct list_head multicast_list; 311 struct list_head multicast_list;
313 struct rb_root multicast_tree; 312 struct rb_root multicast_tree;
314 313
315 struct delayed_work pkey_poll_task;
316 struct delayed_work mcast_task; 314 struct delayed_work mcast_task;
317 struct work_struct carrier_on_task; 315 struct work_struct carrier_on_task;
318 struct work_struct flush_light; 316 struct work_struct flush_light;
@@ -477,6 +475,7 @@ int ipoib_ib_dev_open(struct net_device *dev);
477int ipoib_ib_dev_up(struct net_device *dev); 475int ipoib_ib_dev_up(struct net_device *dev);
478int ipoib_ib_dev_down(struct net_device *dev, int flush); 476int ipoib_ib_dev_down(struct net_device *dev, int flush);
479int ipoib_ib_dev_stop(struct net_device *dev, int flush); 477int ipoib_ib_dev_stop(struct net_device *dev, int flush);
478void ipoib_pkey_dev_check_presence(struct net_device *dev);
480 479
481int ipoib_dev_init(struct net_device *dev, struct ib_device *ca, int port); 480int ipoib_dev_init(struct net_device *dev, struct ib_device *ca, int port);
482void ipoib_dev_cleanup(struct net_device *dev); 481void ipoib_dev_cleanup(struct net_device *dev);
@@ -532,8 +531,7 @@ int ipoib_set_mode(struct net_device *dev, const char *buf);
532 531
533void ipoib_setup(struct net_device *dev); 532void ipoib_setup(struct net_device *dev);
534 533
535void ipoib_pkey_poll(struct work_struct *work); 534void ipoib_pkey_open(struct ipoib_dev_priv *priv);
536int ipoib_pkey_dev_delay_open(struct net_device *dev);
537void ipoib_drain_cq(struct net_device *dev); 535void ipoib_drain_cq(struct net_device *dev);
538 536
539void ipoib_set_ethtool_ops(struct net_device *dev); 537void ipoib_set_ethtool_ops(struct net_device *dev);
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_ib.c b/drivers/infiniband/ulp/ipoib/ipoib_ib.c
index 6a7003ddb0be..be8f971edbec 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_ib.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_ib.c
@@ -709,7 +709,7 @@ dev_stop:
709 return -1; 709 return -1;
710} 710}
711 711
712static void ipoib_pkey_dev_check_presence(struct net_device *dev) 712void ipoib_pkey_dev_check_presence(struct net_device *dev)
713{ 713{
714 struct ipoib_dev_priv *priv = netdev_priv(dev); 714 struct ipoib_dev_priv *priv = netdev_priv(dev);
715 u16 pkey_index = 0; 715 u16 pkey_index = 0;
@@ -745,14 +745,6 @@ int ipoib_ib_dev_down(struct net_device *dev, int flush)
745 clear_bit(IPOIB_FLAG_OPER_UP, &priv->flags); 745 clear_bit(IPOIB_FLAG_OPER_UP, &priv->flags);
746 netif_carrier_off(dev); 746 netif_carrier_off(dev);
747 747
748 /* Shutdown the P_Key thread if still active */
749 if (!test_bit(IPOIB_PKEY_ASSIGNED, &priv->flags)) {
750 mutex_lock(&pkey_mutex);
751 set_bit(IPOIB_PKEY_STOP, &priv->flags);
752 cancel_delayed_work_sync(&priv->pkey_poll_task);
753 mutex_unlock(&pkey_mutex);
754 }
755
756 ipoib_mcast_stop_thread(dev, flush); 748 ipoib_mcast_stop_thread(dev, flush);
757 ipoib_mcast_dev_flush(dev); 749 ipoib_mcast_dev_flush(dev);
758 750
@@ -988,9 +980,12 @@ static void __ipoib_ib_dev_flush(struct ipoib_dev_priv *priv,
988 980
989 if (!test_bit(IPOIB_FLAG_INITIALIZED, &priv->flags)) { 981 if (!test_bit(IPOIB_FLAG_INITIALIZED, &priv->flags)) {
990 /* for non-child devices must check/update the pkey value here */ 982 /* for non-child devices must check/update the pkey value here */
991 if (level == IPOIB_FLUSH_HEAVY && 983 if (level == IPOIB_FLUSH_HEAVY) {
992 !test_bit(IPOIB_FLAG_SUBINTERFACE, &priv->flags)) 984 if (test_bit(IPOIB_FLAG_SUBINTERFACE, &priv->flags))
993 update_parent_pkey(priv); 985 ipoib_pkey_open(priv);
986 else
987 update_parent_pkey(priv);
988 }
994 ipoib_dbg(priv, "Not flushing - IPOIB_FLAG_INITIALIZED not set.\n"); 989 ipoib_dbg(priv, "Not flushing - IPOIB_FLAG_INITIALIZED not set.\n");
995 return; 990 return;
996 } 991 }
@@ -1009,8 +1004,7 @@ static void __ipoib_ib_dev_flush(struct ipoib_dev_priv *priv,
1009 clear_bit(IPOIB_PKEY_ASSIGNED, &priv->flags); 1004 clear_bit(IPOIB_PKEY_ASSIGNED, &priv->flags);
1010 ipoib_ib_dev_down(dev, 0); 1005 ipoib_ib_dev_down(dev, 0);
1011 ipoib_ib_dev_stop(dev, 0); 1006 ipoib_ib_dev_stop(dev, 0);
1012 if (ipoib_pkey_dev_delay_open(dev)) 1007 return;
1013 return;
1014 } 1008 }
1015 /* restart QP only if P_Key index is changed */ 1009 /* restart QP only if P_Key index is changed */
1016 if (test_and_set_bit(IPOIB_PKEY_ASSIGNED, &priv->flags) && 1010 if (test_and_set_bit(IPOIB_PKEY_ASSIGNED, &priv->flags) &&
@@ -1094,54 +1088,15 @@ void ipoib_ib_dev_cleanup(struct net_device *dev)
1094 ipoib_transport_dev_cleanup(dev); 1088 ipoib_transport_dev_cleanup(dev);
1095} 1089}
1096 1090
1097/* 1091void ipoib_pkey_open(struct ipoib_dev_priv *priv)
1098 * Delayed P_Key Assigment Interim Support
1099 *
1100 * The following is initial implementation of delayed P_Key assigment
1101 * mechanism. It is using the same approach implemented for the multicast
1102 * group join. The single goal of this implementation is to quickly address
1103 * Bug #2507. This implementation will probably be removed when the P_Key
1104 * change async notification is available.
1105 */
1106
1107void ipoib_pkey_poll(struct work_struct *work)
1108{ 1092{
1109 struct ipoib_dev_priv *priv =
1110 container_of(work, struct ipoib_dev_priv, pkey_poll_task.work);
1111 struct net_device *dev = priv->dev;
1112 1093
1113 ipoib_pkey_dev_check_presence(dev); 1094 if (test_bit(IPOIB_FLAG_INITIALIZED, &priv->flags))
1095 return;
1096
1097 ipoib_pkey_dev_check_presence(priv->dev);
1114 1098
1115 if (test_bit(IPOIB_PKEY_ASSIGNED, &priv->flags)) 1099 if (test_bit(IPOIB_PKEY_ASSIGNED, &priv->flags))
1116 ipoib_open(dev); 1100 ipoib_open(priv->dev);
1117 else {
1118 mutex_lock(&pkey_mutex);
1119 if (!test_bit(IPOIB_PKEY_STOP, &priv->flags))
1120 queue_delayed_work(ipoib_workqueue,
1121 &priv->pkey_poll_task,
1122 HZ);
1123 mutex_unlock(&pkey_mutex);
1124 }
1125} 1101}
1126 1102
1127int ipoib_pkey_dev_delay_open(struct net_device *dev)
1128{
1129 struct ipoib_dev_priv *priv = netdev_priv(dev);
1130
1131 /* Look for the interface pkey value in the IB Port P_Key table and */
1132 /* set the interface pkey assigment flag */
1133 ipoib_pkey_dev_check_presence(dev);
1134
1135 /* P_Key value not assigned yet - start polling */
1136 if (!test_bit(IPOIB_PKEY_ASSIGNED, &priv->flags)) {
1137 mutex_lock(&pkey_mutex);
1138 clear_bit(IPOIB_PKEY_STOP, &priv->flags);
1139 queue_delayed_work(ipoib_workqueue,
1140 &priv->pkey_poll_task,
1141 HZ);
1142 mutex_unlock(&pkey_mutex);
1143 return 1;
1144 }
1145
1146 return 0;
1147}
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c
index 5786a78ff8bc..35acbd41a5f7 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_main.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c
@@ -108,7 +108,10 @@ int ipoib_open(struct net_device *dev)
108 108
109 set_bit(IPOIB_FLAG_ADMIN_UP, &priv->flags); 109 set_bit(IPOIB_FLAG_ADMIN_UP, &priv->flags);
110 110
111 if (ipoib_pkey_dev_delay_open(dev)) 111
112 ipoib_pkey_dev_check_presence(dev);
113
114 if (!test_bit(IPOIB_PKEY_ASSIGNED, &priv->flags))
112 return 0; 115 return 0;
113 116
114 if (ipoib_ib_dev_open(dev)) 117 if (ipoib_ib_dev_open(dev))
@@ -1379,7 +1382,6 @@ void ipoib_setup(struct net_device *dev)
1379 INIT_LIST_HEAD(&priv->dead_ahs); 1382 INIT_LIST_HEAD(&priv->dead_ahs);
1380 INIT_LIST_HEAD(&priv->multicast_list); 1383 INIT_LIST_HEAD(&priv->multicast_list);
1381 1384
1382 INIT_DELAYED_WORK(&priv->pkey_poll_task, ipoib_pkey_poll);
1383 INIT_DELAYED_WORK(&priv->mcast_task, ipoib_mcast_join_task); 1385 INIT_DELAYED_WORK(&priv->mcast_task, ipoib_mcast_join_task);
1384 INIT_WORK(&priv->carrier_on_task, ipoib_mcast_carrier_on_task); 1386 INIT_WORK(&priv->carrier_on_task, ipoib_mcast_carrier_on_task);
1385 INIT_WORK(&priv->flush_light, ipoib_ib_dev_flush_light); 1387 INIT_WORK(&priv->flush_light, ipoib_ib_dev_flush_light);