History log of /linux-master/drivers/scsi/bnx2i/bnx2i_hwi.c
Revision Date Author Comments
# 5bd85625 07-Apr-2022 Mike Christie <michael.christie@oracle.com>

scsi: iscsi: Merge suspend fields

Move the tx and rx suspend fields into one flags field.

Link: https://lore.kernel.org/r/20220408001314.5014-8-michael.christie@oracle.com
Tested-by: Manish Rangankar <mrangankar@marvell.com>
Reviewed-by: Lee Duncan <lduncan@suse.com>
Reviewed-by: Chris Leech <cleech@redhat.com>
Signed-off-by: Mike Christie <michael.christie@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>


# a6b758b0 19-Mar-2022 Colin Ian King <colin.king@intel.com>

scsi: bnx2i: Fix spelling mistake "mis-match" -> "mismatch"

There are a few spelling mistakes in some error messages. Fix them.

Link: https://lore.kernel.org/r/20220319231445.21696-1-colin.i.king@gmail.com
Acked-by: Manish Rangankar <mrangankar@marvell.com>
Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>


# 4bfb9809 09-Aug-2021 Bart Van Assche <bvanassche@acm.org>

scsi: bnx2i: Use scsi_cmd_to_rq() instead of scsi_cmnd.request

Prepare for removal of the request pointer by using scsi_cmd_to_rq()
instead. This patch does not change any functionality.

Link: https://lore.kernel.org/r/20210809230355.8186-17-bvanassche@acm.org
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>


# adb25343 10-Mar-2021 Rasmus Villemoes <linux@rasmusvillemoes.dk>

scsi: bnx2i: Make bnx2i_process_iscsi_error() simpler and more robust

Instead of strcpy'ing into a stack buffer, just let additional_notice point
to a string literal living in .rodata. This is better in a few ways:

- Smaller .text - instead of gcc compiling the strcpys as a bunch of
immediate stores (effectively encoding the string literal in the
instruction stream), we only pay the price of storing the literal in
.rodata.

- Faster, because there's no string copying.

- Smaller stack usage (with my compiler, 72 bytes instead of 176 for the
sole caller, bnx2i_indicate_kcqe)

Moreover, it's currently possible for additional_notice[] to get used
uninitialized, so some random stack garbage would be passed to printk() -
in the worst case without any '\0' anywhere in those 64 bytes. That could
be fixed by initializing additional_notice[0], but the same is achieved
here by initializing the new pointer variable to "".

Also give the message pointer a similar treatment - there's no point making
temporary copies on the stack of those two strings.

Link: https://lore.kernel.org/r/20210310221602.2494422-1-linux@rasmusvillemoes.dk
Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>


# dd3273c9 23-Jul-2020 Lee Jones <lee.jones@linaro.org>

scsi: bnx2i: Fix a whole host of kerneldoc issues

Mainly renames and docrot issues.

Fixes the following W=1 kernel build warning(s):

