10 Nov, 2014

1 commit

  • bnx2fc_queuecommand(): when allocating a new io_req, the tgt_lock
    spinlock must be locked before calling bnx2fc_cmd_alloc().

    The spinlock should also be kept locked until bnx2fc_post_io_req() has
    been completed.
    If not, a kernel thread may call bnx2fc_process_cq_compl() that extracts
    the newly allocated io_req from hba->cmd_mgr->cmds and destroys it while
    it is still being used by bnx2fc_post_io_req().

    BUG: unable to handle kernel NULL pointer dereference at 000000000000004c
    IP: [] bnx2fc_init_task+0x6a/0x230 [bnx2fc]
    PGD 0
    Oops: 0000 [#1] SMP
    last sysfs file: /sys/devices/pci0000:00/0000:00:02.0/0000:04:00.3/net/eth3/type
    CPU 33
    Modules linked in: autofs4 target_core_iblock target_core_file target_core_pscsi target_core_mod configfs bnx2fc cnic uio fcoe libfcoe libfc scsi_transport_fc 8021q garp scsi_tgt stp llc cpufreq_ondemand freq_table pcc_cpufreq ipt_REJECT nf_conntrack_ipv4 nf_defrag_ipv4 iptable_filter ip_tables ip6t_REJECT nf_conntrack_ipv6 nf_defrag_ipv6 xt_state nf_conntrack ip6table_filter ip6_tables ipv6 power_meter microcode iTCO_wdt iTCO_vendor_support hpilo hpwdt sg bnx2x libcrc32c mdio serio_raw lpc_ich mfd_core shpchp ext4 jbd2 mbcache sd_mod crc_t10dif hpsa video output dm_mirror dm_region_hash dm_log dm_mod [last unloaded: scsi_wait_scan]

    Pid: 7355, comm: bnx2fc_thread/3 Not tainted 2.6.32-431.el6.x86_64 #1 HP ProLiant BL460c Gen8
    RIP: 0010:[] [] bnx2fc_init_task+0x6a/0x230 [bnx2fc]
    RSP: 0018:ffff8820b0da3b68 EFLAGS: 00010246
    RAX: 0000000000000000 RBX: ffff882003801080 RCX: 0000000000000000
    RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffff882003801100
    RBP: ffff8820b0da3bc8 R08: ffffffff8160d4e8 R09: 0000000000000040
    R10: 0000000000000000 R11: 0000000000000000 R12: ffff88400e600e00
    R13: ffff8840108fbe40 R14: ffff88200ffe5400 R15: 0000000000000000
    FS: 0000000000000000(0000) GS:ffff8820b0da0000(0000) knlGS:0000000000000000
    CS: 0010 DS: 0018 ES: 0018 CR0: 000000008005003b
    CR2: 000000000000004c CR3: 0000002010b67000 CR4: 00000000001407e0
    DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
    DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
    Process bnx2fc_thread/3 (pid: 7355, threadinfo ffff88401f940000, task ffff884012f5f540)
    Stack:
    ffff8820b0da3bc8 ffffffff81527303 ffff884000000020 ffff8820b0da3bd8
    ffff8820b0da3b98 000000028138931a ffff88400f506078 ffff88400e600e00
    ffff88200ffe5400 ffff88200ffe5590 0000000000000021 0000000000000002
    Call Trace:

    [] ? printk+0x41/0x46
    [] bnx2fc_post_io_req+0x11c/0x440 [bnx2fc]
    [] ? cpumask_next_and+0x29/0x50
    [] ? scsi_done+0x0/0x60
    [] bnx2fc_queuecommand+0x117/0x140 [bnx2fc]
    [] scsi_dispatch_cmd+0xe5/0x310
    [] scsi_request_fn+0x5ee/0x7a0
    [] __blk_run_queue+0x31/0x40
    [] blk_run_queue+0x30/0x50
    [] scsi_run_queue+0xc6/0x270
    [] ? elv_requeue_request+0x52/0xa0
    [] scsi_requeue_command+0x90/0xb0
    [] scsi_io_completion+0x154/0x6c0
    [] scsi_finish_command+0xc2/0x130
    [] scsi_softirq_done+0x145/0x170
    [] blk_done_softirq+0x85/0xa0
    [] __do_softirq+0xc1/0x1e0
    [] ? call_softirq+0x1c/0x30
    [] call_softirq+0x1c/0x30

    [] ? do_softirq+0x65/0xa0
    [] local_bh_enable_ip+0x9a/0xb0
    [] _spin_unlock_bh+0x1b/0x20
    [] bnx2fc_process_cq_compl+0x257/0x2b0 [bnx2fc]
    [] bnx2fc_percpu_io_thread+0xea/0x160 [bnx2fc]
    [] ? bnx2fc_percpu_io_thread+0x0/0x160 [bnx2fc]
    [] kthread+0x96/0xa0
    [] child_rip+0xa/0x20
    [] ? kthread+0x0/0xa0
    [] ? child_rip+0x0/0x20
    Code: 89 df 45 8b 7e 30 0f 85 75 01 00 00 89 d1 31 c0 c1 e9 03 83 e2 04 89 c9 f3 48 ab 74 06 c7 07 00 00 00 00 49 89 9c 24 88 01 00 00 7e 4c 01 b8 01 00 00 00 0f 84 e7 00 00 00 89 c2 0a 53 38 41
    RIP [] bnx2fc_init_task+0x6a/0x230 [bnx2fc]
    RSP
    CR2: 000000000000004c

    Signed-off-by: Maurizio Lombardi
    Acked-by: Chad Dupuis
    Signed-off-by: Christoph Hellwig

    Maurizio Lombardi
     

17 Sep, 2014

1 commit


26 Jul, 2014

1 commit

  • QLogic has acquired the NetXtremeII products and drivers from Broadcom.
    This patch re-brands bnx2fc driver as a QLogic driver

    Signed-off-by: Saurav Kashyap
    Signed-off-by: Vikas Chaudhary
    Acked-by: Eddie Wai
    Signed-off-by: Christoph Hellwig

    Saurav Kashyap
     

18 Jul, 2014

1 commit

  • The SCSI standard defines 64-bit values for LUNs, and large arrays
    employing large or hierarchical LUN numbers become more and more
    common.

    So update the linux SCSI stack to use 64-bit LUN numbers.

    Signed-off-by: Hannes Reinecke
    Reviewed-by: Christoph Hellwig
    Reviewed-by: Ewan Milne
    Signed-off-by: Christoph Hellwig

    Hannes Reinecke
     

25 Jun, 2014

1 commit

  • In case of of error, the bnx2fc_cmd_mgr_alloc() function will call
    the bnx2fc_cmd_mgr_free() to perform the cleanup.
    The problem is that in one case the latter may try to scan
    some not-yet initialized lists, resulting in a kernel panic.

    This patch prevents this from happening by freeing the lists
    before calling bnx2fc_cmd_mgr_free().

    Signed-off-by: Maurizio Lombardi
    Acked-by: Eddie Wai
    Signed-off-by: Christoph Hellwig

    Maurizio Lombardi
     

02 Apr, 2014

1 commit

  • Pull first round of SCSI updates from James Bottomley:
    "This patch consists of the usual driver updates (megaraid_sas,
    scsi_debug, qla2xxx, qla4xxx, lpfc, bnx2fc, be2iscsi, hpsa, ipr) plus
    an assortment of minor fixes and the first precursors of SCSI-MQ (the
    code path simplifications) and the bug fix for the USB oops on remove
    (which involves an infrastructure change, so is sent via the main tree
    with a delayed backport after a cycle in which it is shown to
    introduce no new bugs)"

    * tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: (196 commits)
    [SCSI] sd: Quiesce mode sense error messages
    [SCSI] add support for per-host cmd pools
    [SCSI] simplify command allocation and freeing a bit
    [SCSI] megaraid: simplify internal command handling
    [SCSI] ses: Use vpd information from scsi_device
    [SCSI] Add EVPD page 0x83 and 0x80 to sysfs
    [SCSI] Return VPD page length in scsi_vpd_inquiry()
    [SCSI] scsi_sysfs: Implement 'is_visible' callback
    [SCSI] hpsa: update driver version to 3.4.4-1
    [SCSI] hpsa: fix bad endif placement in RAID 5 mapper code
    [SCSI] qla2xxx: Fix build errors related to invalid print fields on some architectures.
    [SCSI] bfa: Replace large udelay() with mdelay()
    [SCSI] vmw_pvscsi: Some improvements in pvscsi driver.
    [SCSI] vmw_pvscsi: Add support for I/O requests coalescing.
    [SCSI] vmw_pvscsi: Fix pvscsi_abort() function.
    [SCSI] remove deprecated IRQF_DISABLED from SCSI
    [SCSI] bfa: Updating Maintainers email ids
    [SCSI] ipr: Add new CCIN definition for Grand Canyon support
    [SCSI] ipr: Format HCAM overlay ID 0x21
    [SCSI] ipr: Use pci_enable_msi_range() and pci_enable_msix_range()
    ...

    Linus Torvalds
     

