Skip to content

Commit

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

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/roland/infiniband:
  RDMA: Update workqueue usage
  RDMA/nes: Fix incorrect SFP+ link status detection on driver init
  RDMA/nes: Fix SFP+ link down detection issue with switch port disable
  RDMA/nes: Generate IB_EVENT_PORT_ERR/PORT_ACTIVE events
  RDMA/nes: Fix bonding on iw_nes
  IB/srp: Test only once whether iu allocation succeeded
  IB/mlx4: Handle protocol field in multicast table
  RDMA: Use vzalloc() to replace vmalloc()+memset(0)
  mlx4_{core, ib, en}: Fix driver when sizeof (phys_addr_t) > sizeof (long)
  IB/mthca: Fix driver when sizeof (phys_addr_t) > sizeof (long)
  • Loading branch information
Linus Torvalds committed Jan 17, 2011
2 parents eee2a81 + 4790f4d commit 6845a44
Show file tree
Hide file tree
Showing 38 changed files with 351 additions and 144 deletions.
4 changes: 2 additions & 2 deletions drivers/infiniband/core/cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ static void ib_cache_event(struct ib_event_handler *handler,
INIT_WORK(&work->work, ib_cache_task);
work->device = event->device;
work->port_num = event->element.port_num;
schedule_work(&work->work);
queue_work(ib_wq, &work->work);
}
}
}
Expand Down Expand Up @@ -368,7 +368,7 @@ static void ib_cache_cleanup_one(struct ib_device *device)
int p;

ib_unregister_event_handler(&device->cache.event_handler);
flush_scheduled_work();
flush_workqueue(ib_wq);

for (p = 0; p <= end_port(device) - start_port(device); ++p) {
kfree(device->cache.pkey_cache[p]);
Expand Down
11 changes: 9 additions & 2 deletions drivers/infiniband/core/device.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
#include <linux/slab.h>
#include <linux/init.h>
#include <linux/mutex.h>
#include <linux/workqueue.h>

#include "core_priv.h"

Expand All @@ -52,6 +51,9 @@ struct ib_client_data {
void * data;
};

struct workqueue_struct *ib_wq;
EXPORT_SYMBOL_GPL(ib_wq);

static LIST_HEAD(device_list);
static LIST_HEAD(client_list);

Expand Down Expand Up @@ -718,6 +720,10 @@ static int __init ib_core_init(void)
{
int ret;

ib_wq = alloc_workqueue("infiniband", 0, 0);
if (!ib_wq)
return -ENOMEM;

ret = ib_sysfs_setup();
if (ret)
printk(KERN_WARNING "Couldn't create InfiniBand device class\n");
Expand All @@ -726,6 +732,7 @@ static int __init ib_core_init(void)
if (ret) {
printk(KERN_WARNING "Couldn't set up InfiniBand P_Key/GID cache\n");
ib_sysfs_cleanup();
destroy_workqueue(ib_wq);
}

return ret;
Expand All @@ -736,7 +743,7 @@ static void __exit ib_core_cleanup(void)
ib_cache_cleanup();
ib_sysfs_cleanup();
/* Make sure that any pending umem accounting work is done. */
flush_scheduled_work();
destroy_workqueue(ib_wq);
}

module_init(ib_core_init);
Expand Down
2 changes: 1 addition & 1 deletion drivers/infiniband/core/sa_query.c
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ static void ib_sa_event(struct ib_event_handler *handler, struct ib_event *event
port->sm_ah = NULL;
spin_unlock_irqrestore(&port->ah_lock, flags);

schedule_work(&sa_dev->port[event->element.port_num -
queue_work(ib_wq, &sa_dev->port[event->element.port_num -
sa_dev->start_port].update_task);
}
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/infiniband/core/umem.c
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ void ib_umem_release(struct ib_umem *umem)
umem->mm = mm;
umem->diff = diff;

schedule_work(&umem->work);
queue_work(ib_wq, &umem->work);
return;
}
} else
Expand Down
5 changes: 2 additions & 3 deletions drivers/infiniband/hw/amso1100/c2_rnic.c
Original file line number Diff line number Diff line change
Expand Up @@ -459,13 +459,12 @@ int __devinit c2_rnic_init(struct c2_dev *c2dev)
IB_DEVICE_MEM_WINDOW);

