Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 116843
b: refs/heads/master
c: 5280517
h: refs/heads/master
i:
  116841: cccbedf
  116839: ff83631
v: v3
  • Loading branch information
Roland Dreier committed Oct 14, 2008
1 parent 1fe4707 commit d89b964
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 65 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 83bb63f62bda28be88b21216fbb59838a10f2348
refs/heads/master: 528051746b24dd214883db11bcbb0e667f60447d
14 changes: 5 additions & 9 deletions trunk/drivers/infiniband/core/mad.c
Original file line number Diff line number Diff line change
Expand Up @@ -406,19 +406,15 @@ static int register_snoop_agent(struct ib_mad_qp_info *qp_info,

if (i == qp_info->snoop_table_size) {
/* Grow table. */
new_snoop_table = kmalloc(sizeof mad_snoop_priv *
qp_info->snoop_table_size + 1,
GFP_ATOMIC);
new_snoop_table = krealloc(qp_info->snoop_table,
sizeof mad_snoop_priv *
(qp_info->snoop_table_size + 1),
GFP_ATOMIC);
if (!new_snoop_table) {
i = -ENOMEM;
goto out;
}
if (qp_info->snoop_table) {
memcpy(new_snoop_table, qp_info->snoop_table,
sizeof mad_snoop_priv *
qp_info->snoop_table_size);
kfree(qp_info->snoop_table);
}

qp_info->snoop_table = new_snoop_table;
qp_info->snoop_table_size++;
}
Expand Down
1 change: 0 additions & 1 deletion trunk/drivers/infiniband/ulp/ipoib/ipoib.h
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,6 @@ int ipoib_pkey_dev_delay_open(struct net_device *dev);
void ipoib_drain_cq(struct net_device *dev);

void ipoib_set_ethtool_ops(struct net_device *dev);
int ipoib_set_dev_features(struct ipoib_dev_priv *priv, struct ib_device *hca);

#ifdef CONFIG_INFINIBAND_IPOIB_CM

Expand Down
9 changes: 1 addition & 8 deletions trunk/drivers/infiniband/ulp/ipoib/ipoib_ethtool.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,6 @@ static void ipoib_get_drvinfo(struct net_device *netdev,
strncpy(drvinfo->driver, "ipoib", sizeof(drvinfo->driver) - 1);
}

static u32 ipoib_get_rx_csum(struct net_device *dev)
{
struct ipoib_dev_priv *priv = netdev_priv(dev);
return test_bit(IPOIB_FLAG_CSUM, &priv->flags) &&
!test_bit(IPOIB_FLAG_ADMIN_CM, &priv->flags);
}

static int ipoib_get_coalesce(struct net_device *dev,
struct ethtool_coalesce *coal)
{
Expand Down Expand Up @@ -136,7 +129,7 @@ static void ipoib_get_ethtool_stats(struct net_device *dev,

static const struct ethtool_ops ipoib_ethtool_ops = {
.get_drvinfo = ipoib_get_drvinfo,
.get_rx_csum = ipoib_get_rx_csum,
.get_tso = ethtool_op_get_tso,
.get_coalesce = ipoib_get_coalesce,
.set_coalesce = ipoib_set_coalesce,
.get_flags = ethtool_op_get_flags,
Expand Down
7 changes: 4 additions & 3 deletions trunk/drivers/infiniband/ulp/ipoib/ipoib_ib.c
Original file line number Diff line number Diff line change
Expand Up @@ -685,6 +685,10 @@ int ipoib_ib_dev_open(struct net_device *dev)
queue_delayed_work(ipoib_workqueue, &priv->ah_reap_task,
round_jiffies_relative(HZ));

init_timer(&priv->poll_timer);
priv->poll_timer.function = ipoib_ib_tx_timer_func;
priv->poll_timer.data = (unsigned long)dev;

set_bit(IPOIB_FLAG_INITIALIZED, &priv->flags);

return 0;
Expand Down Expand Up @@ -902,9 +906,6 @@ int ipoib_ib_dev_init(struct net_device *dev, struct ib_device *ca, int port)
return -ENODEV;
}

setup_timer(&priv->poll_timer, ipoib_ib_tx_timer_func,
(unsigned long) dev);

if (dev->flags & IFF_UP) {
if (ipoib_ib_dev_open(dev)) {
ipoib_transport_dev_cleanup(dev);
Expand Down
67 changes: 28 additions & 39 deletions trunk/drivers/infiniband/ulp/ipoib/ipoib_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1173,48 +1173,11 @@ int ipoib_add_pkey_attr(struct net_device *dev)
return device_create_file(&dev->dev, &dev_attr_pkey);
}

int ipoib_set_dev_features(struct ipoib_dev_priv *priv, struct ib_device *hca)
{
struct ib_device_attr *device_attr;
int result = -ENOMEM;

device_attr = kmalloc(sizeof *device_attr, GFP_KERNEL);
if (!device_attr) {
printk(KERN_WARNING "%s: allocation of %zu bytes failed\n",
hca->name, sizeof *device_attr);
return result;
}

result = ib_query_device(hca, device_attr);
if (result) {
printk(KERN_WARNING "%s: ib_query_device failed (ret = %d)\n",
hca->name, result);
kfree(device_attr);
return result;
}
priv->hca_caps = device_attr->device_cap_flags;

kfree(device_attr);

if (priv->hca_caps & IB_DEVICE_UD_IP_CSUM) {
set_bit(IPOIB_FLAG_CSUM, &priv->flags);
priv->dev->features |= NETIF_F_SG | NETIF_F_IP_CSUM;
}

if (lro)
priv->dev->features |= NETIF_F_LRO;

if (priv->dev->features & NETIF_F_SG && priv->hca_caps & IB_DEVICE_UD_TSO)
priv->dev->features |= NETIF_F_TSO;

return 0;
}


static struct net_device *ipoib_add_port(const char *format,
struct ib_device *hca, u8 port)
{
struct ipoib_dev_priv *priv;
struct ib_device_attr *device_attr;
struct ib_port_attr attr;
int result = -ENOMEM;

Expand Down Expand Up @@ -1243,8 +1206,31 @@ static struct net_device *ipoib_add_port(const char *format,
goto device_init_failed;
}

if (ipoib_set_dev_features(priv, hca))
device_attr = kmalloc(sizeof *device_attr, GFP_KERNEL);
if (!device_attr) {
printk(KERN_WARNING "%s: allocation of %zu bytes failed\n",
hca->name, sizeof *device_attr);
goto device_init_failed;
}

result = ib_query_device(hca, device_attr);
if (result) {
printk(KERN_WARNING "%s: ib_query_device failed (ret = %d)\n",
hca->name, result);
kfree(device_attr);
goto device_init_failed;
}
priv->hca_caps = device_attr->device_cap_flags;

kfree(device_attr);

if (priv->hca_caps & IB_DEVICE_UD_IP_CSUM) {
set_bit(IPOIB_FLAG_CSUM, &priv->flags);
priv->dev->features |= NETIF_F_SG | NETIF_F_IP_CSUM;
}

if (lro)
priv->dev->features |= NETIF_F_LRO;

/*
* Set the full membership bit, so that we join the right
Expand Down Expand Up @@ -1280,6 +1266,9 @@ static struct net_device *ipoib_add_port(const char *format,
goto event_failed;
}

if (priv->dev->features & NETIF_F_SG && priv->hca_caps & IB_DEVICE_UD_TSO)
priv->dev->features |= NETIF_F_TSO;

result = register_netdev(priv->dev);
if (result) {
printk(KERN_WARNING "%s: couldn't register ipoib port %d; error %d\n",
Expand Down
4 changes: 0 additions & 4 deletions trunk/drivers/infiniband/ulp/ipoib/ipoib_vlan.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,6 @@ int ipoib_vlan_add(struct net_device *pdev, unsigned short pkey)
priv->mcast_mtu = priv->admin_mtu = priv->dev->mtu;
set_bit(IPOIB_FLAG_SUBINTERFACE, &priv->flags);

result = ipoib_set_dev_features(priv, ppriv->ca);
if (result)
goto device_init_failed;

priv->pkey = pkey;

memcpy(priv->dev->dev_addr, ppriv->dev->dev_addr, INFINIBAND_ALEN);
Expand Down

0 comments on commit d89b964

Please sign in to comment.