aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/cnic.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2010-05-14drivers/net: Remove unnecessary returns from void function()sJoe Perches1-3/+0
This patch removes from drivers/net/ all the unnecessary return; statements that precede the last closing brace of void functions. It does not remove the returns that are immediately preceded by a label as gcc doesn't like that. It also does not remove null void functions with return. Done via: $ grep -rP --include=*.[ch] -l "return;\n}" net/ | \ xargs perl -i -e 'local $/ ; while (<>) { s/\n[ \t\n]+return;\n}/\n}/g; print; }' with some cleanups by hand. Compile tested x86 allmodconfig only. Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2010-04-07cnic: Fix crash during bnx2x MTU change.Michael Chan1-5/+5
cnic_service_bnx2x() irq handler can be called during chip reset from MTU change. Need to check that the cnic's device state is up before handling the irq. Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2010-02-26cnic: Update version to 2.1.1.Michael Chan1-1/+1
And update copyright to 2010. Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2010-02-26cnic: Use union for the status blocks of different devices.Michael Chan1-18/+17
We only need to assign the status block address once and it also saves space in the structure. Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: Benjamin Li <benli@broadcom.com> Signed-off-by: Eddie Wai <waie@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2010-02-26cnic: Simplify route checking during iSCSI connection.Michael Chan1-24/+13
With a separate IP address for iSCSI, connections should proceed whether or not we can get a route to the target from the network stack. It is possible that the network IP address may not reach the iSCSI target. Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: Benjamin Li <benli@broadcom.com> Signed-off-by: Eddie Wai <waie@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2010-02-26cnic: Fix panic in cnic_iscsi_nl_msg_recv() when device is down.Michael Chan1-0/+7
Some data structures are freed when the device is down and it will crash if an ISCSI netlink message is received. Add RCU protection to prevent this. In the shutdown path, ulp_ops[CNIC_ULP_L4] is assigned NULL and rcu_synchronized before freeing the data structures. Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2010-02-26cnic: Finetune iSCSI connection reset.Eddie Wai1-5/+16
For bnx2 devices, always send notification to bnx2i to let it initiate the cleanup when RST is received. For bnx2x devices, add unsolicited RST_COMP handling to start the cleanup. Signed-off-by: Eddie Wai <waie@broadcom.com> Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: Benjamin Li <benli@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2010-02-26cnic: Finetune iSCSI connection set up.Eddie Wai1-1/+16
Initialize IP ID and handle some additional connection errors. Signed-off-by: Eddie Wai <waie@broadcom.com> Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: Benjamin Li <benli@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2010-02-17drivers/net/cnic.c: Use (pr|netdev)_<level> macro helpersJoe Perches1-50/+37
Add #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt Remove #define PFX Use pr_<level> Use netdev_<level> Remove periods from formats Coalesce long formats Use __func__ Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2009-12-11cnic: Zero out status block and Event Queue indices.Michael Chan1-0/+5
To prevent stale indices from causing spurious events when restarting the bnx2x devices. Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2009-12-11cnic: Send delete command when shutting down iSCSI ring.Michael Chan1-0/+6
This step is necessary on the bnx2x devices when restarting the iSCSI ring. Without it, the firmware can assert and cause bnx2x to report errors. Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2009-12-02cnic: Use dma_alloc_coherent().Michael Chan1-24/+30
Replace pci_alloc_consistent() with dma_alloc_coherent() so that appropriate GFP flags can be used. Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: Benjamin Li <benli@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2009-12-02cnic: Fix rq_page_table DMA address.Michael Chan1-2/+2
The old code mistakenly zeroed out the upper 32-bit of the DMA address. Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: Benjamin Li <benli@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2009-12-02cnic: Fix bogus iSCSI MAC addressMichael Chan1-2/+6
Fix code to read the proper iSCSI MAC address for bnx2x devices. Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: Benjamin Li <benli@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2009-12-02cnic: Fix bnx2x ring shutdown.Michael Chan1-0/+7
Need to send a HALT command to the firmware to fully shutdown the bnx2x rings. Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: Benjamin Li <benli@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2009-12-02cnic: Fix ring I/O address for bnx2x devices.Michael Chan1-5/+3
Old code was initializing the ring producers using an incorrect I/O address. Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: Benjamin Li <benli@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2009-11-19drivers/net: tasklet_init - Remove unnecessary leading & from second argJoe Perches1-2/+2
Changed function pointer use from non-majority address-of style to majority short form without & via: (was: 8 with &, 36 without) grep -rPl "\btasklet_init\s*\([^,\)]+,\s*\&" drivers/net | while read file ; do \ perl -i -e 'local $/; while (<>) { s@(\btasklet_init\s*\([^,\)]+,\s*)\&@\1@g ; print ; }' $file ;\ done Compile tested allyesconfig x86 Signed-off-by: Joe Perches <joe@perches.com> drivers/net/cnic.c | 4 ++-- drivers/net/jme.c | 10 +++++----- drivers/net/skge.c | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) Signed-off-by: David S. Miller <davem@davemloft.net>
2009-11-04cnic: ensure ulp_type is not negativeroel kluin1-4/+4
`ulp_type' is signed, make sure it is not negative when we read the array element. Signed-off-by: Roel Kluin <roel.kluin@gmail.com> Acked-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2009-10-29Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6David S. Miller1-3/+3
2009-10-28cnic: Fix L2CTX_STATUSB_NUM offset in context memory.Michael Chan1-3/+3
The BNX2_L2CTX_STATUSB_NUM definition needs to be changed to match the recent firmware update: commit 078b0735881c7969aaf21469f3577831cddd9f8c bnx2: Update firmware to 5.0.0.j3. Without the fix, bnx2 can crash intermittently in bnx2_rx_int() when iSCSI is enabled. Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: Benjamin Li <benli@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2009-10-12cnic: Need to include net/ip6_checksum.hDavid S. Miller1-0/+1
drivers/net/cnic.c: In function 'cnic_init_storm_conn_bufs': drivers/net/cnic.c:1757: error: implicit declaration of function 'csum_ipv6_magic' Reported-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: David S. Miller <davem@davemloft.net>
2009-10-11cnic: Add main functions to support bnx2x devices.Michael Chan1-0/+1742
Add iSCSI support for bnx2x devices. Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: Shmulik Ravid - Rabinovitz <shmulikr@broadcom.com> Acked-by: Eilon Greenstein <eilong@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2009-10-11cnic: Add bnx2x data structures.Michael Chan1-0/+5
Add hardware and software structures for bnx2x devices. Signed-off-by: Michael Chan <mchan@broadcom.com> Acked-by: Eilon Greenstein <eilong@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2009-10-11cnic: Refactor some code.Michael Chan1-18/+46
Refactor ring init. code for subsequent 10G patches. Also add rtnl_lock() in cnic_uio_open() to prevent race condition with netdev events. Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2009-10-02cnic: Fix NETDEV_UP event processing.Michael Chan1-1/+2
This fixes the problem of not handling the NETDEV_UP event properly during hot-plug or modprobe of bnx2 after cnic. The handling was skipped by mistakenly using "else if" to check for the event. Also update version to 2.0.1. Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: Benjamin Li <benli@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2009-09-22cnic: Shutdown iSCSI ring during uio_close.Michael Chan1-2/+2
The iSCSI ring should be shutdown during uio_close instead of uio_open for proper operations. This fixes the problem of the ring getting stuck intermittently. Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: Benjamin Li <benli@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2009-09-02Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6David S. Miller1-39/+104
Conflicts: drivers/net/yellowfin.c
2009-08-28cnic: Put uio init in separate function.Michael Chan1-27/+41
This will allow the 10G iSCSI code to reuse the function. Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2009-08-28cnic: Put rx/tx ring allocation in separate function.Michael Chan1-11/+22
This will allow the 10G iSCSI code to reuse the function. Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2009-08-15cnic: Fix locking in init/exit calls.Michael Chan1-9/+39
The slow path ulp_init and ulp_exit calls to the bnx2i driver are sleepable calls and therefore should not be protected using rcu_read_lock. Fix it by using mutex and refcount during these calls. cnic_unregister_driver() will now wait for the refcount to go to zero before completing the call. Signed-off-by: Michael Chan <mchan@broadcom.com> Reviewed-by: Benjamin Li <benli@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2009-08-15cnic: Fix locking in start/stop calls.Michael Chan1-16/+28
The slow path ulp_start and ulp_stop calls to the bnx2i driver are sleepable calls and therefore should not be protected using rcu_read_lock. Fix it by using mutex and setting a bit during these calls. cnic_unregister_device() will now wait for the bit to clear before completing the call. Signed-off-by: Michael Chan <mchan@broadcom.com> Reviewed-by: Benjamin Li <benli@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2009-08-15cnic: Refine registration with bnx2.Michael Chan1-13/+36
Register and unregister with bnx2 during NETDEV_UP and NETDEV_DOWN events. This simplifies the sequence of events and allows locking fixes in the next patch. Signed-off-by: Michael Chan <mchan@broadcom.com> Reviewed-by: Benjamin Li <benli@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2009-08-15cnic: Fix symbol_put_addr() panic on ia64.Michael Chan1-1/+1
When the cnic driver tries to grab a symbol from bnx2 when bnx2 is running init code, symbol_get() will succeed but symbol_put_addr() will hit BUG() a moment later. module_text_address() fails because bnx2 is still in init code. This is fixed by using symbol_put() instead which does the exact opposite of symbol_get(). Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2009-07-27cnic: Fix ISCSI_KEVENT_IF_DOWN message handling.Michael Chan1-2/+21
When a net device goes down or when the bnx2i driver is unloaded, the code was not generating the ISCSI_KEVENT_IF_DOWN message properly and this could cause the userspace driver to crash. This is fixed by sending the message properly in the shutdown path. cnic_uio_stop() is also added to send the message when bnx2i is unregistering. Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2009-06-21cnic: Fix __symbol_get() build error.Michael Chan1-2/+2
Ingo molnar <mingo@elte.hu> reported the error drivers/net/cnic.c:2520: error: implicit declaration of function ‘__symbol_get’ when CONFIG_MODULES is not defined. Fix by using symbol_get() instead. Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2009-06-21Revert "[SCSI] cnic: fix error: implicit declaration of function ‘__symbol_get’"James Bottomley1-2/+0
This reverts commit bc3bf8fd330ce981ce632a1a4a283eee46838f32. All the commit did was add a second #include of <linux/module.h> which is the wrong fix. Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2009-06-13[SCSI] cnic: fix error: implicit declaration of function ‘__symbol_get’Ingo Molnar1-0/+2
drivers/net/cnic.c: In function ‘init_bnx2_cnic’: drivers/net/cnic.c:2520: error: implicit declaration of function ‘__symbol_get’ drivers/net/cnic.c:2520: warning: assignment makes pointer from integer without a cast make[1]: *** [drivers/net/cnic.o] Error 1 make: *** [drivers/net/cnic.o] Error 2 Caused by not including linux/module.h Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2009-06-13[SCSI] cnic: fix undefined reference to `ip6_route_output'Randy Dunlap1-2/+6
Fix cnic build for case of CONFIG_INET=n. Fix cnic build for case of CONFIG_IPV6=m and CONFIG_CNIC=y. Fixes these build errors: cnic.c:(.text+0x236a1d): undefined reference to `ip_route_output_key' cnic.c:(.text+0x15a8e8): undefined reference to `ip6_route_output' Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2009-06-09[SCSI] cnic: Add new Broadcom CNIC driver.Michael Chan1-0/+2711
The CNIC driver controls BNX2 hardware rings and resources used by iSCSI. Most hardware resources for iSCSI are separate from those used for ethernet networking. iSCSI uses a separate MAC address and IP address. The CNIC driver creates a UIO interface to handle the non-offloaded packets such as ARP, etc in userspace. Signed-off-by: Michael Chan <mchan@broadcom.com> Acked-by: David S. Miller <davem@davemloft.net> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>