drivers/scsi/bnx2i/bnx2i_hwi.c:194: warning: Function parameter or member 'bnx2i_conn' not described in 'bnx2i_get_rq_buf'
drivers/scsi/bnx2i/bnx2i_hwi.c:194: warning: Excess function parameter 'conn' description in 'bnx2i_get_rq_buf'
drivers/scsi/bnx2i/bnx2i_hwi.c:232: warning: Function parameter or member 'bnx2i_conn' not described in 'bnx2i_put_rq_buf'
drivers/scsi/bnx2i/bnx2i_hwi.c:232: warning: Excess function parameter 'conn' description in 'bnx2i_put_rq_buf'
drivers/scsi/bnx2i/bnx2i_hwi.c:269: warning: Function parameter or member 'bnx2i_conn' not described in 'bnx2i_ring_sq_dbell'
drivers/scsi/bnx2i/bnx2i_hwi.c:269: warning: Excess function parameter 'conn' description in 'bnx2i_ring_sq_dbell'
drivers/scsi/bnx2i/bnx2i_hwi.c:293: warning: Function parameter or member 'bnx2i_conn' not described in 'bnx2i_ring_dbell_update_sq_params'
drivers/scsi/bnx2i/bnx2i_hwi.c:293: warning: Excess function parameter 'conn' description in 'bnx2i_ring_dbell_update_sq_params'
drivers/scsi/bnx2i/bnx2i_hwi.c:331: warning: Function parameter or member 'bnx2i_conn' not described in 'bnx2i_send_iscsi_login'
drivers/scsi/bnx2i/bnx2i_hwi.c:331: warning: Function parameter or member 'task' not described in 'bnx2i_send_iscsi_login'
drivers/scsi/bnx2i/bnx2i_hwi.c:331: warning: Excess function parameter 'conn' description in 'bnx2i_send_iscsi_login'
drivers/scsi/bnx2i/bnx2i_hwi.c:331: warning: Excess function parameter 'cmd' description in 'bnx2i_send_iscsi_login'
drivers/scsi/bnx2i/bnx2i_hwi.c:384: warning: Function parameter or member 'bnx2i_conn' not described in 'bnx2i_send_iscsi_tmf'
drivers/scsi/bnx2i/bnx2i_hwi.c:384: warning: Excess function parameter 'conn' description in 'bnx2i_send_iscsi_tmf'
drivers/scsi/bnx2i/bnx2i_hwi.c:458: warning: Function parameter or member 'bnx2i_conn' not described in 'bnx2i_send_iscsi_text'
drivers/scsi/bnx2i/bnx2i_hwi.c:458: warning: Excess function parameter 'conn' description in 'bnx2i_send_iscsi_text'
drivers/scsi/bnx2i/bnx2i_hwi.c:506: warning: Function parameter or member 'bnx2i_conn' not described in 'bnx2i_send_iscsi_scsicmd'
drivers/scsi/bnx2i/bnx2i_hwi.c:506: warning: Excess function parameter 'conn' description in 'bnx2i_send_iscsi_scsicmd'
drivers/scsi/bnx2i/bnx2i_hwi.c:533: warning: Function parameter or member 'bnx2i_conn' not described in 'bnx2i_send_iscsi_nopout'
drivers/scsi/bnx2i/bnx2i_hwi.c:533: warning: Function parameter or member 'task' not described in 'bnx2i_send_iscsi_nopout'
drivers/scsi/bnx2i/bnx2i_hwi.c:533: warning: Excess function parameter 'conn' description in 'bnx2i_send_iscsi_nopout'
drivers/scsi/bnx2i/bnx2i_hwi.c:533: warning: Excess function parameter 'cmd' description in 'bnx2i_send_iscsi_nopout'
drivers/scsi/bnx2i/bnx2i_hwi.c:590: warning: Function parameter or member 'bnx2i_conn' not described in 'bnx2i_send_iscsi_logout'
drivers/scsi/bnx2i/bnx2i_hwi.c:590: warning: Function parameter or member 'task' not described in 'bnx2i_send_iscsi_logout'
drivers/scsi/bnx2i/bnx2i_hwi.c:590: warning: Excess function parameter 'conn' description in 'bnx2i_send_iscsi_logout'
drivers/scsi/bnx2i/bnx2i_hwi.c:590: warning: Excess function parameter 'cmd' description in 'bnx2i_send_iscsi_logout'
drivers/scsi/bnx2i/bnx2i_hwi.c:686: warning: Function parameter or member 't' not described in 'bnx2i_ep_ofld_timer'
drivers/scsi/bnx2i/bnx2i_hwi.c:686: warning: Excess function parameter 'data' description in 'bnx2i_ep_ofld_timer'
drivers/scsi/bnx2i/bnx2i_hwi.c:1672: warning: Function parameter or member 'bnx2i_conn' not described in 'bnx2i_unsol_pdu_adjust_rq'
drivers/scsi/bnx2i/bnx2i_hwi.c:1672: warning: Excess function parameter 'conn' description in 'bnx2i_unsol_pdu_adjust_rq'
drivers/scsi/bnx2i/bnx2i_hwi.c:1900: warning: Function parameter or member 'session' not described in 'bnx2i_queue_scsi_cmd_resp'
drivers/scsi/bnx2i/bnx2i_hwi.c:1900: warning: Function parameter or member 'cqe' not described in 'bnx2i_queue_scsi_cmd_resp'
drivers/scsi/bnx2i/bnx2i_hwi.c:2476: warning: Function parameter or member 'context' not described in 'bnx2i_indicate_kcqe'
drivers/scsi/bnx2i/bnx2i_hwi.c:2476: warning: Function parameter or member 'kcqe' not described in 'bnx2i_indicate_kcqe'
drivers/scsi/bnx2i/bnx2i_hwi.c:2476: warning: Function parameter or member 'num_cqe' not described in 'bnx2i_indicate_kcqe'
drivers/scsi/bnx2i/bnx2i_hwi.c:2476: warning: Excess function parameter 'hba' description in 'bnx2i_indicate_kcqe'
drivers/scsi/bnx2i/bnx2i_hwi.c:2476: warning: Excess function parameter 'update_kcqe' description in 'bnx2i_indicate_kcqe'
drivers/scsi/bnx2i/bnx2i_hwi.c:2624: warning: Function parameter or member 'cm_sk' not described in 'bnx2i_cm_remote_close'
drivers/scsi/bnx2i/bnx2i_hwi.c:2624: warning: Excess function parameter 'hba' description in 'bnx2i_cm_remote_close'
drivers/scsi/bnx2i/bnx2i_hwi.c:2624: warning: Excess function parameter 'update_kcqe' description in 'bnx2i_cm_remote_close'
drivers/scsi/bnx2i/bnx2i_hwi.c:2641: warning: Function parameter or member 'cm_sk' not described in 'bnx2i_cm_remote_abort'
drivers/scsi/bnx2i/bnx2i_hwi.c:2641: warning: Excess function parameter 'hba' description in 'bnx2i_cm_remote_abort'
drivers/scsi/bnx2i/bnx2i_hwi.c:2641: warning: Excess function parameter 'update_kcqe' description in 'bnx2i_cm_remote_abort'
drivers/scsi/bnx2i/bnx2i_hwi.c:2677: warning: cannot understand function prototype: 'struct cnic_ulp_ops bnx2i_cnic_cb = '

Link: https://lore.kernel.org/r/20200723122446.1329773-29-lee.jones@linaro.org
Cc: QLogic-Storage-Upstream@qlogic.com
Cc: Anil Veerabhadrappa <anilgv@broadcom.com>
Cc: Eddie Wai <eddie.wai@broadcom.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>


# 4bdc0d67 06-Jan-2020 Christoph Hellwig <hch@lst.de>

remove ioremap_nocache and devm_ioremap_nocache

ioremap has provided non-cached semantics by default since the Linux 2.6
days, so remove the additional ioremap_nocache interface.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: Arnd Bergmann <arnd@arndb.de>


# fb24ea52 22-Feb-2019 Will Deacon <will@kernel.org>

drivers: Remove explicit invocations of mmiowb()

mmiowb() is now implied by spin_unlock() on architectures that require
it, so there is no reason to call it from driver code. This patch was
generated using coccinelle:

@mmiowb@
@@
- mmiowb();

and invoked as:

$ for d in drivers include/linux/qed sound; do \
spatch --include-headers --sp-file mmiowb.cocci --dir $d --in-place; done

NOTE: mmiowb() has only ever guaranteed ordering in conjunction with
spin_unlock(). However, pairing each mmiowb() removal in this patch with
the corresponding call to spin_unlock() is not at all trivial, so there
is a small chance that this change may regress any drivers incorrectly
relying on mmiowb() to order MMIO writes between CPUs using lock-free
synchronisation. If you've ended up bisecting to this commit, you can
reintroduce the mmiowb() calls using wmb() instead, which should restore
the old behaviour on all architectures other than some esoteric ia64
systems.

Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Will Deacon <will.deacon@arm.com>


# 949b8c72 22-Feb-2019 Will Deacon <will@kernel.org>

drivers: Remove useless trailing comments from mmiowb() invocations

In preparation for using coccinelle to remove all mmiowb() instances
from drivers, remove all trailing comments since they won't be picked up
by spatch later on and will end up being preserved in the code.

Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Will Deacon <will.deacon@arm.com>


# 750afb08 04-Jan-2019 Luis Chamberlain <mcgrof@kernel.org>

cross-tree: phase out dma_zalloc_coherent()

We already need to zero out memory for dma_alloc_coherent(), as such
using dma_zalloc_coherent() is superflous. Phase it out.

This change was generated with the following Coccinelle SmPL patch:

@ replace_dma_zalloc_coherent @
expression dev, size, data, handle, flags;
@@

-dma_zalloc_coherent(dev, size, handle, flags)
+dma_alloc_coherent(dev, size, handle, flags)

