1. 15 7月, 2008 2 次提交
    • R
      RDMA/nes: Encapsulate logic nes_put_cqp_request() · 1ff66e8c
      Roland Dreier 提交于
      The iw_nes driver repeats the logic
      
      	if (atomic_dec_and_test(&cqp_request->refcount)) {
      		if (cqp_request->dynamic) {
      			kfree(cqp_request);
      		} else {
      			spin_lock_irqsave(&nesdev->cqp.lock, flags);
      			list_add_tail(&cqp_request->list, &nesdev->cqp_avail_reqs);
      			spin_unlock_irqrestore(&nesdev->cqp.lock, flags);
      		}
      	}
      
      over and over.  Wrap this up in functions nes_free_cqp_request() and
      nes_put_cqp_request() to simplify such code.
      
      In addition to making the source smaller and more readable, this shrinks
      the compiled code quite a bit:
      
      add/remove: 2/0 grow/shrink: 0/13 up/down: 164/-1692 (-1528)
      function                                     old     new   delta
      nes_free_cqp_request                           -     147    +147
      nes_put_cqp_request                            -      17     +17
      nes_modify_qp                               2316    2293     -23
      nes_hw_modify_qp                             737     657     -80
      nes_dereg_mr                                 945     860     -85
      flush_wqes                                   501     416     -85
      nes_manage_apbvt                             648     560     -88
      nes_reg_mr                                  1117    1026     -91
      nes_cqp_ce_handler                           927     769    -158
      nes_alloc_mw                                1052     884    -168
      nes_create_qp                               5314    5141    -173
      nes_alloc_fmr                               2212    2035    -177
      nes_destroy_cq                              1097     918    -179
      nes_create_cq                               2787    2598    -189
      nes_dealloc_mw                               762     566    -196
      Signed-off-by: NRoland Dreier <rolandd@cisco.com>
      Acked-by: NFaisal Latif <flatif@neteffect.com>
      1ff66e8c
    • C
      RDMA/nes: Remove unnecessary memset() · 929555a2
      Christophe Jaillet 提交于
      Remove an explicit memset(..., 0, ...) of a 'listener' structure
      allocated with kzalloc().
      Signed-off-by: NChristophe Jaillet <christophe.jaillet@wanadoo.fr>
      Acked-by: NFaisal Latif <faisal@neteffect.com>
      Signed-off-by: NRoland Dreier <rolandd@cisco.com>
      929555a2
  2. 11 6月, 2008 1 次提交
    • R
      RDMA/nes: Fix off-by-one in nes_reg_user_mr() error path · 24797a34
      Roland Dreier 提交于
      nes_reg_user_mr() should fail if page_count becomes >= 1024 * 512
      rather than just testing for strict >, because page_count is
      essentially used as an index into an array with 1024 * 512 entries, so
      allowing the loop to continue with page_count == 1024 * 512 means that
      memory after the end of the array is corrupted.  This leads to a crash
      triggerable by a userspace application that requests registration of a
      too-big region.
      
      Also get rid of the call to pci_free_consistent() here to avoid
      corrupting state with a double free, since the same memory will be
      freed in the code jumped to at reg_user_mr_err.
      Signed-off-by: NRoland Dreier <rolandd@cisco.com>
      24797a34
  3. 14 5月, 2008 1 次提交
    • R
      RDMA/nes: Fix up nes_lro_max_aggr module parameter · dd37818d
      Roland Dreier 提交于
      Fix some bugs with the max_aggr module parameter added with LRO support:
      
       - The module parameter value ignored and not actually used to set
         lro_mgr.max_aggr.
       - MODULE_PARM_DESC had a typo "_mro_" instead of "_lro_" so it didn't
         end up describing the actual module parameter.
       - The nes_lro_max_aggr variable was declared as unsigned, but the
         module_param line said "int" instead of "uint" for the type.
       - The default value for the parameter was stuck in the permissions
         field of module_param, which led to nonsensical permissions for the
         file under /sys/module/iw_nes/param.
       - The parameter was used in only one file but defined in another, which
         led to the variable being global for no good reason.  Move everything
         related to the parameter to the file nes_hw.c where it is actually
         used.
      Signed-off-by: NRoland Dreier <rolandd@cisco.com>
      dd37818d
  4. 30 4月, 2008 3 次提交
  5. 29 4月, 2008 1 次提交
    • A
      IB: expand ib_umem_get() prototype · cb9fbc5c
      Arthur Kepner 提交于
      Add a new parameter, dmasync, to the ib_umem_get() prototype.  Use dmasync = 1
      when mapping user-allocated CQs with ib_umem_get().
      Signed-off-by: NArthur Kepner <akepner@sgi.com>
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
      Cc: Jes Sorensen <jes@sgi.com>
      Cc: Randy Dunlap <randy.dunlap@oracle.com>
      Cc: Roland Dreier <rdreier@cisco.com>
      Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
      Cc: David Miller <davem@davemloft.net>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Grant Grundler <grundler@parisc-linux.org>
      Cc: Michael Ellerman <michael@ellerman.id.au>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      cb9fbc5c
  6. 24 4月, 2008 4 次提交
    • R
      RDMA/nes: Remove volatile qualifier from struct nes_hw_cq.cq_vbase · 31d1e340
      Roland Dreier 提交于
      Remove the volatile qualifier from the cq_vbase member of struct
      nes_hw_cq, and add an rmb() in the one place where it looks like
      access order might make a difference.  As usual, removing a volatile
      qualifier in a declaration is actually a bug fix, since a volatile
      qualifier is not sufficient to make sure that aggressively
      out-of-order CPUs don't reorder things and cause incorrect results.
      
      For example, a CPU might speculatively execute reads of other cqe
      fields before the NIC hardware has written those fields and before it
      has set the NES_CQE_VALID bit (even though those reads come after the
      test of the NES_CQE_VALID bit in program order), but then when the CPU
      actually executes the conditional test of the NES_CQE_VALID, the bit
      has been set, and the CPU will proceed with the results of the earlier
      speculative execution and end up using bogus data.
      
      This also gets rid of the warning:
      
          drivers/infiniband/hw/nes/nes_verbs.c: In function 'nes_destroy_cq':
          drivers/infiniband/hw/nes/nes_verbs.c:1978: warning: passing argument 3 of 'pci_free_consistent' discards qualifiers from pointer target type
      Signed-off-by: NRoland Dreier <rolandd@cisco.com>
      31d1e340
    • C
      RDMA/nes: Fix adapter reset after PXE boot · bc5698f3
      Chien Tung 提交于
      After PXE boot, the iw_nes driver does a full reset to ensure the card
      is in a clean state.  However, it doesn't wait for firmware to
      complete its work before issuing a port reset to enable the ports,
      which leads to problems bringing up the ports.
      
      The solution is to wait for firmware to complete its work before
      proceeding with port reset.
      
      This bug was flagged by Roland Dreier <rolandd@cisco.com>.
      
      Cc: <stable@kernel.org>
      Signed-off-by: NChien Tung <ctung@neteffect.com>
      Signed-off-by: NRoland Dreier <rolandd@cisco.com>
      bc5698f3
    • R
      RDMA/nes: Print IPv4 addresses in a readable format · e4477031
      Roland Dreier 提交于
      Use NIPQUAD_FMT instead of printing raw 32-bit hex quantities in
      debugging output.
      Acked-by: NGlenn Streiff <gstreiff@neteffect.com>
      Signed-off-by: NRoland Dreier <rolandd@cisco.com>
      e4477031
    • R
      RDMA/nes: Use print_mac() to format ethernet addresses for printing · 2bd01c5d
      Roland Dreier 提交于
      Removing open-coded MAC formats shrinks the source and the generated
      code too, eg on x86-64:
      
      add/remove: 0/0 grow/shrink: 0/4 up/down: 0/-103 (-103)
      function                                     old     new   delta
      make_cm_node                                 932     912     -20
      nes_netdev_set_mac_address                   427     406     -21
      nes_netdev_set_multicast_list               1148    1124     -24
      nes_probe                                   2349    2311     -38
      Acked-by: NGlenn Streiff <gstreiff@neteffect.com>
      Signed-off-by: NRoland Dreier <rolandd@cisco.com>
      2bd01c5d
  7. 22 4月, 2008 1 次提交
  8. 20 4月, 2008 1 次提交
  9. 19 4月, 2008 1 次提交
  10. 17 4月, 2008 12 次提交
  11. 22 3月, 2008 1 次提交
  12. 27 2月, 2008 6 次提交
  13. 26 2月, 2008 2 次提交
  14. 19 2月, 2008 1 次提交
    • R
      RDMA/nes: Fix possible array overrun · 51af33e8
      Roland Dreier 提交于
      In nes_create_qp(), the test
      
      	if (nesqp->mmap_sq_db_index > NES_MAX_USER_WQ_REGIONS) {
      
      is used to error out if the db_index is too large; however, if the
      test doesn't trigger, then the index is used as
      
      	nes_ucontext->mmap_nesqp[nesqp->mmap_sq_db_index] = nesqp;
      
      and mmap_nesqp is declared as
      
      	struct nes_qp      *mmap_nesqp[NES_MAX_USER_WQ_REGIONS];
      
      which leads to an array overrun if the index is exactly equal to
      NES_MAX_USER_WQ_REGIONS.  Fix this by bailing out if the index is
      greater than or equal to NES_MAX_USER_WQ_REGIONS.
      
      This was spotted by the Coverity checker (CID 2162).
      Acked-by: NGlenn Streiff <gstreiff@neteffect.com>
      Signed-off-by: NRoland Dreier <rolandd@cisco.com>
      51af33e8
  15. 17 2月, 2008 1 次提交
  16. 16 2月, 2008 1 次提交
  17. 05 2月, 2008 1 次提交