19 Mar, 2014

1 commit

  • The bnx2/bnx2x rings are made up of linked pages. However there is an
    upper limit on the page size as some the page size settings are 16-bit
    in the hardware/firmware interface. In the current code, some parts
    use BNX2_PAGE_SIZE which has a 16K upper limit and some parts use
    PAGE_SIZE. On archs with >= 64K PAGE_SIZE, it generates some compile
    warnings. Define a new CNIC_PAGE_SZIE which has an upper limit of
    16K and use it consistently in all relevant parts.

    Signed-off-by: Michael Chan
    Signed-off-by: Eddie Wai
    Signed-off-by: David S. Miller

    Michael Chan
     

16 Mar, 2014

1 commit


25 Oct, 2013

1 commit

  • In the case when a SCSI_CMD times out, bnx2fc will initiate the sending of the
    ABTS. However, if the SCSI layer's SCSI command timer also times out, it'll
    instantiate a task abort of the same xid.

    The race condition this patch tries to fix is as follows:

    SCSI_CMD timeout (20s)
    thread 1 thread 2
    send ABTS
    rx ABTS cmpl
    task abort_eh
    explicit LOGO since ABTS was engaged
    CLEANUP cmpl
    SCSI_CMD cmpl (ABTS cmpl)
    instantiate RRQ
    wait 10s
    attempt to send RRQ (because of LOGO, it wouldn't continue)

    Note that there is no call to scsi_done for this SCSI_CMD cmpletion
    in this path.

    The patch changes the path of execution to call scsi_done immediately
    instead of instantiating the RRQ.

    Signed-off-by: Eddie Wai
    Signed-off-by: James Bottomley

    Eddie Wai
     

02 May, 2013

2 commits


25 Apr, 2013

1 commit

  • The firmware supports a maximum of 4K FCoE exchanges. In 4-port devices,
    or when working in multi-function mode, this resource needs to be distributed
    between the various possible FCoE functions.

    This information needs to be calculated by bnx2x and propagated into bnx2fc
    via cnic. bnx2fc can then use this value to calculate corresponding xid
    resources instead of using global constants.

    Signed-off-by: Bhanu Prakash Gollapudi
    Signed-off-by: Michael Chan
    Signed-off-by: Yuval Mintz
    Signed-off-by: David S. Miller

    Bhanu Prakash Gollapudi
     

30 Jan, 2013

1 commit

  • Delete successive tests to the same location. The code tested the result
    of a previous allocation, that itself was already tested. It is changed to
    test the result of the most recent allocation.

    A simplified version of the semantic match that finds this problem is as
    follows: (http://coccinelle.lip6.fr/)

    //
    @s exists@
    local idexpression y;
    expression x,e;
    @@

    *if ( \(x == NULL\|IS_ERR(x)\|y != 0\) )
    { ... when forall
    return ...; }
    ... when != \(y = e\|y += e\|y -= e\|y |= e\|y &= e\|y++\|y--\|&y\)
    when != \(XT_GETPAGE(...,y)\|WMI_CMD_BUF(...)\)
    *if ( \(x == NULL\|IS_ERR(x)\|y != 0\) )
    { ... when forall
    return ...; }
    //

    Signed-off-by: Julia Lawall
    Acked-by: Bhanu Prakash Gollapudi
    Signed-off-by: James Bottomley

    Julia Lawall
     

29 Jan, 2013

1 commit

  • If the NULL test is necessary, the initialization involving a dereference of
    the tested value should be moved after the NULL test.

    The sematic patch that fixes this problem is as follows:
    (http://coccinelle.lip6.fr/)

    //
    @@
    type T;
    expression E;
    identifier i,fld;
    statement S;
    @@

    - T i = E->fld;
    + T i;
    ... when != E
    when != i
    if (E == NULL) S
    + i = E->fld;
    //

    Signed-off-by: Julia Lawall
    Signed-off-by: Bhanu Prakash Gollapudi
    Signed-off-by: James Bottomley

    Julia Lawall
     

24 Sep, 2012

1 commit

  • gcc 4.8 warns because the memset only clears sizeof(char *) bytes, not
    the whole buffer. Use the correct buffer size and clear the whole sense
    buffer.

    /backup/lsrc/git/linux-lto-2.6/drivers/scsi/bnx2fc/bnx2fc_io.c: In
    function 'bnx2fc_parse_fcp_rsp':
    /backup/lsrc/git/linux-lto-2.6/drivers/scsi/bnx2fc/bnx2fc_io.c:1810:41:
    warning: argument to 'sizeof' in 'memset' call is the same expression as
    the destination; did you mean to provide an explicit length?
    [-Wsizeof-pointer-memaccess]
    memset(sc_cmd->sense_buffer, 0, sizeof(sc_cmd->sense_buffer));
    ^

    Signed-off-by: Andi Kleen
    Acked-by: Bhanu Prakash Gollapudi
    Signed-off-by: James Bottomley

    Andi Kleen
     

20 Jul, 2012

2 commits


22 May, 2012

2 commits


26 Feb, 2012

1 commit

  • This allows us to use scsilun_to_int without an ugly cast.

    Fix up places that use scsilun_to_int on fcp->fc_lun accordingly.

    In fc target, this leaves ft_cmd.lun unused, so remove it.

    Signed-off-by: Andy Grover
    Cc: Christoph Hellwig
    Cc: Kiran Patil
    Cc: James Bottomley
    Signed-off-by: Nicholas Bellinger

    Andy Grover
     

30 Oct, 2011

1 commit

  • If the IO and the corresponding ABTS are not responded by a target, cleanup the
    IO and issue explicit logout when ulp timer expires while waiting for ABTS to
    complete. Wait for the session to be ready before returning to the SCSI layer.
    If the session is not ready let the SCSI-ml escalate the error recovery.

    Signed-off-by: Bhanu Prakash Gollapudi
    Signed-off-by: James Bottomley

    Bhanu Prakash Gollapudi
     

22 Sep, 2011

2 commits


27 Aug, 2011

2 commits


28 Jul, 2011

4 commits


27 Jul, 2011

2 commits

  • Based on PRLI response, identify if the target is FCP-2 (seq level error
    recovery) capable, and appropriately set the corresponding CONF, REC flags when
    offloading the session.

    Signed-off-by: Bhanu Prakash Gollapudi
    Signed-off-by: James Bottomley

    Bhanu Prakash Gollapudi
     
  • Currently, bnx2fc has a hba structure that can work with only a single vlan
    interface. When there is a change in vlan id, it does not have the capability
    to switch to different vlan interface. To solve this problem, a new structure
    called 'interface' has been introduced, and each hba can now have multiple
    interfaces, one per vlan id.

    Most of the patch is a moving the interface specific fields from hba to the
    interface structure, and appropriately modifying the dereferences. A list of
    interfaces (if_list) is maintained along with adapter list. During a create
    call, the interface structure is allocated and added to if_list and deleted &
    freed on a destroy call. Link events are propagated to all interfaces
    belonging to the hba.

    Signed-off-by: Bhanu Prakash Gollapudi
    Signed-off-by: James Bottomley

    Bhanu Prakash Gollapudi
     

26 Jul, 2011

1 commit


24 Jul, 2011

1 commit

  • * git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6: (77 commits)
    [SCSI] fix crash in scsi_dispatch_cmd()
    [SCSI] sr: check_events() ignore GET_EVENT when TUR says otherwise
    [SCSI] bnx2i: Fixed kernel panic due to illegal usage of sc->request->cpu
    [SCSI] bfa: Update the driver version to 3.0.2.1
    [SCSI] bfa: Driver and BSG enhancements.
    [SCSI] bfa: Added support to query PHY.
    [SCSI] bfa: Added HBA diagnostics support.
    [SCSI] bfa: Added support for flash configuration
    [SCSI] bfa: Added support to obtain SFP info.
    [SCSI] bfa: Added support for CEE info and stats query.
    [SCSI] bfa: Extend BSG interface.
    [SCSI] bfa: FCS bug fixes.
    [SCSI] bfa: DMA memory allocation enhancement.
    [SCSI] bfa: Brocade-1860 Fabric Adapter vHBA support.
    [SCSI] bfa: Brocade-1860 Fabric Adapter PLL init fixes.
    [SCSI] bfa: Added Fabric Assigned Address(FAA) support
    [SCSI] bfa: IOC bug fixes.
    [SCSI] bfa: Enable ASIC block configuration and query.
    [SCSI] bnx2i: Updated copyright and bump version
    [SCSI] bnx2i: Modified to skip CNIC registration if iSCSI is not supported
    ...

    Fix up some trivial conflicts in:
    - drivers/scsi/bnx2fc/{bnx2fc.h,bnx2fc_fcoe.c}:
    Crazy broadcom version number conflicts
    - drivers/target/tcm_fc/tfc_cmd.c
    Just trivial cleanups done on adjacent lines

    Linus Torvalds
     

29 Jun, 2011

1 commit


15 Jun, 2011

1 commit

  • New FW/HSI (7.0):
    - Added support to 578xx chips
    - Improved HSI - much less driver's direct access to the FW internal
    memory needed.

    New implementation of the HSI handling layer in the bnx2x (bnx2x_sp.c):
    - Introduced chip dependent objects that have chip independent interfaces
    for configuration of MACs, multicast addresses, Rx mode, indirection table,
    fast path queues and function initialization/cleanup.
    - Objects functionality is based on the private function pointers, which
    allows not only a per-chip but also PF/VF differentiation while still
    preserving the same interface towards the driver.
    - Objects interface is not influenced by the HSI changes which do not require
    providing new parameters keeping the code outside the bnx2x_sp.c invariant
    with regard to such HSI chnages.

    Changes in a CNIC, bnx2fc and bnx2i modules due to the new HSI.

    Signed-off-by: Vladislav Zolotarov
    Signed-off-by: Michael Chan
    Signed-off-by: Bhanu Prakash Gollapudi
    Signed-off-by: Eilon Greenstein
    Signed-off-by: David S. Miller

    Vlad Zolotarov
     

02 May, 2011

1 commit


31 Mar, 2011

1 commit


24 Mar, 2011

1 commit

  • Cleanup commands are issued to the firmware to cleanup any stuck ios
    that are supposed to be implicitly aborted. In the worst case we can
    have all scsi ios filling up the free_list and we may not be able to
    allocate cleanup tasks. So the driver has to reserve free_list entries
    to be able to allocate the cleanup tasks. This reserve free_list common
    to all cpus is allocated as one additional entry in the per cpu
    free_lists.

    In bnx2fc_cmd_alloc(), there is a related fix to use get_cpu() for the
    free_list_index. This will prevent using the wrong index if the CPU
    is preempted.

    Signed-off-by: Bhanu Prakash Gollapudi
    Signed-off-by: Nithin Nayak Sujir
    Signed-off-by: Michael Chan
    Signed-off-by: James Bottomley

    Bhanu Gollapudi
     

01 Mar, 2011

1 commit

  • This driver is for Broadcom Netxtreme II 57712 chip. The following
    patch contains the driver sources for bnx2fc driver. libfc/libfcoe
    changes to enable bnx2fc have already gone through the fcoe
    tree. bnx2fc is a SCSI low level driver that interfaces with SCSI
    midlayer, libfc, libfcoe, cnic modules. bnx2fc driver uses services
    of libfc for slow path operations such as FIP and fabric
    discovery. The fast path IO perations are performed after offloading
    the session information to the underlying FCoE firmware.

    Signed-off-by: Bhanu Prakash Gollapudi
    Reviewed-by: Mike Christie
    Signed-off-by: James Bottomley

    Bhanu Gollapudi