Suggested-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
[hch: re-ran the script on the latest tree]
Signed-off-by: Christoph Hellwig <hch@lst.de>


# 9959376c 11-Nov-2018 YueHaibing <yuehaibing@huawei.com>

scsi: bnx2i: remove set but not used variable 'cid_num'

Fixes gcc '-Wunused-but-set-variable' warning:

drivers/scsi/bnx2i/bnx2i_hwi.c: In function 'bnx2i_process_ofld_cmpl':
drivers/scsi/bnx2i/bnx2i_hwi.c:2430:6: warning:
variable 'cid_num' set but not used [-Wunused-but-set-variable]

It never used since commit
cf4e6363859d ("[SCSI] bnx2i: Add bnx2i iSCSI driver.")

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Acked-by: Nilesh Javali <nilesh.javali@cavium.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>


# 9cf2bab6 31-Oct-2018 Jens Axboe <axboe@kernel.dk>

block: kill request ->cpu member

This was used for completion placement for the legacy path,
but for mq we have rq->mq_ctx->cpu for that. Add a helper
to get the request CPU assignment, as the mq_ctx type is
private to blk-mq.

Reviewed-by: Omar Sandoval <osandov@fb.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>


# aa154ea8 11-Jun-2018 Zhouyang Jia <jiazhouyang09@gmail.com>

scsi: bnx2i: add error handling for ioremap_nocache

When ioremap_nocache fails, the lack of error-handling code may cause
unexpected results.

This patch adds error-handling code after calling ioremap_nocache.

Signed-off-by: Zhouyang Jia <jiazhouyang09@gmail.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Acked-by: Manish Rangankar <Manish.Rangankar@cavium.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>


# 85e75175 30-Dec-2017 Himanshu Jha <himanshujha199640@gmail.com>

scsi: bnx2i: Use zeroing allocator rather than allocator/memset

Use dma_zalloc_coherent instead of dma_alloc_coherent followed by
memset 0.

Generated-by: scripts/coccinelle/api/alloc/kzalloc-simple.cocci

Suggested-by: Luis R. Rodriguez <mcgrof@kernel.org>
Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>
Acked-by: Manish Rangankar <Manish.Rangankar@cavium.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>


# f35cb48e 03-Nov-2017 Gustavo A. R. Silva <garsilva@embeddedor.com>

scsi: bnx2i: bnx2i_hwi: use swap macro in bnx2i_send_iscsi_nopout

Make use of the swap macro and remove unnecessary variable tmp. This
makes the code easier to read and maintain.

This code was detected with the help of Coccinelle.

Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Acked-by: Manish Rangankar <Manish.Rangankar@cavium.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>


# abef7510 22-Aug-2017 Kees Cook <keescook@chromium.org>

scsi: bnx2i: Convert timers to use timer_setup()

In preparation for unconditionally passing the struct timer_list pointer to
all timer callbacks, switch to using the new timer_setup() and from_timer()
to pass the timer pointer explicitly.

There was a seemingly missing call to initialize the timer in one handler,
so this was added to remove the open-coded initialization.

Cc: QLogic-Storage-Upstream@qlogic.com
Cc: "James E.J. Bottomley" <jejb@linux.vnet.ibm.com>
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
Cc: linux-scsi@vger.kernel.org
Signed-off-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>


# cd6372b6 10-Sep-2017 Christos Gkekas <chris.gekas@gmail.com>

scsi: bnx2i: Clean up unused pointers in bnx2i_hwi

Pointers bnx2i_cmd are set but never used, so they can be removed.

Signed-off-by: Christos Gkekas <chris.gekas@gmail.com>
Acked-by: Manish Rangankar <Manish.Rangankar@cavium.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>


# 09d2a4e7 04-Jun-2016 Colin Ian King <colin.king@canonical.com>

bnx2i: fix spelling mistake "complection" -> "completion"

Trivial fix to spelling mistake in printk message.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Reviewed-by: Laurence Oberman <loberman@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>


# f39a7757 03-Jul-2014 Vikas Chaudhary <vikas.chaudhary@qlogic.com>

bnx2i: Rebranding bnx2i driver

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

Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
Acked-by: Eddie Wai <eddie.wai@broadcom.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>


# 8698a745 11-Mar-2014 Dongsheng Yang <yangds.fnst@cn.fujitsu.com>

sched, treewide: Replace hardcoded nice values with MIN_NICE/MAX_NICE

Replace various -20/+19 hardcoded nice values with MIN_NICE/MAX_NICE.

Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
Acked-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/ff13819fd09b7a5dba5ab5ae797f2e7019bdfa17.1394532288.git.yangds.fnst@cn.fujitsu.com
Cc: devel@driverdev.osuosl.org
Cc: devicetree@vger.kernel.org
Cc: fcoe-devel@open-fcoe.org
Cc: linux390@de.ibm.com
Cc: linux-kernel@vger.kernel.org
Cc: linux-mm@kvack.org
Cc: linux-s390@vger.kernel.org
Cc: linux-scsi@vger.kernel.org
Cc: nbd-general@lists.sourceforge.net
Cc: ocfs2-devel@oss.oracle.com
Cc: openipmi-developer@lists.sourceforge.net
Cc: qla2xxx-upstream@qlogic.com
Cc: linux-arch@vger.kernel.org
[ Consolidated the patches, twiddled the changelog. ]
Signed-off-by: Ingo Molnar <mingo@kernel.org>


# be1fefc2 17-Mar-2014 Michael Chan <mchan@broadcom.com>

cnic,bnx2i,bnx2fc: Fix inconsistent use of page size

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 <mchan@broadcom.com>
Signed-off-by: Eddie Wai <eddie.wai@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 659743b0 06-Feb-2014 Shlomo Pongratz <shlomop@mellanox.com>

[SCSI] libiscsi: Reduce locking contention in fast path

Replace the session lock with two locks, a forward lock and
a backwards lock named frwd_lock and back_lock respectively.

The forward lock protects resources that change while sending a
request to the target, such as cmdsn, queued_cmdsn, and allocating
task from the commands' pool with kfifo_out.

The backward lock protects resources that change while processing
a response or in error path, such as cmdsn_exp, cmdsn_max, and
returning tasks to the commands' pool with kfifo_in.

Under a steady state fast-path situation, that is when one
or more processes/threads submit IO to an iscsi device and
a single kernel upcall (e.g softirq) is dealing with processing
of responses without errors, this patch eliminates the contention
between the queuecommand()/request response/scsi_done() flows
associated with iscsi sessions.

