aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband
diff options
context:
space:
mode:
authorRoland Dreier <roland@purestorage.com>2012-10-03 00:23:43 -0400
committerRoland Dreier <roland@purestorage.com>2012-10-03 00:33:41 -0400
commit71d9c5f9e60846fa40c9efadda122d9cf275c1d2 (patch)
tree809bbc9b14de1af464f8ab278a092e1b61f9f4e6 /drivers/infiniband
parent7a9a2970b5c1c2ce73d4bb84edaa7ebf13e0c841 (diff)
IPoIB: Fix build with CONFIG_INFINIBAND_IPOIB_CM=n
With the new netlink support in commit 862096a8bbf8 ("IB/ipoib: Add more rtnl_link_ops callbacks") we need ipoib_set_mode() to be available even if connected mode isn't built. Move the function from ipoib_cm.c to ipoib_main.c (and make a few CM-related macros available unconditonally). This fixes the build error drivers/built-in.o: In function 'ipoib_changelink': ipoib_netlink.c:(.text+0x6a5fc9): undefined reference to 'ipoib_set_mode' ipoib_netlink.c:(.text+0x6a5fe3): undefined reference to 'ipoib_set_mode' when CONFIG_INFINIBAND_IPOIB_CM isn't set. Reported-by: Randy Dunlap <rdunlap@xenotime.net> Reported-by: Michael Neuling <mikey@neuling.org> Signed-off-by: Roland Dreier <roland@purestorage.com>
Diffstat (limited to 'drivers/infiniband')
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib.h4
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_cm.c31
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_main.c31
3 files changed, 33 insertions, 33 deletions
diff --git a/drivers/infiniband/ulp/ipoib/ipoib.h b/drivers/infiniband/ulp/ipoib/ipoib.h
index 196eb52f0035..07ca6fd5546b 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib.h
+++ b/drivers/infiniband/ulp/ipoib/ipoib.h
@@ -535,14 +535,14 @@ void ipoib_drain_cq(struct net_device *dev);
535void ipoib_set_ethtool_ops(struct net_device *dev); 535void ipoib_set_ethtool_ops(struct net_device *dev);
536int ipoib_set_dev_features(struct ipoib_dev_priv *priv, struct ib_device *hca); 536int ipoib_set_dev_features(struct ipoib_dev_priv *priv, struct ib_device *hca);
537 537
538#ifdef CONFIG_INFINIBAND_IPOIB_CM
539
540#define IPOIB_FLAGS_RC 0x80 538#define IPOIB_FLAGS_RC 0x80
541#define IPOIB_FLAGS_UC 0x40 539#define IPOIB_FLAGS_UC 0x40
542 540
543/* We don't support UC connections at the moment */ 541/* We don't support UC connections at the moment */
544#define IPOIB_CM_SUPPORTED(ha) (ha[0] & (IPOIB_FLAGS_RC)) 542#define IPOIB_CM_SUPPORTED(ha) (ha[0] & (IPOIB_FLAGS_RC))
545 543
544#ifdef CONFIG_INFINIBAND_IPOIB_CM
545
546extern int ipoib_max_conn_qp; 546extern int ipoib_max_conn_qp;
547 547
548static inline int ipoib_cm_admin_enabled(struct net_device *dev) 548static inline int ipoib_cm_admin_enabled(struct net_device *dev)
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_cm.c b/drivers/infiniband/ulp/ipoib/ipoib_cm.c
index 175581cf478c..72ae63f0072d 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_cm.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_cm.c
@@ -1448,37 +1448,6 @@ static ssize_t show_mode(struct device *d, struct device_attribute *attr,
1448 return sprintf(buf, "datagram\n"); 1448 return sprintf(buf, "datagram\n");
1449} 1449}
1450 1450
1451int ipoib_set_mode(struct net_device *dev, const char *buf)
1452{
1453 struct ipoib_dev_priv *priv = netdev_priv(dev);
1454
1455 /* flush paths if we switch modes so that connections are restarted */
1456 if (IPOIB_CM_SUPPORTED(dev->dev_addr) && !strcmp(buf, "connected\n")) {
1457 set_bit(IPOIB_FLAG_ADMIN_CM, &priv->flags);
1458 ipoib_warn(priv, "enabling connected mode "
1459 "will cause multicast packet drops\n");
1460 netdev_update_features(dev);
1461 rtnl_unlock();
1462 priv->tx_wr.send_flags &= ~IB_SEND_IP_CSUM;
1463
1464 ipoib_flush_paths(dev);
1465 rtnl_lock();
1466 return 0;
1467 }
1468
1469 if (!strcmp(buf, "datagram\n")) {
1470 clear_bit(IPOIB_FLAG_ADMIN_CM, &priv->flags);
1471 netdev_update_features(dev);
1472 dev_set_mtu(dev, min(priv->mcast_mtu, dev->mtu));
1473 rtnl_unlock();
1474 ipoib_flush_paths(dev);
1475 rtnl_lock();
1476 return 0;
1477 }
1478
1479 return -EINVAL;
1480}
1481
1482static ssize_t set_mode(struct device *d, struct device_attribute *attr, 1451static ssize_t set_mode(struct device *d, struct device_attribute *attr,
1483 const char *buf, size_t count) 1452 const char *buf, size_t count)
1484{ 1453{
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c
index d576c7aad89d..6fdc9e78da0d 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_main.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c
@@ -215,6 +215,37 @@ static int ipoib_change_mtu(struct net_device *dev, int new_mtu)
215 return 0; 215 return 0;
216} 216}
217 217
218int ipoib_set_mode(struct net_device *dev, const char *buf)
219{
220 struct ipoib_dev_priv *priv = netdev_priv(dev);
221
222 /* flush paths if we switch modes so that connections are restarted */
223 if (IPOIB_CM_SUPPORTED(dev->dev_addr) && !strcmp(buf, "connected\n")) {
224 set_bit(IPOIB_FLAG_ADMIN_CM, &priv->flags);
225 ipoib_warn(priv, "enabling connected mode "
226 "will cause multicast packet drops\n");
227 netdev_update_features(dev);
228 rtnl_unlock();
229 priv->tx_wr.send_flags &= ~IB_SEND_IP_CSUM;
230
231 ipoib_flush_paths(dev);
232 rtnl_lock();
233 return 0;
234 }
235
236 if (!strcmp(buf, "datagram\n")) {
237 clear_bit(IPOIB_FLAG_ADMIN_CM, &priv->flags);
238 netdev_update_features(dev);
239 dev_set_mtu(dev, min(priv->mcast_mtu, dev->mtu));
240 rtnl_unlock();
241 ipoib_flush_paths(dev);
242 rtnl_lock();
243 return 0;
244 }
245
246 return -EINVAL;
247}
248
218static struct ipoib_path *__path_find(struct net_device *dev, void *gid) 249static struct ipoib_path *__path_find(struct net_device *dev, void *gid)
219{ 250{
220 struct ipoib_dev_priv *priv = netdev_priv(dev); 251 struct ipoib_dev_priv *priv = netdev_priv(dev);