/* Allocate the qptr_array */
c2dev->qptr_array = vmalloc(C2_MAX_CQS * sizeof(void *));
c2dev->qptr_array = vzalloc(C2_MAX_CQS * sizeof(void *));
if (!c2dev->qptr_array) {
return -ENOMEM;
}

/* Inialize the qptr_array */
memset(c2dev->qptr_array, 0, C2_MAX_CQS * sizeof(void *));
/* Initialize the qptr_array */
c2dev->qptr_array[0] = (void *) &c2dev->req_vq;
c2dev->qptr_array[1] = (void *) &c2dev->rep_vq;
c2dev->qptr_array[2] = (void *) &c2dev->aeq;
Expand Down
5 changes: 2 additions & 3 deletions drivers/infiniband/hw/ehca/ipz_pt_fn.c
Original file line number Diff line number Diff line change
Expand Up @@ -222,15 +222,14 @@ int ipz_queue_ctor(struct ehca_pd *pd, struct ipz_queue *queue,
queue->small_page = NULL;

/* allocate queue page pointers */
queue->queue_pages = kmalloc(nr_of_pages * sizeof(void *), GFP_KERNEL);
queue->queue_pages = kzalloc(nr_of_pages * sizeof(void *), GFP_KERNEL);
if (!queue->queue_pages) {
queue->queue_pages = vmalloc(nr_of_pages * sizeof(void *));
queue->queue_pages = vzalloc(nr_of_pages * sizeof(void *));
if (!queue->queue_pages) {
ehca_gen_err("Couldn't allocate queue page list");
return 0;
}
}
memset(queue->queue_pages, 0, nr_of_pages * sizeof(void *));

/* allocate actual queue pages */
if (is_small) {
Expand Down
5 changes: 2 additions & 3 deletions drivers/infiniband/hw/ipath/ipath_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -199,12 +199,11 @@ static struct ipath_devdata *ipath_alloc_devdata(struct pci_dev *pdev)
goto bail;
}

dd = vmalloc(sizeof(*dd));
dd = vzalloc(sizeof(*dd));
if (!dd) {
dd = ERR_PTR(-ENOMEM);
goto bail;
}
memset(dd, 0, sizeof(*dd));
dd->ipath_unit = -1;

spin_lock_irqsave(&ipath_devs_lock, flags);
Expand Down Expand Up @@ -756,7 +755,7 @@ static void __devexit ipath_remove_one(struct pci_dev *pdev)
*/
ipath_shutdown_device(dd);

flush_scheduled_work();
flush_workqueue(ib_wq);

if (dd->verbs_dev)
ipath_unregister_ib_device(dd->verbs_dev);
Expand Down
11 changes: 3 additions & 8 deletions drivers/infiniband/hw/ipath/ipath_file_ops.c
Original file line number Diff line number Diff line change
Expand Up @@ -1530,21 +1530,21 @@ static int init_subports(struct ipath_devdata *dd,
}

num_subports = uinfo->spu_subport_cnt;
pd->subport_uregbase = vmalloc(PAGE_SIZE * num_subports);
pd->subport_uregbase = vzalloc(PAGE_SIZE * num_subports);
if (!pd->subport_uregbase) {
ret = -ENOMEM;
goto bail;
}
/* Note: pd->port_rcvhdrq_size isn't initialized yet. */
size = ALIGN(dd->ipath_rcvhdrcnt * dd->ipath_rcvhdrentsize *
sizeof(u32), PAGE_SIZE) * num_subports;
pd->subport_rcvhdr_base = vmalloc(size);
pd->subport_rcvhdr_base = vzalloc(size);
if (!pd->subport_rcvhdr_base) {
ret = -ENOMEM;
goto bail_ureg;
}

pd->subport_rcvegrbuf = vmalloc(pd->port_rcvegrbuf_chunks *
pd->subport_rcvegrbuf = vzalloc(pd->port_rcvegrbuf_chunks *
pd->port_rcvegrbuf_size *
num_subports);
if (!pd->subport_rcvegrbuf) {
Expand All @@ -1556,11 +1556,6 @@ static int init_subports(struct ipath_devdata *dd,
pd->port_subport_id = uinfo->spu_subport_id;
pd->active_slaves = 1;
set_bit(IPATH_PORT_MASTER_UNINIT, &pd->port_flag);
memset(pd->subport_uregbase, 0, PAGE_SIZE * num_subports);
memset(pd->subport_rcvhdr_base, 0, size);
memset(pd->subport_rcvegrbuf, 0, pd->port_rcvegrbuf_chunks *
pd->port_rcvegrbuf_size *
num_subports);
goto bail;

bail_rhdr:
Expand Down
5 changes: 1 addition & 4 deletions drivers/infiniband/hw/ipath/ipath_init_chip.c
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ static void init_shadow_tids(struct ipath_devdata *dd)
struct page **pages;
dma_addr_t *addrs;

pages = vmalloc(dd->ipath_cfgports * dd->ipath_rcvtidcnt *
pages = vzalloc(dd->ipath_cfgports * dd->ipath_rcvtidcnt *
sizeof(struct page *));
if (!pages) {
ipath_dev_err(dd, "failed to allocate shadow page * "
Expand All @@ -461,9 +461,6 @@ static void init_shadow_tids(struct ipath_devdata *dd)
return;
}

memset(pages, 0, dd->ipath_cfgports * dd->ipath_rcvtidcnt *
sizeof(struct page *));

dd->ipath_pageshadow = pages;
dd->ipath_physshadow = addrs;
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/infiniband/hw/ipath/ipath_user_pages.c
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ void ipath_release_user_pages_on_close(struct page **p, size_t num_pages)
work->mm = mm;
work->num_pages = num_pages;

schedule_work(&work->work);
queue_work(ib_wq, &work->work);
return;

bail_mm:
Expand Down
12 changes: 7 additions & 5 deletions drivers/infiniband/hw/mlx4/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -623,8 +623,9 @@ static int mlx4_ib_mcg_attach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid)
struct mlx4_ib_dev *mdev = to_mdev(ibqp->device);
struct mlx4_ib_qp *mqp = to_mqp(ibqp);

err = mlx4_multicast_attach(mdev->dev, &mqp->mqp, gid->raw, !!(mqp->flags &
MLX4_IB_QP_BLOCK_MULTICAST_LOOPBACK));
err = mlx4_multicast_attach(mdev->dev, &mqp->mqp, gid->raw,
!!(mqp->flags & MLX4_IB_QP_BLOCK_MULTICAST_LOOPBACK),
MLX4_PROTOCOL_IB);
if (err)
return err;

Expand All @@ -635,7 +636,7 @@ static int mlx4_ib_mcg_attach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid)
return 0;

err_add:
mlx4_multicast_detach(mdev->dev, &mqp->mqp, gid->raw);
mlx4_multicast_detach(mdev->dev, &mqp->mqp, gid->raw, MLX4_PROTOCOL_IB);
return err;
}

Expand Down Expand Up @@ -665,7 +666,7 @@ static int mlx4_ib_mcg_detach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid)
struct mlx4_ib_gid_entry *ge;

err = mlx4_multicast_detach(mdev->dev,
&mqp->mqp, gid->raw);
&mqp->mqp, gid->raw, MLX4_PROTOCOL_IB);
if (err)
return err;

Expand Down Expand Up @@ -1005,7 +1006,8 @@ static void *mlx4_ib_add(struct mlx4_dev *dev)
if (mlx4_uar_alloc(dev, &ibdev->priv_uar))
goto err_pd;

ibdev->uar_map = ioremap(ibdev->priv_uar.pfn << PAGE_SHIFT, PAGE_SIZE);
ibdev->uar_map = ioremap((phys_addr_t) ibdev->priv_uar.pfn << PAGE_SHIFT,
PAGE_SIZE);
if (!ibdev->uar_map)
goto err_uar;
MLX4_INIT_DOORBELL_LOCK(&ibdev->uar_lock);
Expand Down
5 changes: 3 additions & 2 deletions drivers/infiniband/hw/mthca/mthca_catas.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ static void poll_catas(unsigned long dev_ptr)

void mthca_start_catas_poll(struct mthca_dev *dev)
{
unsigned long addr;
phys_addr_t addr;

init_timer(&dev->catas_err.timer);
dev->catas_err.map = NULL;
Expand All @@ -158,7 +158,8 @@ void mthca_start_catas_poll(struct mthca_dev *dev)
dev->catas_err.map = ioremap(addr, dev->catas_err.size * 4);
if (!dev->catas_err.map) {
mthca_warn(dev, "couldn't map catastrophic error region "
"at 0x%lx/0x%x\n", addr, dev->catas_err.size * 4);
"at 0x%llx/0x%x\n", (unsigned long long) addr,
dev->catas_err.size * 4);
return;
}

Expand Down
2 changes: 1 addition & 1 deletion drivers/infiniband/hw/mthca/mthca_cmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -713,7 +713,7 @@ int mthca_RUN_FW(struct mthca_dev *dev, u8 *status)

static void mthca_setup_cmd_doorbells(struct mthca_dev *dev, u64 base)
{
unsigned long addr;
phys_addr_t addr;
u16 max_off = 0;
int i;

Expand Down
2 changes: 1 addition & 1 deletion drivers/infiniband/hw/mthca/mthca_eq.c
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,7 @@ static int mthca_map_reg(struct mthca_dev *dev,
unsigned long offset, unsigned long size,
void __iomem **map)
{
unsigned long base = pci_resource_start(dev->pdev, 0);
phys_addr_t base = pci_resource_start(dev->pdev, 0);

*map = ioremap(base + offset, size);
if (!*map)
Expand Down
2 changes: 1 addition & 1 deletion drivers/infiniband/hw/mthca/mthca_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -790,7 +790,7 @@ static int mthca_setup_hca(struct mthca_dev *dev)
goto err_uar_table_free;
}

dev->kar = ioremap(dev->driver_uar.pfn << PAGE_SHIFT, PAGE_SIZE);
dev->kar = ioremap((phys_addr_t) dev->driver_uar.pfn << PAGE_SHIFT, PAGE_SIZE);
if (!dev->kar) {
mthca_err(dev, "Couldn't map kernel access region, "
"aborting.\n");
Expand Down
2 changes: 1 addition & 1 deletion drivers/infiniband/hw/mthca/mthca_mr.c
Original file line number Diff line number Diff line change
Expand Up @@ -853,7 +853,7 @@ void mthca_arbel_fmr_unmap(struct mthca_dev *dev, struct mthca_fmr *fmr)

int mthca_init_mr_table(struct mthca_dev *dev)
{
unsigned long addr;
phys_addr_t addr;
int mpts, mtts, err, i;

err = mthca_alloc_init(&dev->mr_table.mpt_alloc,
Expand Down
35 changes: 30 additions & 5 deletions drivers/infiniband/hw/nes/nes.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ static int nes_inetaddr_event(struct notifier_block *notifier,
struct nes_device *nesdev;
struct net_device *netdev;
struct nes_vnic *nesvnic;
unsigned int is_bonded;

nes_debug(NES_DBG_NETDEV, "nes_inetaddr_event: ip address %pI4, netmask %pI4.\n",
&ifa->ifa_address, &ifa->ifa_mask);
Expand All @@ -152,7 +153,8 @@ static int nes_inetaddr_event(struct notifier_block *notifier,
nesdev, nesdev->netdev[0]->name);
netdev = nesdev->netdev[0];
nesvnic = netdev_priv(netdev);
if (netdev == event_netdev) {
is_bonded = (netdev->master == event_netdev);
if ((netdev == event_netdev) || is_bonded) {
if (nesvnic->rdma_enabled == 0) {
nes_debug(NES_DBG_NETDEV, "Returning without processing event for %s since"
" RDMA is not enabled.\n",
Expand All @@ -169,7 +171,10 @@ static int nes_inetaddr_event(struct notifier_block *notifier,
nes_manage_arp_cache(netdev, netdev->dev_addr,
ntohl(nesvnic->local_ipaddr), NES_ARP_DELETE);
nesvnic->local_ipaddr = 0;
return NOTIFY_OK;
if (is_bonded)
continue;
else
return NOTIFY_OK;
break;
case NETDEV_UP:
nes_debug(NES_DBG_NETDEV, "event:UP\n");
Expand All @@ -178,15 +183,24 @@ static int nes_inetaddr_event(struct notifier_block *notifier,
nes_debug(NES_DBG_NETDEV, "Interface already has local_ipaddr\n");
return NOTIFY_OK;
}
/* fall through */
case NETDEV_CHANGEADDR:
/* Add the address to the IP table */
nesvnic->local_ipaddr = ifa->ifa_address;
if (netdev->master)
nesvnic->local_ipaddr =
((struct in_device *)netdev->master->ip_ptr)->ifa_list->ifa_address;
else
nesvnic->local_ipaddr = ifa->ifa_address;

nes_write_indexed(nesdev,
NES_IDX_DST_IP_ADDR+(0x10*PCI_FUNC(nesdev->pcidev->devfn)),
ntohl(ifa->ifa_address));
ntohl(nesvnic->local_ipaddr));
nes_manage_arp_cache(netdev, netdev->dev_addr,
ntohl(nesvnic->local_ipaddr), NES_ARP_ADD);
return NOTIFY_OK;
if (is_bonded)
continue;
else
return NOTIFY_OK;
break;
default:
break;
Expand Down Expand Up @@ -660,6 +674,8 @@ static int __devinit nes_probe(struct pci_dev *pcidev, const struct pci_device_i
}
nes_notifiers_registered++;

INIT_DELAYED_WORK(&nesdev->work, nes_recheck_link_status);

/* Initialize network devices */
if ((netdev = nes_netdev_init(nesdev, mmio_regs)) == NULL)
goto bail7;
Expand Down Expand Up @@ -742,6 +758,7 @@ static void __devexit nes_remove(struct pci_dev *pcidev)
struct nes_device *nesdev = pci_get_drvdata(pcidev);
struct net_device *netdev;
int netdev_index = 0;
unsigned long flags;

if (nesdev->netdev_count) {
netdev = nesdev->netdev[netdev_index];
Expand All @@ -768,6 +785,14 @@ static void __devexit nes_remove(struct pci_dev *pcidev)
free_irq(pcidev->irq, nesdev);
tasklet_kill(&nesdev->dpc_tasklet);

spin_lock_irqsave(&nesdev->nesadapter->phy_lock, flags);
if (nesdev->link_recheck) {
spin_unlock_irqrestore(&nesdev->nesadapter->phy_lock, flags);
cancel_delayed_work_sync(&nesdev->work);
} else {
spin_unlock_irqrestore(&nesdev->nesadapter->phy_lock, flags);
}

/* Deallocate the Adapter Structure */
nes_destroy_adapter(nesdev->nesadapter);

Expand Down
Loading

0 comments on commit 6845a44

Please sign in to comment.