Between the forward and the backward locks exists a strict locking
hierarchy. The mutual exclusion zone protected by the forward lock can
enclose the mutual exclusion zone protected by the backward lock but not
vice versa.

For example, in iscsi_conn_teardown or in iscsi_xmit_data when there is
a failure and __iscsi_put_task is called, the backward lock is taken while
the forward lock is still taken. On the other hand, if in the RX path a nop
is to be sent, for example in iscsi_handle_reject or __iscsi_complete_pdu
than the forward lock is released and the backward lock is taken for the
duration of iscsi_send_nopout, later the backward lock is released and the
forward lock is retaken.

libiscsi_tcp uses two kernel fifos the r2t pool and the r2t queue.

The insertion and deletion from these queues didn't corespond to the
assumption taken by the new forward/backwards session locking paradigm.

That is, in iscsi_tcp_clenup_task which belongs to the RX (backwards)
path, r2t is taken out from r2t queue and inserted to the r2t pool.
In iscsi_tcp_get_curr_r2t which belong to the TX (forward) path, r2t
is also inserted to the r2t pool and another r2t is pulled from r2t
queue.

Only in iscsi_tcp_r2t_rsp which is called in the RX path but can requeue
to the TX path, r2t is taken from the r2t pool and inserted to the r2t
queue.

In order to cope with this situation, two spin locks were added,
pool2queue and queue2pool. The former protects extracting from the
r2t pool and inserting to the r2t queue, and the later protects the
extracing from the r2t queue and inserting to the r2t pool.

Signed-off-by: Shlomo Pongratz <shlomop@mellanox.com>
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
[minor fix up to apply cleanly and compile fix]
Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>


# 3f79410c 11-Oct-2013 Maxime Jayat <maxime@artisandeveloppeur.fr>

treewide: Fix common typo in "identify"

Correct common misspelling of "identify" as "indentify" throughout
the kernel

Signed-off-by: Maxime Jayat <maxime@artisandeveloppeur.fr>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# f78afb35 18-Sep-2013 Michael Chan <mchan@broadcom.com>

bnx2x, cnic, bnx2i, bnx2fc: Fix bnx2i and bnx2fc regressions.

commit b9871bcfd211d316adee317608dab44c58d6ea2d
bnx2x: VF RSS support - PF side

changed the configuration of the doorbell HW and it broke iSCSI and FCoE.
We fix this by making compatible changes to the doorbell address in bnx2i
and bnx2fc. For the userspace driver, we need to pass a modified CID
so that the existing userspace driver will calculate the correct doorbell
address and continue to work.

Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Eddie Wai <eddie.wai@broadcom.com>
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 0b3bf387 11-Jul-2013 Eddie Wai <eddie.wai@broadcom.com>

[SCSI] bnx2i: Update version and copyright year 2013

Old version: 2.7.2.2
New version: 2.7.6.2

Signed-off-by: Eddie Wai <eddie.wai@broadcom.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>


# d4a0d607 03-Jul-2012 Tomas Henzl <thenzl@redhat.com>

[SCSI] bnx2i: fix the bit manipulation when setting the error mask

The intention in bnx2i_send_fw_iscsi_init_msg was to zero out
only the lower 32bits, but instead the whole mask64 is zeroed.
This patch fixes it.

Signed-off-by: Tomas Henzl <thenzl@redhat.com>
Acked-by: Eddie Wai <eddie.wai@broadcom.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>


# d6532207 21-Aug-2012 Eddie Wai <eddie.wai@broadcom.com>

[SCSI] bnx2i: Fixed NULL ptr deference for 1G bnx2 Linux iSCSI offload

This patch fixes the following kernel panic invoked by uninitialized fields
in the chip initialization for the 1G bnx2 iSCSI offload.

One of the bits in the chip initialization is being used by the latest
firmware to control overflow packets. When this control bit gets enabled
erroneously, it would ultimately result in a bad packet placement which would
cause the bnx2 driver to dereference a NULL ptr in the placement handler.

This can happen under certain stress I/O environment under the Linux
iSCSI offload operation.

This change only affects Broadcom's 5709 chipset.

Unable to handle kernel NULL pointer dereference at 0000000000000008 RIP:
[<ffffffff881f0e7d>] :bnx2:bnx2_poll_work+0xd0d/0x13c5
Pid: 0, comm: swapper Tainted: G ---- 2.6.18-333.el5debug #2
RIP: 0010:[<ffffffff881f0e7d>] [<ffffffff881f0e7d>] :bnx2:bnx2_poll_work+0xd0d/0x13c5
RSP: 0018:ffff8101b575bd50 EFLAGS: 00010216
RAX: 0000000000000005 RBX: ffff81007c5fb180 RCX: 0000000000000000
RDX: 0000000000000ffc RSI: 00000000817e8000 RDI: 0000000000000220
RBP: ffff81015bbd7ec0 R08: ffff8100817e9000 R09: 0000000000000000
R10: ffff81007c5fb180 R11: 00000000000000c8 R12: 000000007a25a010
R13: 0000000000000000 R14: 0000000000000005 R15: ffff810159f80558
FS: 0000000000000000(0000) GS:ffff8101afebc240(0000) knlGS:0000000000000000
CS: 0010 DS: 0018 ES: 0018 CR0: 000000008005003b
CR2: 0000000000000008 CR3: 0000000000201000 CR4: 00000000000006a0
Process swapper (pid: 0, threadinfo ffff8101b5754000, task ffff8101afebd820)
Stack: 000000000000000b ffff810159f80000 0000000000000040 ffff810159f80520
ffff810159f80500 00cf00cf8008e84b ffffc200100939e0 ffff810009035b20
0000502900000000 000000be00000001 ffff8100817e7810 00d08101b575bea8
Call Trace:
<IRQ> [<ffffffff8008e0d0>] show_schedstat+0x1c2/0x25b
[<ffffffff881f1886>] :bnx2:bnx2_poll+0xf6/0x231
[<ffffffff8000c9b9>] net_rx_action+0xac/0x1b1
[<ffffffff800125a0>] __do_softirq+0x89/0x133
[<ffffffff8005e30c>] call_softirq+0x1c/0x28
[<ffffffff8006d5de>] do_softirq+0x2c/0x7d
[<ffffffff8006d46e>] do_IRQ+0xee/0xf7
[<ffffffff8005d625>] ret_from_intr+0x0/0xa
<EOI> [<ffffffff801a5780>] acpi_processor_idle_simple+0x1c5/0x341
[<ffffffff801a573d>] acpi_processor_idle_simple+0x182/0x341
[<ffffffff801a55bb>] acpi_processor_idle_simple+0x0/0x341
[<ffffffff80049560>] cpu_idle+0x95/0xb8
[<ffffffff80078b1c>] start_secondary+0x479/0x488

