~ubuntu-branches/ubuntu/precise/linux-ti-omap4/precise-security

« back to all changes in this revision

Viewing changes to drivers/infiniband/hw/qib/qib_verbs.c

  • Committer: Package Import Robot
  • Author(s): Paolo Pisati, Paolo Pisati
  • Date: 2011-12-06 15:56:07 UTC
  • Revision ID: package-import@ubuntu.com-20111206155607-pcf44kv5fmhk564f
Tags: 3.2.0-1401.1
[ Paolo Pisati ]

* Rebased on top of Ubuntu-3.2.0-3.8
* Tilt-tracking @ ef2487af4bb15bdd0689631774b5a5e3a59f74e2
* Delete debian.ti-omap4/control, it shoudln't be tracked
* Fix architecture spelling (s/armel/armhf/)
* [Config] Update configs following 3.2 import
* [Config] Fix compilation: disable CODA and ARCH_OMAP3
* [Config] Fix compilation: disable Ethernet Faraday
* Update series to precise

Show diffs side-by-side

added added

removed removed

Lines of Context:
35
35
#include <rdma/ib_mad.h>
36
36
#include <rdma/ib_user_verbs.h>
37
37
#include <linux/io.h>
 
38
#include <linux/module.h>
38
39
#include <linux/utsname.h>
39
40
#include <linux/rculist.h>
40
41
#include <linux/mm.h>
 
42
#include <linux/random.h>
41
43
 
42
44
#include "qib.h"
43
45
#include "qib_common.h"
44
46
 
45
 
static unsigned int ib_qib_qp_table_size = 251;
 
47
static unsigned int ib_qib_qp_table_size = 256;
46
48
module_param_named(qp_table_size, ib_qib_qp_table_size, uint, S_IRUGO);
47
49
MODULE_PARM_DESC(qp_table_size, "QP table size");
48
50
 
659
661
                if (atomic_dec_return(&mcast->refcount) <= 1)
660
662
                        wake_up(&mcast->wait);
661
663
        } else {
662
 
                qp = qib_lookup_qpn(ibp, qp_num);
663
 
                if (!qp)
664
 
                        goto drop;
 
664
                if (rcd->lookaside_qp) {
 
665
                        if (rcd->lookaside_qpn != qp_num) {
 
666
                                if (atomic_dec_and_test(
 
667
                                        &rcd->lookaside_qp->refcount))
 
668
                                        wake_up(
 
669
                                         &rcd->lookaside_qp->wait);
 
670
                                        rcd->lookaside_qp = NULL;
 
671
                                }
 
672
                }
 
673
                if (!rcd->lookaside_qp) {
 
674
                        qp = qib_lookup_qpn(ibp, qp_num);
 
675
                        if (!qp)
 
676
                                goto drop;
 
677
                        rcd->lookaside_qp = qp;
 
678
                        rcd->lookaside_qpn = qp_num;
 
679
                } else
 
680
                        qp = rcd->lookaside_qp;
665
681
                ibp->n_unicast_rcv++;
666
682
                qib_qp_rcv(rcd, hdr, lnh == QIB_LRH_GRH, data, tlen, qp);
667
 
                /*
668
 
                 * Notify qib_destroy_qp() if it is waiting
669
 
                 * for us to finish.
670
 
                 */
671
 
                if (atomic_dec_and_test(&qp->refcount))
672
 
                        wake_up(&qp->wait);
673
683
        }
674
684
        return;
675
685
 
1974
1984
        ibp->z_excessive_buffer_overrun_errors =
1975
1985
                cntrs.excessive_buffer_overrun_errors;
1976
1986
        ibp->z_vl15_dropped = cntrs.vl15_dropped;
 
1987
        RCU_INIT_POINTER(ibp->qp0, NULL);
 
1988
        RCU_INIT_POINTER(ibp->qp1, NULL);
1977
1989
}
1978
1990
 
1979
1991
/**
1990
2002
        int ret;
1991
2003
 
1992
2004
        dev->qp_table_size = ib_qib_qp_table_size;
1993
 
        dev->qp_table = kzalloc(dev->qp_table_size * sizeof *dev->qp_table,
 
2005
        get_random_bytes(&dev->qp_rnd, sizeof(dev->qp_rnd));
 
2006
        dev->qp_table = kmalloc(dev->qp_table_size * sizeof *dev->qp_table,
1994
2007
                                GFP_KERNEL);
1995
2008
        if (!dev->qp_table) {
1996
2009
                ret = -ENOMEM;
1997
2010
                goto err_qpt;
1998
2011
        }
 
2012
        for (i = 0; i < dev->qp_table_size; i++)
 
2013
                RCU_INIT_POINTER(dev->qp_table[i], NULL);
1999
2014
 
2000
2015
        for (i = 0; i < dd->num_pports; i++)
2001
2016
                init_ibport(ppd + i);