aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/ulp
diff options
context:
space:
mode:
authorOr Gerlitz <ogerlitz@voltaire.com>2011-01-10 20:41:54 -0500
committerRoland Dreier <rolandd@cisco.com>2011-01-10 20:41:54 -0500
commit19e364f6801e38972673278adedaab1abf6f854c (patch)
treeba2d39f4f449e9b1e911e6d5cbc39e08e54410c3 /drivers/infiniband/ulp
parent3c0eee3fe6a3a1c745379547c7e7c904aa64f6d5 (diff)
IPoIB: Remove LRO support
As a first step in moving from LRO to GRO, revert commit af40da894e9 ("IPoIB: add LRO support"). Also eliminate the ethtool set_flags callback which isn't needed anymore. Finally, we need to include <linux/sched.h> directly to get the declaration of restart_syscall() (which used to be included implicitly through <linux/inet_lro.h>). Cc: Ben Hutchings <bhutchings@solarflare.com> Cc: Eric W. Biederman <ebiederm@xmission.com> Cc: Vladimir Sokolovsky <vlad@mellanox.co.il> Signed-off-by: Or Gerlitz <ogerlitz@voltaire.com> Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/infiniband/ulp')
-rw-r--r--drivers/infiniband/ulp/ipoib/Kconfig1
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib.h12
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_ethtool.c51
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_ib.c8
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_main.c62
5 files changed, 2 insertions, 132 deletions
diff --git a/drivers/infiniband/ulp/ipoib/Kconfig b/drivers/infiniband/ulp/ipoib/Kconfig
index 9d9a9dc51f18..55855eeabae7 100644
--- a/drivers/infiniband/ulp/ipoib/Kconfig
+++ b/drivers/infiniband/ulp/ipoib/Kconfig
@@ -1,7 +1,6 @@
1config INFINIBAND_IPOIB 1config INFINIBAND_IPOIB
2 tristate "IP-over-InfiniBand" 2 tristate "IP-over-InfiniBand"
3 depends on NETDEVICES && INET && (IPV6 || IPV6=n) 3 depends on NETDEVICES && INET && (IPV6 || IPV6=n)
4 select INET_LRO
5 ---help--- 4 ---help---
6 Support for the IP-over-InfiniBand protocol (IPoIB). This 5 Support for the IP-over-InfiniBand protocol (IPoIB). This
7 transports IP packets over InfiniBand so you can use your IB 6 transports IP packets over InfiniBand so you can use your IB
diff --git a/drivers/infiniband/ulp/ipoib/ipoib.h b/drivers/infiniband/ulp/ipoib/ipoib.h
index 753a983a5fdc..ab97f92fc257 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib.h
+++ b/drivers/infiniband/ulp/ipoib/ipoib.h
@@ -50,7 +50,7 @@
50#include <rdma/ib_verbs.h> 50#include <rdma/ib_verbs.h>
51#include <rdma/ib_pack.h> 51#include <rdma/ib_pack.h>
52#include <rdma/ib_sa.h> 52#include <rdma/ib_sa.h>
53#include <linux/inet_lro.h> 53#include <linux/sched.h>
54 54
55/* constants */ 55/* constants */
56 56
@@ -100,9 +100,6 @@ enum {
100 IPOIB_MCAST_FLAG_BUSY = 2, /* joining or already joined */ 100 IPOIB_MCAST_FLAG_BUSY = 2, /* joining or already joined */
101 IPOIB_MCAST_FLAG_ATTACHED = 3, 101 IPOIB_MCAST_FLAG_ATTACHED = 3,
102 102
103 IPOIB_MAX_LRO_DESCRIPTORS = 8,
104 IPOIB_LRO_MAX_AGGR = 64,
105
106 MAX_SEND_CQE = 16, 103 MAX_SEND_CQE = 16,
107 IPOIB_CM_COPYBREAK = 256, 104 IPOIB_CM_COPYBREAK = 256,
108}; 105};
@@ -262,11 +259,6 @@ struct ipoib_ethtool_st {
262 u16 max_coalesced_frames; 259 u16 max_coalesced_frames;
263}; 260};
264 261
265struct ipoib_lro {
266 struct net_lro_mgr lro_mgr;
267 struct net_lro_desc lro_desc[IPOIB_MAX_LRO_DESCRIPTORS];
268};
269
270/* 262/*
271 * Device private locking: network stack tx_lock protects members used 263 * Device private locking: network stack tx_lock protects members used
272 * in TX fast path, lock protects everything else. lock nests inside 264 * in TX fast path, lock protects everything else. lock nests inside
@@ -352,8 +344,6 @@ struct ipoib_dev_priv {
352 int hca_caps; 344 int hca_caps;
353 struct ipoib_ethtool_st ethtool; 345 struct ipoib_ethtool_st ethtool;
354 struct timer_list poll_timer; 346 struct timer_list poll_timer;
355
356 struct ipoib_lro lro;
357}; 347};
358 348
359struct ipoib_ah { 349struct ipoib_ah {
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_ethtool.c b/drivers/infiniband/ulp/ipoib/ipoib_ethtool.c
index 1a1657c82edd..19f7f5206f78 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_ethtool.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_ethtool.c
@@ -106,63 +106,12 @@ static int ipoib_set_coalesce(struct net_device *dev,
106 return 0; 106 return 0;
107} 107}
108 108
109static const char ipoib_stats_keys[][ETH_GSTRING_LEN] = {
110 "LRO aggregated", "LRO flushed",
111 "LRO avg aggr", "LRO no desc"
112};
113
114static void ipoib_get_strings(struct net_device *netdev, u32 stringset, u8 *data)
115{
116 switch (stringset) {
117 case ETH_SS_STATS:
118 memcpy(data, *ipoib_stats_keys, sizeof(ipoib_stats_keys));
119 break;
120 }
121}
122
123static int ipoib_get_sset_count(struct net_device *dev, int sset)
124{
125 switch (sset) {
126 case ETH_SS_STATS:
127 return ARRAY_SIZE(ipoib_stats_keys);
128 default:
129 return -EOPNOTSUPP;
130 }
131}
132
133static void ipoib_get_ethtool_stats(struct net_device *dev,
134 struct ethtool_stats *stats, uint64_t *data)
135{
136 struct ipoib_dev_priv *priv = netdev_priv(dev);
137 int index = 0;
138
139 /* Get LRO statistics */
140 data[index++] = priv->lro.lro_mgr.stats.aggregated;
141 data[index++] = priv->lro.lro_mgr.stats.flushed;
142 if (priv->lro.lro_mgr.stats.flushed)
143 data[index++] = priv->lro.lro_mgr.stats.aggregated /
144 priv->lro.lro_mgr.stats.flushed;
145 else
146 data[index++] = 0;
147 data[index++] = priv->lro.lro_mgr.stats.no_desc;
148}
149
150static int ipoib_set_flags(struct net_device *dev, u32 flags)
151{
152 return ethtool_op_set_flags(dev, flags, ETH_FLAG_LRO);
153}
154
155static const struct ethtool_ops ipoib_ethtool_ops = { 109static const struct ethtool_ops ipoib_ethtool_ops = {
156 .get_drvinfo = ipoib_get_drvinfo, 110 .get_drvinfo = ipoib_get_drvinfo,
157 .get_rx_csum = ipoib_get_rx_csum, 111 .get_rx_csum = ipoib_get_rx_csum,
158 .set_tso = ipoib_set_tso, 112 .set_tso = ipoib_set_tso,
159 .get_coalesce = ipoib_get_coalesce, 113 .get_coalesce = ipoib_get_coalesce,
160 .set_coalesce = ipoib_set_coalesce, 114 .set_coalesce = ipoib_set_coalesce,
161 .get_flags = ethtool_op_get_flags,
162 .set_flags = ipoib_set_flags,
163 .get_strings = ipoib_get_strings,
164 .get_sset_count = ipoib_get_sset_count,
165 .get_ethtool_stats = ipoib_get_ethtool_stats,
166}; 115};
167 116
168void ipoib_set_ethtool_ops(struct net_device *dev) 117void 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 dfa71903d6e4..44c33bd97952 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_ib.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_ib.c
@@ -295,10 +295,7 @@ static void ipoib_ib_handle_rx_wc(struct net_device *dev, struct ib_wc *wc)
295 if (test_bit(IPOIB_FLAG_CSUM, &priv->flags) && likely(wc->csum_ok)) 295 if (test_bit(IPOIB_FLAG_CSUM, &priv->flags) && likely(wc->csum_ok))
296 skb->ip_summed = CHECKSUM_UNNECESSARY; 296 skb->ip_summed = CHECKSUM_UNNECESSARY;
297 297
298 if (dev->features & NETIF_F_LRO) 298 netif_receive_skb(skb);
299 lro_receive_skb(&priv->lro.lro_mgr, skb, NULL);
300 else
301 netif_receive_skb(skb);
302 299
303repost: 300repost:
304 if (unlikely(ipoib_ib_post_receive(dev, wr_id))) 301 if (unlikely(ipoib_ib_post_receive(dev, wr_id)))
@@ -450,9 +447,6 @@ poll_more:
450 } 447 }
451 448
452 if (done < budget) { 449 if (done < budget) {
453 if (dev->features & NETIF_F_LRO)
454 lro_flush_all(&priv->lro.lro_mgr);
455
456 napi_complete(napi); 450 napi_complete(napi);
457 if (unlikely(ib_req_notify_cq(priv->recv_cq, 451 if (unlikely(ib_req_notify_cq(priv->recv_cq,
458 IB_CQ_NEXT_COMP | 452 IB_CQ_NEXT_COMP |
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c
index 9ff7bc73ed95..c434a856a787 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_main.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c
@@ -60,15 +60,6 @@ MODULE_PARM_DESC(send_queue_size, "Number of descriptors in send queue");
60module_param_named(recv_queue_size, ipoib_recvq_size, int, 0444); 60module_param_named(recv_queue_size, ipoib_recvq_size, int, 0444);
61MODULE_PARM_DESC(recv_queue_size, "Number of descriptors in receive queue"); 61MODULE_PARM_DESC(recv_queue_size, "Number of descriptors in receive queue");
62 62
63static int lro;
64module_param(lro, bool, 0444);
65MODULE_PARM_DESC(lro, "Enable LRO (Large Receive Offload)");
66
67static int lro_max_aggr = IPOIB_LRO_MAX_AGGR;
68module_param(lro_max_aggr, int, 0644);
69MODULE_PARM_DESC(lro_max_aggr, "LRO: Max packets to be aggregated "
70 "(default = 64)");
71
72#ifdef CONFIG_INFINIBAND_IPOIB_DEBUG 63#ifdef CONFIG_INFINIBAND_IPOIB_DEBUG
73int ipoib_debug_level; 64int ipoib_debug_level;
74 65
@@ -976,54 +967,6 @@ static const struct header_ops ipoib_header_ops = {
976 .create = ipoib_hard_header, 967 .create = ipoib_hard_header,
977}; 968};
978 969
979static int get_skb_hdr(struct sk_buff *skb, void **iphdr,
980 void **tcph, u64 *hdr_flags, void *priv)
981{
982 unsigned int ip_len;
983 struct iphdr *iph;
984
985 if (unlikely(skb->protocol != htons(ETH_P_IP)))
986 return -1;
987
988 /*
989 * In the future we may add an else clause that verifies the
990 * checksum and allows devices which do not calculate checksum
991 * to use LRO.
992 */
993 if (unlikely(skb->ip_summed != CHECKSUM_UNNECESSARY))
994 return -1;
995
996 /* Check for non-TCP packet */
997 skb_reset_network_header(skb);
998 iph = ip_hdr(skb);
999 if (iph->protocol != IPPROTO_TCP)
1000 return -1;
1001
1002 ip_len = ip_hdrlen(skb);
1003 skb_set_transport_header(skb, ip_len);
1004 *tcph = tcp_hdr(skb);
1005
1006 /* check if IP header and TCP header are complete */
1007 if (ntohs(iph->tot_len) < ip_len + tcp_hdrlen(skb))
1008 return -1;
1009
1010 *hdr_flags = LRO_IPV4 | LRO_TCP;
1011 *iphdr = iph;
1012
1013 return 0;
1014}
1015
1016static void ipoib_lro_setup(struct ipoib_dev_priv *priv)
1017{
1018 priv->lro.lro_mgr.max_aggr = lro_max_aggr;
1019 priv->lro.lro_mgr.max_desc = IPOIB_MAX_LRO_DESCRIPTORS;
1020 priv->lro.lro_mgr.lro_arr = priv->lro.lro_desc;
1021 priv->lro.lro_mgr.get_skb_header = get_skb_hdr;
1022 priv->lro.lro_mgr.features = LRO_F_NAPI;
1023 priv->lro.lro_mgr.dev = priv->dev;
1024 priv->lro.lro_mgr.ip_summed_aggr = CHECKSUM_UNNECESSARY;
1025}
1026
1027static const struct net_device_ops ipoib_netdev_ops = { 970static const struct net_device_ops ipoib_netdev_ops = {
1028 .ndo_open = ipoib_open, 971 .ndo_open = ipoib_open,
1029 .ndo_stop = ipoib_stop, 972 .ndo_stop = ipoib_stop,
@@ -1067,8 +1010,6 @@ static void ipoib_setup(struct net_device *dev)
1067 1010
1068 priv->dev = dev; 1011 priv->dev = dev;
1069 1012
1070 ipoib_lro_setup(priv);
1071
1072 spin_lock_init(&priv->lock); 1013 spin_lock_init(&priv->lock);
1073 1014
1074 mutex_init(&priv->vlan_mutex); 1015 mutex_init(&priv->vlan_mutex);
@@ -1218,9 +1159,6 @@ int ipoib_set_dev_features(struct ipoib_dev_priv *priv, struct ib_device *hca)
1218 priv->dev->features |= NETIF_F_SG | NETIF_F_IP_CSUM; 1159 priv->dev->features |= NETIF_F_SG | NETIF_F_IP_CSUM;
1219 } 1160 }
1220 1161
1221 if (lro)
1222 priv->dev->features |= NETIF_F_LRO;
1223
1224 if (priv->dev->features & NETIF_F_SG && priv->hca_caps & IB_DEVICE_UD_TSO) 1162 if (priv->dev->features & NETIF_F_SG && priv->hca_caps & IB_DEVICE_UD_TSO)
1225 priv->dev->features |= NETIF_F_TSO; 1163 priv->dev->features |= NETIF_F_TSO;
1226 1164