Signed-off-by: Eddie Wai <eddie.wai@broadcom.com>
Cc: stable@vger.kernel.org
Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>


# a7717180 29-Jun-2012 Eddie Wai <eddie.wai@broadcom.com>

[SCSI] bnx2i: Removed the reference to the netdev->base_addr

The netdev->base_addr parameter has been deprecated in the L2 bnx2
driver. This is used by bnx2i for the BARn iomapping.

This patch will directly reference the pci_resource_start instead
of using the deprecated netdev->base_addr.

This patch is actually a critical bug fix as the 1G bnx2 driver no
longer supports the netdev->base_addr in the current kernel of the scsi
tree. This means that Broadcom's 1G Linux iSCSI offload solution would
not work at all without this patch.

Signed-off-by: Eddie Wai <eddie.wai@broadcom.com>
Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>


# 2e499d3c 25-Jun-2012 Barak Witkowski <barak@broadcom.com>

bnx2x, bnx2fc, bnx2i, cnic: Add statistics support and FCoE capabilities advertisement

1. When FCoE offload driver is registered, copy its capabilities to the chip
scratchpad.
2. Copy FCoE/iSCSI MAC addresses in aligned manner to chip scratchpad.
3. Add FCoE/iSCSI statistics collection support

Signed-off-by: Barak Witkowski <barak@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: Eddie Wai <eddie.wai@broadcom.com>
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 9ebd99c5 25-Apr-2012 Eddie Wai <eddie.wai@broadcom.com>

[SCSI] bnx2i: Updated version and copyright year

Old version: 2.7.0.3
New version: 2.7.2.2

Signed-off-by: Eddie Wai <eddie.wai@broadcom.com>
Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>


# 70fc872c 02-Feb-2012 Eddie Wai <eddie.wai@broadcom.com>

[SCSI] bnx2i: Fixed the override of the error_mask module param

The error_mask module param overrides has a bug which prevented
the new module param values to take effect.

Also changed the type attribute of the error_mask1/2 module params
from int to uint to allow the MSB to be set.

Signed-off-by: Eddie Wai <eddie.wai@broadcom.com>
Acked-by: Anil Veerabhadrappa <anilgv@broadcom.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>


# a878185c 06-Dec-2011 Eddie Wai <eddie.wai@broadcom.com>

[SCSI] bnx2i: Fixed kernel panic caused by unprotected task->sc->request deref

During session recovery, the conn_stop call will trigger a flush
to all outstanding SCSI cmds in the xmit queue. This will set
all outstanding task->sc to NULL prior to the session_teardown
call which frees the task memory.

In the bnx2i SCSI response processing path, only the task was being checked
for NULL under the session lock before the task->sc->request dereferencing.
If there are outstanding SCSI cmd responses pending for process, the
following kernel panic can be exposed where task->sc was found to be NULL.

Call Trace:
[ 69.720205] [<ffffffffa040d0d0>] bnx2i_process_new_cqes+0x290/0x3c0 [bnx2i]
[ 69.804289] [<ffffffffa040d233>] bnx2i_fastpath_notification+0x33/0xa0 [bnx2
i]
[ 69.891490] [<ffffffffa040d37b>] bnx2i_indicate_kcqe+0xdb/0x330 [bnx2i]
[ 69.971427] [<ffffffffa03eac5e>] service_kcqes+0x16e/0x1d0 [cnic]
[ 70.045132] [<ffffffffa03eacea>] cnic_service_bnx2x_kcq+0x2a/0x50 [cnic]
[ 70.126105] [<ffffffffa03ead53>] cnic_service_bnx2x_bh+0x43/0x140 [cnic]
[ 70.207081] [<ffffffff81060676>] tasklet_action+0x66/0x110
[ 70.273521] [<ffffffff8106025f>] __do_softirq+0xef/0x220
[ 70.337887] [<ffffffff81447ebc>] call_softirq+0x1c/0x30

This patch adds the !task->sc check and also protects the sc dereferencing
under the session lock.

Signed-off-by: Eddie Wai <eddie.wai@broadcom.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>


# 610602f3 26-Aug-2011 Eddie Wai <eddie.wai@broadcom.com>

[SCSI] bnx2i: Fixed the endian on TTT for NOP out transmission

The iscsi_nopout task's TTT is defined as __be32 while the DMA
memory to the chip is CPU specific. This creates a problem for
unsolicited NOP-In responses where the TTT is not the RESERVED
tag of 0xFFs. This patch adds a call to be32_to_cpu for the TTT
specified.

Signed-off-by: Eddie Wai <eddie.wai@broadcom.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>


# 55bdabdf 16-Jun-2011 Andy Grover <agrover@redhat.com>

iscsi: Use struct scsi_lun in iscsi structs instead of u8[8]

struct scsi_lun is also just a struct with an array of 8 octets (64 bits)
but using it instead in iscsi structs lets us call scsilun_to_int
without a cast, and also lets us copy it using assignment, instead of
memcpy().

Signed-off-by: Andy Grover <agrover@redhat.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>


# 12352183 27-May-2011 Nicholas Bellinger <nab@linux-iscsi.org>

iscsi: Resolve iscsi_proto.h naming conflicts with drivers/target/iscsi

This patch renames the following iscsi_proto.h structures to avoid
namespace issues with drivers/target/iscsi/iscsi_target_core.h:

*) struct iscsi_cmd -> struct iscsi_scsi_req
*) struct iscsi_cmd_rsp -> struct iscsi_scsi_rsp
*) struct iscsi_login -> struct iscsi_login_req

This patch includes useful ISCSI_FLAG_LOGIN_[CURRENT,NEXT]_STAGE*,
and ISCSI_FLAG_SNACK_TYPE_* definitions used by iscsi_target_mod, and
fixes the incorrect definition of struct iscsi_snack to following
RFC-3720 Section 10.16. SNACK Request.

Also, this patch updates libiscsi, iSER, be2iscsi, and bn2xi to
use the updated structure definitions in a handful of locations.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>


