Skip to content

Commit

Permalink
Merge branch 'for-linus' of master.kernel.org:/pub/scm/linux/kernel/g…
Browse files Browse the repository at this point in the history
…it/roland/infiniband

* 'for-linus' of master.kernel.org:/pub/scm/linux/kernel/git/roland/infiniband:
  IB/mad: Fix race between cancel and receive completion
  RDMA/amso1100: Fix && typo
  RDMA/amso1100: Fix unitialized pseudo_netdev accessed in c2_register_device
  IB/ehca: Activate scaling code by default
  IB/ehca: Use named constant for max mtu
  IB/ehca: Assure 4K alignment for firmware control blocks
  • Loading branch information
Linus Torvalds committed Nov 13, 2006
2 parents 4dd7406 + 3979869 commit 0f66c08
Show file tree
Hide file tree
Showing 13 changed files with 111 additions and 61 deletions.
2 changes: 1 addition & 1 deletion drivers/infiniband/core/mad.c
Original file line number Diff line number Diff line change
Expand Up @@ -1750,7 +1750,7 @@ ib_find_send_mad(struct ib_mad_agent_private *mad_agent_priv,
*/
(is_direct(wc->recv_buf.mad->mad_hdr.mgmt_class) ||
rcv_has_same_gid(mad_agent_priv, wr, wc)))
return wr;
return (wr->status == IB_WC_SUCCESS) ? wr : NULL;
}

/*
Expand Down
3 changes: 2 additions & 1 deletion drivers/infiniband/hw/amso1100/c2.c
Original file line number Diff line number Diff line change
Expand Up @@ -1155,7 +1155,8 @@ static int __devinit c2_probe(struct pci_dev *pcidev,
goto bail10;
}

c2_register_device(c2dev);
if (c2_register_device(c2dev))
goto bail10;

return 0;

Expand Down
39 changes: 20 additions & 19 deletions drivers/infiniband/hw/amso1100/c2_provider.c
Original file line number Diff line number Diff line change
Expand Up @@ -757,20 +757,17 @@ static struct net_device *c2_pseudo_netdev_init(struct c2_dev *c2dev)

int c2_register_device(struct c2_dev *dev)
{
int ret;
int ret = -ENOMEM;
int i;

/* Register pseudo network device */
dev->pseudo_netdev = c2_pseudo_netdev_init(dev);
if (dev->pseudo_netdev) {
ret = register_netdev(dev->pseudo_netdev);
if (ret) {
printk(KERN_ERR PFX
"Unable to register netdev, ret = %d\n", ret);
free_netdev(dev->pseudo_netdev);
return ret;
}
}
if (!dev->pseudo_netdev)
goto out3;

ret = register_netdev(dev->pseudo_netdev);
if (ret)
goto out2;

pr_debug("%s:%u\n", __FUNCTION__, __LINE__);
strlcpy(dev->ibdev.name, "amso%d", IB_DEVICE_NAME_MAX);
Expand Down Expand Up @@ -848,21 +845,25 @@ int c2_register_device(struct c2_dev *dev)

ret = ib_register_device(&dev->ibdev);
if (ret)
return ret;
goto out1;

for (i = 0; i < ARRAY_SIZE(c2_class_attributes); ++i) {
ret = class_device_create_file(&dev->ibdev.class_dev,
c2_class_attributes[i]);
if (ret) {
unregister_netdev(dev->pseudo_netdev);
free_netdev(dev->pseudo_netdev);
ib_unregister_device(&dev->ibdev);
return ret;
}
if (ret)
goto out0;
}
goto out3;

pr_debug("%s:%u\n", __FUNCTION__, __LINE__);
return 0;
out0:
ib_unregister_device(&dev->ibdev);
out1:
unregister_netdev(dev->pseudo_netdev);
out2:
free_netdev(dev->pseudo_netdev);
out3:
pr_debug("%s:%u ret=%d\n", __FUNCTION__, __LINE__, ret);
return ret;
}

void c2_unregister_device(struct c2_dev *dev)
Expand Down
4 changes: 2 additions & 2 deletions drivers/infiniband/hw/amso1100/c2_rnic.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,8 @@ static int c2_rnic_query(struct c2_dev *c2dev, struct ib_device_attr *props)

