aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/ulp/ipoib/ipoib_main.c
diff options
context:
space:
mode:
authorEli Cohen <eli@dev.mellanox.co.il>2008-04-17 00:01:10 -0400
committerRoland Dreier <rolandd@cisco.com>2008-04-17 00:01:10 -0400
commit6046136c742e32d5e6431cdcd8957638d1816821 (patch)
tree512a0165e982e5bdf93ba0732c4a52b01c84317b /drivers/infiniband/ulp/ipoib/ipoib_main.c
parent3371836383d63b627b228875f5ac63023cbf11d2 (diff)
IPoIB: Use checksum offload support if available
For HCAs that support checksum offload (ie that set IB_DEVICE_UD_IP_CSUM in the device capabilities flags), have IPoIB set NETIF_F_IP_CSUM and use the HCA to generate and verify IP checksums. Signed-off-by: Eli Cohen <eli@mellanox.co.il> Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/infiniband/ulp/ipoib/ipoib_main.c')
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_main.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c
index 57282048865..329b4675aec 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_main.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c
@@ -1105,6 +1105,7 @@ static struct net_device *ipoib_add_port(const char *format,
1105 struct ib_device *hca, u8 port) 1105 struct ib_device *hca, u8 port)
1106{ 1106{
1107 struct ipoib_dev_priv *priv; 1107 struct ipoib_dev_priv *priv;
1108 struct ib_device_attr *device_attr;
1108 int result = -ENOMEM; 1109 int result = -ENOMEM;
1109 1110
1110 priv = ipoib_intf_alloc(format); 1111 priv = ipoib_intf_alloc(format);
@@ -1120,6 +1121,28 @@ static struct net_device *ipoib_add_port(const char *format,
1120 goto device_init_failed; 1121 goto device_init_failed;
1121 } 1122 }
1122 1123
1124 device_attr = kmalloc(sizeof *device_attr, GFP_KERNEL);
1125 if (!device_attr) {
1126 printk(KERN_WARNING "%s: allocation of %zu bytes failed\n",
1127 hca->name, sizeof *device_attr);
1128 goto device_init_failed;
1129 }
1130
1131 result = ib_query_device(hca, device_attr);
1132 if (result) {
1133 printk(KERN_WARNING "%s: ib_query_device failed (ret = %d)\n",
1134 hca->name, result);
1135 kfree(device_attr);
1136 goto device_init_failed;
1137 }
1138
1139 if (device_attr->device_cap_flags & IB_DEVICE_UD_IP_CSUM) {
1140 set_bit(IPOIB_FLAG_CSUM, &priv->flags);
1141 priv->dev->features |= NETIF_F_SG | NETIF_F_IP_CSUM;
1142 }
1143
1144 kfree(device_attr);
1145
1123 /* 1146 /*
1124 * Set the full membership bit, so that we join the right 1147 * Set the full membership bit, so that we join the right
1125 * broadcast group, etc. 1148 * broadcast group, etc.
@@ -1137,7 +1160,6 @@ static struct net_device *ipoib_add_port(const char *format,
1137 } else 1160 } else
1138 memcpy(priv->dev->dev_addr + 4, priv->local_gid.raw, sizeof (union ib_gid)); 1161 memcpy(priv->dev->dev_addr + 4, priv->local_gid.raw, sizeof (union ib_gid));
1139 1162
1140
1141 result = ipoib_dev_init(priv->dev, hca, port); 1163 result = ipoib_dev_init(priv->dev, hca, port);
1142 if (result < 0) { 1164 if (result < 0) {
1143 printk(KERN_WARNING "%s: failed to initialize port %d (ret = %d)\n", 1165 printk(KERN_WARNING "%s: failed to initialize port %d (ret = %d)\n",