# 0d83ab65 15-Jul-2011 Eddie Wai <eddie.wai@broadcom.com>

[SCSI] bnx2i: Fixed kernel panic due to illegal usage of sc->request->cpu

A kernel panic was observed when passing the sc->request->cpu = -1 to
retrieve the per_cpu variable pointer:
#0 [ffff880011203960] machine_kexec at ffffffff81022bc3
#1 [ffff8800112039b0] crash_kexec at ffffffff81088630
#2 [ffff880011203a80] __die at ffffffff8139ea20
#3 [ffff880011203aa0] no_context at ffffffff8102f3a7
#4 [ffff880011203ae0] __bad_area_nosemaphore at ffffffff8102f665
#5 [ffff880011203ba0] retint_signal at ffffffff8139dd1f
#6 [ffff880011203cc8] bnx2i_indicate_kcqe at ffffffffa03dc4f2
#7 [ffff880011203da8] service_kcqes at ffffffffa03cb04f
#8 [ffff880011203e68] cnic_service_bnx2x_kcq at ffffffffa03cb14a
#9 [ffff880011203e88] cnic_service_bnx2x_bh at ffffffffa03cb1b3

The problem lies in the slow path sg_io (and perhaps sg_scsi_ioctl) call to
blk_get_request->get_request/wait->blk_alloc_request->blk_rq_init which
re-initializes the request->cpu to -1. There is no assignment for cpu from
that to the request_fn call to low level drivers.

When this happens, the sc->request->cpu will be using the init value of
-1. This will create a kernel panic when it hits bnx2i because the code
refers it to get the per_cpu variables ptr.

This change is to put in a guard against that and also for cases when
bio affinity/queue completion to the same cpu is not enabled. In those
cases, the request->cpu will remain a -1 also.

This bug was created from commit: b5cf6b63f73abdc051035f0050b367beeb2ef94c

For the case when the blk layer did not setup the request->cpu, bnx2i
will complete the sc with the current CPU of the thread.

Signed-off-by: Eddie Wai <eddie.wai@broadcom.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>


# 415199f2 20-Jul-2011 Michael Chan <mchan@broadcom.com>

cnic: Add VLAN ID as a parameter during netevent upcall

The bnx2fc driver needs to handle netdev events on VLAN devices.

Signed-off-by: Michael Chan <mchan@broadcom.com>
Reviewed-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# ea9582d7 23-Jun-2011 Eddie Wai <eddie.wai@broadcom.com>

[SCSI] bnx2i: Updated copyright and bump version

Bumped version from 2.6.2.3 to 2.7.0.3

Signed-off-by: Eddie Wai <eddie.wai@broadcom.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>


# b5cf6b63 23-Jun-2011 Eddie Wai <eddie.wai@broadcom.com>

[SCSI] bnx2i: Added the use of kthreads to handle SCSI cmd completion

This patch breaks the SCSI cmd completion into two parts:
1. The bh will allocate and queued work to the cmd specific CPU IO
completion kthread. The CPU for the cmd is from the sc->request->cpu.

2. The CPU specific IO completion kthread will call the scsi_cmd_resp
routine to do the actual cmd completion.

In the normal case, these IO completion kthreads should complete before
the blk IO times out at 60s. However, in the case when these kthreads
are blocked for whatever reason and exceeded the timeout, the call
to conn_destroy will have to iterate and exhaust all related work in the
percpu work list for all online CPUs. This will guarantee the protection
of the work->session and conn pointers before they get freed.

Also modified the event coalescing formula to have at least the
event_coal_min outstanding cmds in the pipeline so the SCSI producer
would not get underrun.

Also changed the following SCSI parameters:
- can_queue from 1024 to 2048
- cmds_per_lun from 24 to 128

Signed-off-by: Eddie Wai <eddie.wai@broadcom.com>
Acked-by: Benjamin Li <benli@broadcom.com>
Acked-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>


# 516f43a2 16-Jun-2011 Andy Grover <agrover@redhat.com>

[SCSI] iscsi: Use struct scsi_lun in iscsi structs instead of u8[8]

struct scsi_lun is also just a struct with an array of 8 octets (64 bits)
but using it instead in iscsi structs lets us call scsilun_to_int
without a cast, and also lets us copy it using assignment, instead of
memcpy().

Signed-off-by: Andy Grover <agrover@redhat.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>


# 9ae58e14 16-May-2011 Eddie Wai <eddie.wai@broadcom.com>

[SCSI] bnx2i: Optimized the iSCSI offload performance

Modified the event coalescing code for iSCSI offload to combat both
corner cases and optimize performance as follows:

1. Added mechanism to loop back a second time to process any leftover
CQEs that was generated by the hardware during the time the driver is
busy processing previous CQEs in the bh. This not only helps the
performance but also fixes the corner case when no more CQEs are being
generated in the pipeline; so those leftover CQEs will get a a chance
to be processed.

2. Added ARM_CQE_FP to distinguish between fast path arming versus
slow path arming. This change will guarantee that the CQEs will
always get a chance to be re-armed during fast path completions.

3. Removed the inline event coalescing division for perf optimization.
Also fixed a division-by-zero error when the event_coal_div module
param was set to 0.

4. Changed the default SQ WQEs size from 256 to 128 to match chip
default.

5. Changed the cmd_per_lun from 32 to 24.

Signed-off-by: Eddie Wai <eddie.wai@broadcom.com>
Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <jbottomley@parallels.com>


# 7287c63e 16-May-2011 Eddie Wai <eddie.wai@broadcom.com>

[SCSI] bnx2i: Fixed packet error created when the sq_size is set to 16

The number of chip's internal command cell, which is use to generate
SCSI cmd packets to the target, was not initialized correctly by
the driver when the sq_size is changed from the default 128.
This, in turn, will create a problem where the chip's transmit pipe
will erroneously reuse an old command cell that is no longer valid.
The fix is to correctly initialize the chip's command cell upon setup.

Signed-off-by: Eddie Wai <eddie.wai@broadcom.com>
Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
Cc: stable@kernel.org
Signed-off-by: James Bottomley <jbottomley@parallels.com>


# 25985edc 30-Mar-2011 Lucas De Marchi <lucas.demarchi@profusion.mobi>

Fix common misspellings

Fixes generated by 'codespell' and manually reviewed.

Signed-off-by: Lucas De Marchi <lucas.demarchi@profusion.mobi>