props->fw_ver =
((u64)be32_to_cpu(reply->fw_ver_major) << 32) |
((be32_to_cpu(reply->fw_ver_minor) && 0xFFFF) << 16) |
(be32_to_cpu(reply->fw_ver_patch) && 0xFFFF);
((be32_to_cpu(reply->fw_ver_minor) & 0xFFFF) << 16) |
(be32_to_cpu(reply->fw_ver_patch) & 0xFFFF);
memcpy(&props->sys_image_guid, c2dev->netdev->dev_addr, 6);
props->max_mr_size = 0xFFFFFFFF;
props->page_size_cap = ~(C2_MIN_PAGESIZE-1);
Expand Down
1 change: 1 addition & 0 deletions drivers/infiniband/hw/ehca/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ config INFINIBAND_EHCA
config INFINIBAND_EHCA_SCALING
bool "Scaling support (EXPERIMENTAL)"
depends on IBMEBUS && INFINIBAND_EHCA && HOTPLUG_CPU && EXPERIMENTAL
default y
---help---
eHCA scaling support schedules the CQ callbacks to different CPUs.

Expand Down
5 changes: 2 additions & 3 deletions drivers/infiniband/hw/ehca/ehca_av.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,7 @@ struct ib_ah *ehca_create_ah(struct ib_pd *pd, struct ib_ah_attr *ah_attr)
}
memcpy(&av->av.grh.word_1, &gid, sizeof(gid));
}
/* for the time being we use a hard coded PMTU of 2048 Bytes */
av->av.pmtu = 4;
av->av.pmtu = EHCA_MAX_MTU;

/* dgid comes in grh.word_3 */
memcpy(&av->av.grh.word_3, &ah_attr->grh.dgid,
Expand Down Expand Up @@ -193,7 +192,7 @@ int ehca_modify_ah(struct ib_ah *ah, struct ib_ah_attr *ah_attr)
memcpy(&new_ehca_av.grh.word_1, &gid, sizeof(gid));
}

new_ehca_av.pmtu = 4; /* see also comment in create_ah() */
new_ehca_av.pmtu = EHCA_MAX_MTU;

memcpy(&new_ehca_av.grh.word_3, &ah_attr->grh.dgid,
sizeof(ah_attr->grh.dgid));
Expand Down
17 changes: 9 additions & 8 deletions drivers/infiniband/hw/ehca/ehca_hca.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
*/

#include "ehca_tools.h"
#include "ehca_iverbs.h"
#include "hcp_if.h"

int ehca_query_device(struct ib_device *ibdev, struct ib_device_attr *props)
Expand All @@ -49,7 +50,7 @@ int ehca_query_device(struct ib_device *ibdev, struct ib_device_attr *props)
ib_device);
struct hipz_query_hca *rblock;

rblock = kzalloc(H_CB_ALIGNMENT, GFP_KERNEL);
rblock = ehca_alloc_fw_ctrlblock();
if (!rblock) {
ehca_err(&shca->ib_device, "Can't allocate rblock memory.");
return -ENOMEM;
Expand Down Expand Up @@ -96,7 +97,7 @@ int ehca_query_device(struct ib_device *ibdev, struct ib_device_attr *props)
= min_t(int, rblock->max_total_mcast_qp_attach, INT_MAX);

query_device1:
kfree(rblock);
ehca_free_fw_ctrlblock(rblock);

return ret;
}
Expand All @@ -109,7 +110,7 @@ int ehca_query_port(struct ib_device *ibdev,
ib_device);
struct hipz_query_port *rblock;

rblock = kzalloc(H_CB_ALIGNMENT, GFP_KERNEL);
rblock = ehca_alloc_fw_ctrlblock();
if (!rblock) {
ehca_err(&shca->ib_device, "Can't allocate rblock memory.");
return -ENOMEM;
Expand Down Expand Up @@ -162,7 +163,7 @@ int ehca_query_port(struct ib_device *ibdev,
props->active_speed = 0x1;

query_port1:
kfree(rblock);
ehca_free_fw_ctrlblock(rblock);

return ret;
}
Expand All @@ -178,7 +179,7 @@ int ehca_query_pkey(struct ib_device *ibdev, u8 port, u16 index, u16 *pkey)
return -EINVAL;
}

