diff options
author | Shirley Ma <mashirle@us.ibm.com> | 2008-04-23 14:55:45 -0400 |
---|---|---|
committer | Roland Dreier <rolandd@cisco.com> | 2008-04-23 14:55:45 -0400 |
commit | bc7b3a36ba02e4053ca38653e6a753082d9add03 (patch) | |
tree | 28fe1daa7cab6c7cab71bbc7af22ee6ca7746323 /drivers/infiniband/ulp/ipoib/ipoib_main.c | |
parent | bc5698f3ecc9587e1edb343a2878f8d228c49e0e (diff) |
IPoIB: Handle 4K IB MTU for UD (datagram) mode
This patch enables IPoIB to use 4K UD messages (when the underlying
device and fabrics support a 4K MTU) by using two scatter buffers when
PAGE_SIZE is less than or equal to thhe HCA IB MTU size. The first
buffer is for IPoIB header + GRH header, and the second buffer is the
IPoIB payload, which is 4K-4.
Signed-off-by: Shirley Ma <xma@us.ibm.com>
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.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c index bd07f02cf02b..7a4ed9d3d844 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_main.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c | |||
@@ -195,7 +195,7 @@ static int ipoib_change_mtu(struct net_device *dev, int new_mtu) | |||
195 | return 0; | 195 | return 0; |
196 | } | 196 | } |
197 | 197 | ||
198 | if (new_mtu > IPOIB_PACKET_SIZE - IPOIB_ENCAP_LEN) | 198 | if (new_mtu > IPOIB_UD_MTU(priv->max_ib_mtu)) |
199 | return -EINVAL; | 199 | return -EINVAL; |
200 | 200 | ||
201 | priv->admin_mtu = new_mtu; | 201 | priv->admin_mtu = new_mtu; |
@@ -971,10 +971,6 @@ static void ipoib_setup(struct net_device *dev) | |||
971 | NETIF_F_LLTX | | 971 | NETIF_F_LLTX | |
972 | NETIF_F_HIGHDMA); | 972 | NETIF_F_HIGHDMA); |
973 | 973 | ||
974 | /* MTU will be reset when mcast join happens */ | ||
975 | dev->mtu = IPOIB_PACKET_SIZE - IPOIB_ENCAP_LEN; | ||
976 | priv->mcast_mtu = priv->admin_mtu = dev->mtu; | ||
977 | |||
978 | memcpy(dev->broadcast, ipv4_bcast_addr, INFINIBAND_ALEN); | 974 | memcpy(dev->broadcast, ipv4_bcast_addr, INFINIBAND_ALEN); |
979 | 975 | ||
980 | netif_carrier_off(dev); | 976 | netif_carrier_off(dev); |
@@ -1107,6 +1103,7 @@ static struct net_device *ipoib_add_port(const char *format, | |||
1107 | { | 1103 | { |
1108 | struct ipoib_dev_priv *priv; | 1104 | struct ipoib_dev_priv *priv; |
1109 | struct ib_device_attr *device_attr; | 1105 | struct ib_device_attr *device_attr; |
1106 | struct ib_port_attr attr; | ||
1110 | int result = -ENOMEM; | 1107 | int result = -ENOMEM; |
1111 | 1108 | ||
1112 | priv = ipoib_intf_alloc(format); | 1109 | priv = ipoib_intf_alloc(format); |
@@ -1115,6 +1112,18 @@ static struct net_device *ipoib_add_port(const char *format, | |||
1115 | 1112 | ||
1116 | SET_NETDEV_DEV(priv->dev, hca->dma_device); | 1113 | SET_NETDEV_DEV(priv->dev, hca->dma_device); |
1117 | 1114 | ||
1115 | if (!ib_query_port(hca, port, &attr)) | ||
1116 | priv->max_ib_mtu = ib_mtu_enum_to_int(attr.max_mtu); | ||
1117 | else { | ||
1118 | printk(KERN_WARNING "%s: ib_query_port %d failed\n", | ||
1119 | hca->name, port); | ||
1120 | goto device_init_failed; | ||
1121 | } | ||
1122 | |||
1123 | /* MTU will be reset when mcast join happens */ | ||
1124 | priv->dev->mtu = IPOIB_UD_MTU(priv->max_ib_mtu); | ||
1125 | priv->mcast_mtu = priv->admin_mtu = priv->dev->mtu; | ||
1126 | |||
1118 | result = ib_query_pkey(hca, port, 0, &priv->pkey); | 1127 | result = ib_query_pkey(hca, port, 0, &priv->pkey); |
1119 | if (result) { | 1128 | if (result) { |
1120 | printk(KERN_WARNING "%s: ib_query_pkey port %d failed (ret = %d)\n", | 1129 | printk(KERN_WARNING "%s: ib_query_pkey port %d failed (ret = %d)\n", |