# 09813ba5 16-Feb-2011 Eddie Wai <eddie.wai@broadcom.com>

[SCSI] bnx2i: Added iSCSI text pdu support for iSCSI offload

This is part of an effort to support send target discovery via
the iSCSI offload path.

Signed-off-by: Eddie Wai <eddie.wai@broadcom.com>
Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>


# ee15bd2d 16-Feb-2011 Eddie Wai <eddie.wai@broadcom.com>

[SCSI] bnx2i: Fixed the 32-bit swapping of the LUN field for nopouts for 5771X

Fixed a bug where the 64-bit LUN field for nopouts were 32-bit swapped.
This only pertains to 5771X devices.

Signed-off-by: Eddie Wai <eddie.wai@broadcom.com>
Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>


# 70e14722 08-Jan-2011 Eddie Wai <eddie.wai@broadcom.com>

[SCSI] bnx2i: Added reconnect fix connecting against Lefthand targets

The nopout's reserved field was not being initialized to zero
before being reused. Stale CDB values from previous SCSI cmds
of the same BHS offset was the cause of the disconnection
initiated by the Lefthand target.

Signed-off-by: Eddie Wai <eddie.wai@broadcom.com>
Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>


# 939b82e5 23-Dec-2010 Michael Chan <mchan@broadcom.com>

cnic: Improve ->iscsi_nl_msg_send()

1. Change first parameter from cnic_dev to ulp_handle which is the hba
pointer. All other similar upcalls are using hba pointer. The callee
can then directly reference the hba without conversion.

2. Change return value from void to int so that an error code can be
passed back. This allows the operation to be retried.

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 11cec1e2 23-Nov-2010 Eddie Wai <eddie.wai@broadcom.com>

[SCSI] bnx2i: Updated copyright and maintainer info

Signed-off-by: Eddie Wai <eddie.wai@broadcom.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>


# bee34877 23-Nov-2010 Eddie Wai <eddie.wai@broadcom.com>

[SCSI] bnx2i: Added return code check for chip kwqe submission request

Added the handling for cases when a chip request is made to the
CNIC module but the hardware is not ready to accept. This would
lead to many unnecessary wait timeouts.
This code adds check in the connect establishment and destruction
path.

Signed-off-by: Eddie Wai <eddie.wai@broadcom.com>
Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>


# 94810e82 23-Nov-2010 Eddie Wai <eddie.wai@broadcom.com>

[SCSI] bnx2i: Fixed the remote TCP RST handling for the 570X (1g)

Modified the handling of the remote TCP RST code so the chip can now
flush the tx pipe accordingly upon a remote TCP RST reception.

Signed-off-by: Eddie Wai <eddie.wai@broadcom.com>
Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>


# cf464fc5 23-Nov-2010 Eddie Wai <eddie.wai@broadcom.com>

[SCSI] bnx2i: Fixed the endian bug in the TMF LUN cmd send

Added a be32_to_cpu call for the TMF LUN wqe.

Signed-off-by: Eddie Wai <eddie.wai@broadcom.com>
Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>


# 8eea2f55 23-Nov-2010 Eddie Wai <eddie.wai@broadcom.com>

[SCSI] bnx2i: Added fix for NOP-Out response panic from unsolicited NOP-In

The patch fixes the following situations where NOP-Out pkt is called for:
- local unsolicited NOP-Out requests (requesting no NOP-In response)
- local NOP-Out responses to unsolicited NOP-In requests

kernel panic is observed due to double session spin_lock requests; one in the
bnx2i_process_nopin_local_cmpl routine in bnx2i_hwi.c and the other in the
iscsi_put_task routine in libiscsi.c

The proposed fix is to export the currently static __iscsi_put_task() routine
and have bnx2i call it directly instead of the iscsi_put_task() routine which
holds the session spin lock.

Signed-off-by: Eddie Wai <eddie.wai@broadcom.com>
Reviewed-by: Michael Chan <mchan@broadcom.com>
Reviewed-by: Anil Veerabhadrappa <anilgv@broadcom.com>
Acked-by: Benjamin Li <benli@broadcom.com>
Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>


# 5ee32576 23-Nov-2010 Eddie Wai <eddie.wai@broadcom.com>

[SCSI] bnx2i: Fixed bugs in the handling of unsolicited NOP-Ins

Unsolicited NOP-Ins are placed in the receive queue of the hardware
which requires to be read out regardless if the receive pipe is suspended
or not. This patch adds the disposal of this RQ element under this
condition.
Also fixed the bug in the unsolicited NOP-In handling routine which
checks for the RESERVED_ITT.

Signed-off-by: Eddie Wai <eddie.wai@broadcom.com>
Reviewed-by: Michael Chan <mchan@broadcom.com>
Reviewed-by: Benjamin Li <benli@broadcom.com>
Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>


# 523224a3 05-Oct-2010 Dmitry Kravkov <dmitry@broadcom.com>

bnx2x, cnic, bnx2i: use new FW/HSI

This is the new FW HSI blob and the relevant definitions without logic changes.
It also included code adaptation for new HSI. New features are not enabled.

New FW/HSI includes:
- Support for 57712 HW
- Future support for VF (not used)
- Improvements in FW interrupts scheme
- FW FCoE hooks (stubs for future usage)

Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com>
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# c47b4012 13-Aug-2010 Eddie Wai <eddie.wai@broadcom.com>

[SCSI] bxn2i: Added support for other TMFs besides ABORT_TASK

Expanded the TMF request routine to support other TMFs such as LUN
RESET, etc.

Signed-off-by: Eddie Wai <eddie.wai@broadcom.com>
Reviewed-by: Anil Veerabhadrappa <anilgv@broadcom.com>
Reviewed-by: Benjamin Li <benli@broadcom.com>
Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>


# 39304072 12-Aug-2010 Eddie Wai <eddie.wai@broadcom.com>

[SCSI] bnx2i: Fixed a protocol violation on nopout responses

According to RFC3720, nopout packet sent in response to unsolicited
nopin packet requesting a response must retain the TTT of the requester.

Signed-off-by: Eddie Wai <eddie.wai@broadcom.com>
Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>


# 2eefb20d 01-Jul-2010 Eddie Wai <eddie.wai@broadcom.com>

[SCSI] bnx2i: Fixed the TCP graceful termination initiation