rblock = kzalloc(H_CB_ALIGNMENT, GFP_KERNEL);
rblock = ehca_alloc_fw_ctrlblock();
if (!rblock) {
ehca_err(&shca->ib_device, "Can't allocate rblock memory.");
return -ENOMEM;
Expand All @@ -193,7 +194,7 @@ int ehca_query_pkey(struct ib_device *ibdev, u8 port, u16 index, u16 *pkey)
memcpy(pkey, &rblock->pkey_entries + index, sizeof(u16));

query_pkey1:
kfree(rblock);
ehca_free_fw_ctrlblock(rblock);

return ret;
}
Expand All @@ -211,7 +212,7 @@ int ehca_query_gid(struct ib_device *ibdev, u8 port,
return -EINVAL;
}

rblock = kzalloc(H_CB_ALIGNMENT, GFP_KERNEL);
rblock = ehca_alloc_fw_ctrlblock();
if (!rblock) {
ehca_err(&shca->ib_device, "Can't allocate rblock memory.");
return -ENOMEM;
Expand All @@ -227,7 +228,7 @@ int ehca_query_gid(struct ib_device *ibdev, u8 port,
memcpy(&gid->raw[8], &rblock->guid_entries[index], sizeof(u64));

query_gid1:
kfree(rblock);
ehca_free_fw_ctrlblock(rblock);

return ret;
}
Expand Down
17 changes: 8 additions & 9 deletions drivers/infiniband/hw/ehca/ehca_irq.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
#include "ehca_tools.h"
#include "hcp_if.h"
#include "hipz_fns.h"
#include "ipz_pt_fn.h"

#define EQE_COMPLETION_EVENT EHCA_BMASK_IBM(1,1)
#define EQE_CQ_QP_NUMBER EHCA_BMASK_IBM(8,31)
Expand Down Expand Up @@ -137,38 +138,36 @@ int ehca_error_data(struct ehca_shca *shca, void *data,
u64 *rblock;
unsigned long block_count;

rblock = kzalloc(H_CB_ALIGNMENT, GFP_KERNEL);
rblock = ehca_alloc_fw_ctrlblock();
if (!rblock) {
ehca_err(&shca->ib_device, "Cannot allocate rblock memory.");
ret = -ENOMEM;
goto error_data1;
}

/* rblock must be 4K aligned and should be 4K large */
ret = hipz_h_error_data(shca->ipz_hca_handle,
resource,
rblock,
&block_count);

if (ret == H_R_STATE) {
if (ret == H_R_STATE)
ehca_err(&shca->ib_device,
"No error data is available: %lx.", resource);
}
else if (ret == H_SUCCESS) {
int length;

length = EHCA_BMASK_GET(ERROR_DATA_LENGTH, rblock[0]);

if (length > PAGE_SIZE)
length = PAGE_SIZE;
if (length > EHCA_PAGESIZE)
length = EHCA_PAGESIZE;

print_error_data(shca, data, rblock, length);
}
else {
} else
ehca_err(&shca->ib_device,
"Error data could not be fetched: %lx", resource);
}

kfree(rblock);
ehca_free_fw_ctrlblock(rblock);

error_data1:
return ret;
Expand Down
8 changes: 8 additions & 0 deletions drivers/infiniband/hw/ehca/ehca_iverbs.h
Original file line number Diff line number Diff line change
Expand Up @@ -179,4 +179,12 @@ int ehca_mmap_register(u64 physical,void **mapped,

int ehca_munmap(unsigned long addr, size_t len);

#ifdef CONFIG_PPC_64K_PAGES
void *ehca_alloc_fw_ctrlblock(void);
void ehca_free_fw_ctrlblock(void *ptr);
#else
#define ehca_alloc_fw_ctrlblock() ((void *) get_zeroed_page(GFP_KERNEL))
#define ehca_free_fw_ctrlblock(ptr) free_page((unsigned long)(ptr))
#endif

#endif
Loading

0 comments on commit 0f66c08

Please sign in to comment.