diff options
author | Michał Mirosław <mirq-linux@rere.qmqm.pl> | 2011-04-18 20:43:20 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-04-20 04:30:42 -0400 |
commit | 3d96c74d8983b16bc7ecb196e61a2173fcc3f09f (patch) | |
tree | 3ecb598a9e24e916854e43f7f0ce5016ebebc22e /drivers | |
parent | 6204b47ec4394f7e472885c8d05d9cda96d97a25 (diff) |
net: infiniband/ulp/ipoib: convert to hw_features
Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/infiniband/ulp/ipoib/ipoib.h | 1 | ||||
-rw-r--r-- | drivers/infiniband/ulp/ipoib/ipoib_cm.c | 11 | ||||
-rw-r--r-- | drivers/infiniband/ulp/ipoib/ipoib_ethtool.c | 28 | ||||
-rw-r--r-- | drivers/infiniband/ulp/ipoib/ipoib_ib.c | 2 | ||||
-rw-r--r-- | drivers/infiniband/ulp/ipoib/ipoib_main.c | 24 |
5 files changed, 20 insertions, 46 deletions
diff --git a/drivers/infiniband/ulp/ipoib/ipoib.h b/drivers/infiniband/ulp/ipoib/ipoib.h index ab97f92fc257..7b6985a2e652 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib.h +++ b/drivers/infiniband/ulp/ipoib/ipoib.h | |||
@@ -91,7 +91,6 @@ enum { | |||
91 | IPOIB_STOP_REAPER = 7, | 91 | IPOIB_STOP_REAPER = 7, |
92 | IPOIB_FLAG_ADMIN_CM = 9, | 92 | IPOIB_FLAG_ADMIN_CM = 9, |
93 | IPOIB_FLAG_UMCAST = 10, | 93 | IPOIB_FLAG_UMCAST = 10, |
94 | IPOIB_FLAG_CSUM = 11, | ||
95 | 94 | ||
96 | IPOIB_MAX_BACKOFF_SECONDS = 16, | 95 | IPOIB_MAX_BACKOFF_SECONDS = 16, |
97 | 96 | ||
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_cm.c b/drivers/infiniband/ulp/ipoib/ipoib_cm.c index 93d55806b967..39913a065f99 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_cm.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_cm.c | |||
@@ -1463,8 +1463,7 @@ static ssize_t set_mode(struct device *d, struct device_attribute *attr, | |||
1463 | set_bit(IPOIB_FLAG_ADMIN_CM, &priv->flags); | 1463 | set_bit(IPOIB_FLAG_ADMIN_CM, &priv->flags); |
1464 | ipoib_warn(priv, "enabling connected mode " | 1464 | ipoib_warn(priv, "enabling connected mode " |
1465 | "will cause multicast packet drops\n"); | 1465 | "will cause multicast packet drops\n"); |
1466 | 1466 | netdev_update_features(dev); | |
1467 | dev->features &= ~(NETIF_F_IP_CSUM | NETIF_F_SG | NETIF_F_TSO); | ||
1468 | rtnl_unlock(); | 1467 | rtnl_unlock(); |
1469 | priv->tx_wr.send_flags &= ~IB_SEND_IP_CSUM; | 1468 | priv->tx_wr.send_flags &= ~IB_SEND_IP_CSUM; |
1470 | 1469 | ||
@@ -1474,13 +1473,7 @@ static ssize_t set_mode(struct device *d, struct device_attribute *attr, | |||
1474 | 1473 | ||
1475 | if (!strcmp(buf, "datagram\n")) { | 1474 | if (!strcmp(buf, "datagram\n")) { |
1476 | clear_bit(IPOIB_FLAG_ADMIN_CM, &priv->flags); | 1475 | clear_bit(IPOIB_FLAG_ADMIN_CM, &priv->flags); |
1477 | 1476 | netdev_update_features(dev); | |
1478 | if (test_bit(IPOIB_FLAG_CSUM, &priv->flags)) { | ||
1479 | dev->features |= NETIF_F_IP_CSUM | NETIF_F_SG; | ||
1480 | priv->dev->features |= NETIF_F_GRO; | ||
1481 | if (priv->hca_caps & IB_DEVICE_UD_TSO) | ||
1482 | dev->features |= NETIF_F_TSO; | ||
1483 | } | ||
1484 | dev_set_mtu(dev, min(priv->mcast_mtu, dev->mtu)); | 1477 | dev_set_mtu(dev, min(priv->mcast_mtu, dev->mtu)); |
1485 | rtnl_unlock(); | 1478 | rtnl_unlock(); |
1486 | ipoib_flush_paths(dev); | 1479 | ipoib_flush_paths(dev); |
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_ethtool.c b/drivers/infiniband/ulp/ipoib/ipoib_ethtool.c index 19f7f5206f78..29bc7b5724ac 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_ethtool.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_ethtool.c | |||
@@ -42,32 +42,6 @@ static void ipoib_get_drvinfo(struct net_device *netdev, | |||
42 | strncpy(drvinfo->driver, "ipoib", sizeof(drvinfo->driver) - 1); | 42 | strncpy(drvinfo->driver, "ipoib", sizeof(drvinfo->driver) - 1); |
43 | } | 43 | } |
44 | 44 | ||
45 | static u32 ipoib_get_rx_csum(struct net_device *dev) | ||
46 | { | ||
47 | struct ipoib_dev_priv *priv = netdev_priv(dev); | ||
48 | return test_bit(IPOIB_FLAG_CSUM, &priv->flags) && | ||
49 | !test_bit(IPOIB_FLAG_ADMIN_CM, &priv->flags); | ||
50 | } | ||
51 | |||
52 | static int ipoib_set_tso(struct net_device *dev, u32 data) | ||
53 | { | ||
54 | struct ipoib_dev_priv *priv = netdev_priv(dev); | ||
55 | |||
56 | if (data) { | ||
57 | if (!test_bit(IPOIB_FLAG_ADMIN_CM, &priv->flags) && | ||
58 | (dev->features & NETIF_F_SG) && | ||
59 | (priv->hca_caps & IB_DEVICE_UD_TSO)) { | ||
60 | dev->features |= NETIF_F_TSO; | ||
61 | } else { | ||
62 | ipoib_warn(priv, "can't set TSO on\n"); | ||
63 | return -EOPNOTSUPP; | ||
64 | } | ||
65 | } else | ||
66 | dev->features &= ~NETIF_F_TSO; | ||
67 | |||
68 | return 0; | ||
69 | } | ||
70 | |||
71 | static int ipoib_get_coalesce(struct net_device *dev, | 45 | static int ipoib_get_coalesce(struct net_device *dev, |
72 | struct ethtool_coalesce *coal) | 46 | struct ethtool_coalesce *coal) |
73 | { | 47 | { |
@@ -108,8 +82,6 @@ static int ipoib_set_coalesce(struct net_device *dev, | |||
108 | 82 | ||
109 | static const struct ethtool_ops ipoib_ethtool_ops = { | 83 | static const struct ethtool_ops ipoib_ethtool_ops = { |
110 | .get_drvinfo = ipoib_get_drvinfo, | 84 | .get_drvinfo = ipoib_get_drvinfo, |
111 | .get_rx_csum = ipoib_get_rx_csum, | ||
112 | .set_tso = ipoib_set_tso, | ||
113 | .get_coalesce = ipoib_get_coalesce, | 85 | .get_coalesce = ipoib_get_coalesce, |
114 | .set_coalesce = ipoib_set_coalesce, | 86 | .set_coalesce = ipoib_set_coalesce, |
115 | }; | 87 | }; |
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_ib.c b/drivers/infiniband/ulp/ipoib/ipoib_ib.c index 806d0292dc39..81ae61d68a22 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_ib.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_ib.c | |||
@@ -292,7 +292,7 @@ static void ipoib_ib_handle_rx_wc(struct net_device *dev, struct ib_wc *wc) | |||
292 | dev->stats.rx_bytes += skb->len; | 292 | dev->stats.rx_bytes += skb->len; |
293 | 293 | ||
294 | skb->dev = dev; | 294 | skb->dev = dev; |
295 | if (test_bit(IPOIB_FLAG_CSUM, &priv->flags) && likely(wc->csum_ok)) | 295 | if ((dev->features & NETIF_F_RXCSUM) && likely(wc->csum_ok)) |
296 | skb->ip_summed = CHECKSUM_UNNECESSARY; | 296 | skb->ip_summed = CHECKSUM_UNNECESSARY; |
297 | 297 | ||
298 | napi_gro_receive(&priv->napi, skb); | 298 | napi_gro_receive(&priv->napi, skb); |
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c index aca3b44f7aed..86addca9ddf6 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_main.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c | |||
@@ -171,6 +171,16 @@ static int ipoib_stop(struct net_device *dev) | |||
171 | return 0; | 171 | return 0; |
172 | } | 172 | } |
173 | 173 | ||
174 | static u32 ipoib_fix_features(struct net_device *dev, u32 features) | ||
175 | { | ||
176 | struct ipoib_dev_priv *priv = netdev_priv(dev); | ||
177 | |||
178 | if (test_bit(IPOIB_FLAG_ADMIN_CM, &priv->flags)) | ||
179 | features &= ~(NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO); | ||
180 | |||
181 | return features; | ||
182 | } | ||
183 | |||
174 | static int ipoib_change_mtu(struct net_device *dev, int new_mtu) | 184 | static int ipoib_change_mtu(struct net_device *dev, int new_mtu) |
175 | { | 185 | { |
176 | struct ipoib_dev_priv *priv = netdev_priv(dev); | 186 | struct ipoib_dev_priv *priv = netdev_priv(dev); |
@@ -970,6 +980,7 @@ static const struct net_device_ops ipoib_netdev_ops = { | |||
970 | .ndo_open = ipoib_open, | 980 | .ndo_open = ipoib_open, |
971 | .ndo_stop = ipoib_stop, | 981 | .ndo_stop = ipoib_stop, |
972 | .ndo_change_mtu = ipoib_change_mtu, | 982 | .ndo_change_mtu = ipoib_change_mtu, |
983 | .ndo_fix_features = ipoib_fix_features, | ||
973 | .ndo_start_xmit = ipoib_start_xmit, | 984 | .ndo_start_xmit = ipoib_start_xmit, |
974 | .ndo_tx_timeout = ipoib_timeout, | 985 | .ndo_tx_timeout = ipoib_timeout, |
975 | .ndo_set_multicast_list = ipoib_set_mcast_list, | 986 | .ndo_set_multicast_list = ipoib_set_mcast_list, |
@@ -1154,19 +1165,18 @@ int ipoib_set_dev_features(struct ipoib_dev_priv *priv, struct ib_device *hca) | |||
1154 | kfree(device_attr); | 1165 | kfree(device_attr); |
1155 | 1166 | ||
1156 | if (priv->hca_caps & IB_DEVICE_UD_IP_CSUM) { | 1167 | if (priv->hca_caps & IB_DEVICE_UD_IP_CSUM) { |
1157 | set_bit(IPOIB_FLAG_CSUM, &priv->flags); | 1168 | priv->dev->hw_features = NETIF_F_SG | |
1158 | priv->dev->features |= NETIF_F_SG | NETIF_F_IP_CSUM; | 1169 | NETIF_F_IP_CSUM | NETIF_F_RXCSUM; |
1159 | } | ||
1160 | 1170 | ||
1161 | priv->dev->features |= NETIF_F_GRO; | 1171 | if (priv->hca_caps & IB_DEVICE_UD_TSO) |
1172 | priv->dev->hw_features |= NETIF_F_TSO; | ||
1162 | 1173 | ||
1163 | if (priv->dev->features & NETIF_F_SG && priv->hca_caps & IB_DEVICE_UD_TSO) | 1174 | priv->dev->features |= priv->dev->hw_features; |
1164 | priv->dev->features |= NETIF_F_TSO; | 1175 | } |
1165 | 1176 | ||
1166 | return 0; | 1177 | return 0; |
1167 | } | 1178 | } |
1168 | 1179 | ||
1169 | |||
1170 | static struct net_device *ipoib_add_port(const char *format, | 1180 | static struct net_device *ipoib_add_port(const char *format, |
1171 | struct ib_device *hca, u8 port) | 1181 | struct ib_device *hca, u8 port) |
1172 | { | 1182 | { |