In compliance to RFC793, a TCP graceful termination will be used
instead of an abortive termination for the case where the remote
has initiated the close of the connection.
Additionally, a TCP abortive termination will be used to close the
connection when a logout response is not received in time after a
logout request has been initiated.

Signed-off-by: Eddie Wai <eddie.wai@broadcom.com>
Reviewed-by: Michael Chan <mchan@broadcom.com>
Reviewed-by: Benjamin Li <benli@broadcom.com>
Acked-by: Anil Veerabhadrappa <anilgv@broadcom.com>
Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>


# 2e15efc7 25-Mar-2010 Anil Veerabhadrappa <anilgv@broadcom.com>

[SCSI] bnx2i: make firmware use statsn field when constructing header

instruct firmware to use driver/iscsid provided expected statsn field
while constructing login pdu header.

Initialize 'flags' to instruct chip to use driver/iscsid provided
ExpStatSN value while constructing iSCSI login PDU header

Signed-off-by: Eddie Wai <waie@broadcom.com>
Signed-off-by: Anil Veerabhadrappa <anilgv@broadcom.com>
Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>


# 5a0e3ad6 24-Mar-2010 Tejun Heo <tj@kernel.org>

include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h

percpu.h is included by sched.h and module.h and thus ends up being
included when building most .c files. percpu.h includes slab.h which
in turn includes gfp.h making everything defined by the two files
universally available and complicating inclusion dependencies.

percpu.h -> slab.h dependency is about to be removed. Prepare for
this change by updating users of gfp and slab facilities include those
headers directly instead of assuming availability. As this conversion
needs to touch large number of source files, the following script is
used as the basis of conversion.

http://userweb.kernel.org/~tj/misc/slabh-sweep.py

The script does the followings.

* Scan files for gfp and slab usages and update includes such that
only the necessary includes are there. ie. if only gfp is used,
gfp.h, if slab is used, slab.h.

* When the script inserts a new include, it looks at the include
blocks and try to put the new include such that its order conforms
to its surrounding. It's put in the include block which contains
core kernel includes, in the same order that the rest are ordered -
alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
doesn't seem to be any matching order.

* If the script can't find a place to put a new include (mostly
because the file doesn't have fitting include block), it prints out
an error message indicating which .h file needs to be added to the
file.

The conversion was done in the following steps.

1. The initial automatic conversion of all .c files updated slightly
over 4000 files, deleting around 700 includes and adding ~480 gfp.h
and ~3000 slab.h inclusions. The script emitted errors for ~400
files.

2. Each error was manually checked. Some didn't need the inclusion,
some needed manual addition while adding it to implementation .h or
embedding .c file was more appropriate for others. This step added
inclusions to around 150 files.

3. The script was run again and the output was compared to the edits
from #2 to make sure no file was left behind.

4. Several build tests were done and a couple of problems were fixed.
e.g. lib/decompress_*.c used malloc/free() wrappers around slab
APIs requiring slab.h to be added manually.

5. The script was run on all .h files but without automatically
editing them as sprinkling gfp.h and slab.h inclusions around .h
files could easily lead to inclusion dependency hell. Most gfp.h
inclusion directives were ignored as stuff from gfp.h was usually
wildly available and often used in preprocessor macros. Each
slab.h inclusion directive was examined and added manually as
necessary.

6. percpu.h was updated not to include slab.h.

7. Build test were done on the following configurations and failures
were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
distributed build env didn't work with gcov compiles) and a few
more options had to be turned off depending on archs to make things
build (like ipr on powerpc/64 which failed due to missing writeq).

* x86 and x86_64 UP and SMP allmodconfig and a custom test config.
* powerpc and powerpc64 SMP allmodconfig
* sparc and sparc64 SMP allmodconfig
* ia64 SMP allmodconfig
* s390 SMP allmodconfig
* alpha SMP allmodconfig
* um on x86_64 SMP allmodconfig

8. percpu.h modifications were reverted so that it could be applied as
a separate patch and serve as bisection point.

Given the fact that I had only a couple of failures from tests on step
6, I'm fairly confident about the coverage of this conversion patch.
If there is a breakage, it's likely to be something in one of the arch
headers which should be easily discoverable easily on most builds of
the specific arch.

Signed-off-by: Tejun Heo <tj@kernel.org>
Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>


# 85fef202 07-Dec-2009 Anil Veerabhadrappa <anilgv@broadcom.com>

[SCSI] bnx2i: Task management ABORT TASK fixes

Due to typo error driver was failing TMF Abort Task request when
ctask->sc != NULL. Fixed code to fail TMF ABORT Task request only when
ctask->sc == NULL. Clear age component (19 most significant bits) of
reference ITT carried in iSCSI TMF PDU. Age component is internal to
initiator side and only lower bits of ITT as defined by ISCSI_ITT_MASK
is is sent on wire. Retrieve LUN directly from the ref_sc and update
SQ wqe as per chip HSI (Host Software Interface) specification

Signed-off-by: Anil Veerabhadrappa <anilgv@broadcom.com>
Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>


# 8776193b 07-Dec-2009 Anil Veerabhadrappa <anilgv@broadcom.com>

[SCSI] bnx2i: update CQ arming algorith for 5771x chipsets

Only affects 5771x (10G chipsets) devices

This is an optimized CQ arming algoritm which takes into account the
number of outstanding tasks

Signed-off-by: Anil Veerabhadrappa <anilgv@broadcom.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>


# 53203244 11-Sep-2009 Anil Veerabhadrappa <anilgv@broadcom.com>

[SCSI] bnx2i: Fix context mapping issue for architectures with PAGE_SIZE != 4096

5706/5708/5709 devices allow driver/user to set page size. By default it is
set to 4096. Current drivers do not program this register based on
architecture type (e.g. x86 = 4K, IA64 = 16K) and by choice lets device use
the defaults. So while mapping connection context memory (doorebll registers),
driver has to match page size used by the device. Included change fixes the
issue we uncovered during IA64 testing

Signed-off-by: Anil Veerabhadrappa <anilgv@broadcom.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>


# a419aef8 18-Aug-2009 Joe Perches <joe@perches.com>

trivial: remove unnecessary semicolons

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# cf4e6363 08-Jun-2009 Michael Chan <mchan@broadcom.com>

[SCSI] bnx2i: Add bnx2i iSCSI driver.

New iSCSI driver for Broadcom BNX2 devices. The driver interfaces with
the CNIC driver to access the hardware.

Signed-off-by: Anil Veerabhadrappa <anilgv@broadcom.com>
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>