aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/cnic.c
Commit message (Collapse)AuthorAgeFilesLines
* cnic, bnx2: Check iSCSI support early in bnx2_init_one()Michael Chan2011-10-031-10/+2
| | | | | | | | | | | | | | | | | | | commit 7625eb2f2fff7bfae41d3119b472c20b48874895 upstream. Based on earlier patch from Neil Horman <nhorman@tuxdriver.com> If iSCSI is not supported on a bnx2 device, bnx2_cnic_probe() will return NULL and the cnic device will not be visible to bnx2i. This will prevent bnx2i from registering and then unregistering during cnic_start() and cause the warning message: bnx2 0003:01:00.1: eth1: Failed waiting for ULP up call to complete Signed-off-by: Michael Chan <mchan@broadcom.com> Cc: Neil Horman <nhorman@tuxdriver.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* cnic: Improve NETDEV_UP event handlingMichael Chan2011-10-031-2/+2
| | | | | | | | | | | | | | | | commit db1d350fcb156b58f66a67680617077bcacfe6fc upstream. During NETDEV_UP, we use symbol_get() to get the net driver's cnic probe function. This sometimes doesn't work if NETDEV_UP happens right after NETDEV_REGISTER and the net driver is still running module init code. As a result, the cnic device may not be discovered. We fix this by probing on all NETDEV events if the device's netif_running state is up. Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* cnic: Randomize initial TCP port for iSCSI connectionsEddie Wai2011-10-031-5/+9
| | | | | | | | | | | | commit 11f23aa8ccd56786f0a6f04211cf59b3fab2ce08 upstream. This reduces the likelihood of port re-use when re-loading the driver. 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> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* cnic: Fix race conditions with firmwareMichael Chan2011-10-031-3/+11
| | | | | | | | | | | | | | | commit 101c40c8cb0d10c30f423805f9f5b7a75956832d upstream. During iSCSI connection terminations, if the target is also terminating at about the same time, the firmware may not complete the driver's request to close or reset the connection. This is fixed by handling other events (instead of the expected completion event) as an indication that the driver's request has been rejected. Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* cnic: Fix interrupt logicMichael Chan2011-10-031-9/+4
| | | | | | | | | | | | | | commit 93736656138e6d2f39f19c1d68f9ef81cfc9dd66 upstream. We need to keep looping until cnic_get_kcqes() returns 0. cnic_get_kcqes() returns a maximum of 64 entries. If there are more entries in the queue and we don't loop back, the remaining entries may not be serviced for a long time. Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* Add appropriate <linux/prefetch.h> include for prefetch usersPaul Gortmaker2011-05-221-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | After discovering that wide use of prefetch on modern CPUs could be a net loss instead of a win, net drivers which were relying on the implicit inclusion of prefetch.h via the list headers showed up in the resulting cleanup fallout. Give them an explicit include via the following $0.02 script. ========================================= #!/bin/bash MANUAL="" for i in `git grep -l 'prefetch(.*)' .` ; do grep -q '<linux/prefetch.h>' $i if [ $? = 0 ] ; then continue fi ( echo '?^#include <linux/?a' echo '#include <linux/prefetch.h>' echo . echo w echo q ) | ed -s $i > /dev/null 2>&1 if [ $? != 0 ]; then echo $i needs manual fixup MANUAL="$i $MANUAL" fi done echo ------------------- 8\<---------------------- echo vi $MANUAL ========================================= Signed-off-by: Paul <paul.gortmaker@windriver.com> [ Fixed up some incorrect #include placements, and added some non-network drivers and the fib_trie.c case - Linus ] Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* cnic: Fix rtnl deadlockMichael Chan2011-04-081-2/+0
| | | | | | | | | | | | | | | When cnic_stop_hw() -> cnic_cm_stop_bnx2x_hw() is called under rtnl_lock() from NETDEV_DOWN event, it waits for cnic_delete_task() to complete. It will deadlock when cnic_delete_task() takes rtnl_lock() before calling cnic_ulp_stop_one(). We fix it by removing the rtnl_lock() in cnic_delete_task(). cnic_ulp_stop_one() has mutex and atomic bit ops to prevent important operations from being done more than once, so it is not necessary to take rtnl_lock(). Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* bnx2x, cnic: Disable iSCSI if DCBX negotiation is successfulDmitry Kravkov2011-03-311-19/+45
| | | | | | | | | | | With current bnx2x firmware 6.2.9, iSCSI is not supported in DCB network, so we need to disable it. Add cnic command to disconnect iSCSI connections and prevent future connections when DCBX negotiation succeeds. Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com> Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* ipv6: Convert to use flowi6 where applicable.David S. Miller2011-03-121-6/+6
| | | | Signed-off-by: David S. Miller <davem@davemloft.net>
* net: Put flowi_* prefix on AF independent members of struct flowiDavid S. Miller2011-03-121-1/+1
| | | | | | | | | | I intend to turn struct flowi into a union of AF specific flowi structs. There will be a common structure that each variant includes first, much like struct sock_common. This is the first step to move in that direction. Signed-off-by: David S. Miller <davem@davemloft.net>
* ipv4: Create and use route lookup helpers.David S. Miller2011-03-121-11/+5
| | | | | | | The idea here is this minimizes the number of places one has to edit in order to make changes to how flows are defined and used. Signed-off-by: David S. Miller <davem@davemloft.net>
* Merge branch 'master' of ↵David S. Miller2011-03-031-8/+25
|\ | | | | | | | | | | | | master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6 Conflicts: drivers/net/bnx2x/bnx2x.h
| * cnic: Fix lost interrupt on bnx2xMichael Chan2011-03-021-8/+17
| | | | | | | | | | | | | | | | | | | | | | We service 2 queues (kcq1 and kcq2) in cnic_service_bnx2x_bh(). If the status block index has changed when servicing the kcq2, we must go back and check kcq1. The latest status block index will be used to acknowledge the interrupt, and without looping back to check kcq1, we may miss events on kcq1. Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
| * cnic: Prevent status block race conditions with hardwareMichael Chan2011-03-021-0/+8
| | | | | | | | | | | | | | | | | | The status block index is used to acknowledge interrupt events and must be read before checking for the interrupt events, so we need to add rmb() to guarantee that. Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* | ipv4: Make output route lookup return rtable directly.David S. Miller2011-03-021-2/+5
| | | | | | | | | | | | Instead of on the stack. Signed-off-by: David S. Miller <davem@davemloft.net>
* | net: use pci_dev->revision, againSergei Shtylyov2011-02-281-9/+5
| | | | | | | | | | | | | | | | | | | | | | | | Several more network drivers that read the device's revision ID from the PCI configuration register were merged after the commit 44c10138fd4bbc4b6d6bff0873c24902f2a9da65 (PCI: Change all drivers to use pci_device->revision), so it's time to do another pass of conversion to using the 'revision' field of 'struct pci_dev'... Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com> Acked-by: "John W. Linville" <linville@tuxdriver.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* | bnx2x, cnic: Consolidate iSCSI/FCoE shared mem logic in bnx2xVladislav Zolotarov2011-01-311-125/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Move all shared mem code to bnx2x to avoid code duplication. bnx2x now performs: - Read the FCoE and iSCSI max connection information. - Read the iSCSI and FCoE MACs from NPAR configuration in shmem. - Block the CNIC for the current function if there is neither FCoE nor iSCSI valid configuration by returning NULL from bnx2x_cnic_probe(). Signed-off-by: Vladislav Zolotarov <vladz@broadcom.com> Signed-off-by: Eilon Greenstein <eilong@broadcom.com> Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* | drivers/net: remove some rcu sparse warningsEric Dumazet2011-01-271-9/+18
|/ | | | | | | | | | Add missing __rcu annotations and helpers. minor : Fix some rcu_dereference() calls in macvtap Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com> Acked-by: Arnd Bergmann <arnd@arndb.de> Acked-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* cnic: Fix big endian bugMichael Chan2011-01-261-6/+6
| | | | | | | | | The chip's page tables did not set up properly on big endian machines, causing EEH errors on PPC machines. Reported-by: Breno Leitao <leitao@linux.vnet.ibm.com> Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* cnic: Fix the type field in SPQ messagesMichael Chan2011-01-061-21/+12
| | | | | | | | | | The new firmware interface requires each Slow Path Queue (SPQ) message's type field to include the function number. The existing code does not do this consistently. We fix this by OR'ing in the function number into the type field centrally in cnic_submit_kwqe_16(). Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* Merge branch 'master' of ↵David S. Miller2011-01-041-2/+8
|\ | | | | | | master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
| * Broadcom CNIC core network driver: fix mem leak on allocation failures in ↵Jesper Juhl2010-12-311-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | cnic_alloc_uio_rings() We are leaking memory in drivers/net/cnic.c::cnic_alloc_uio_rings() if either of the calls to dma_alloc_coherent() fail. This patch fixes it by freeing both the memory allocated with kzalloc() and memory allocated with previous calls to dma_alloc_coherent() when there's a failure. Thanks to Joe Perches <joe@perches.com> for suggesting a better implementation than my initial version. Signed-off-by: Jesper Juhl <jj@chaosbits.net> Acked-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* | cnic: Do not call bnx2i when bnx2i is calling cnic_unregister_driver()Michael Chan2011-01-031-16/+3
| | | | | | | | | | | | | | | | | | | | | | | | We should call bnx2i to send the iSCSI netlink message earlier in cnic_unregister_device(). By the time cnic_unregister_driver() is called, bnx2i may have freed data structures used by the upcalls. Update version to 2.2.12. Reviewed-by: Benjamin Li <benli@broadcom.com> Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* | cnic: Do not allow iSCSI and FCoE on bnx2x multi-function modeMichael Chan2011-01-031-6/+2
| | | | | | | | | | | | | | | | Because the hardware does not yet support these in this mode. Reviewed-by: Benjamin Li <benli@broadcom.com> Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* | cnic: Add FCoE support on 57712Michael Chan2010-12-231-7/+459
| | | | | | | | | | | | | | | | | | | | - Connection ID (cid) management - Slow-path command and response support - Update version to 2.2.11. Reviewed-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com> Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* | cnic: Add kcq2 support on 57712Michael Chan2010-12-231-21/+55
| | | | | | | | | | | | | | The kcq2 (2nd kernel work queue) is used by FCoE on 57712 devices. Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* | cnic: Call cm_connect_complete() immediately on errorEddie Wai2010-12-231-2/+14
| | | | | | | | | | | | | | | | | | If we get a path_resp error from userspace, call cm_connect_complete() immediately with error so that bnx2i can react to the error faster. Signed-off-by: Eddie Wai <waie@broadcom.com> Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* | cnic: Check device state before reading the kcq pointer in IRQMichael Chan2010-12-231-5/+7
| | | | | | | | | | | | | | If the device is down, the kcq pointer may be NULL. Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* | cnic: Support NIC Partition modeMichael Chan2010-12-231-18/+66
| | | | | | | | | | | | | | | | | | | | Add a common function cnic_read_bnx2x_iscsi_mac() to read the iSCSI MAC address at any specified shared memory location. In NIC Partition mode, we need to get the MAC address from the MF_CFG area of shared memory. Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* | cnic: Use proper client and connection IDs on iSCSI ringMichael Chan2010-12-231-9/+12
| | | | | | | | | | | | | | | | Use the IDs specified by the bnx2x driver when initializing the ring. We don't have to make code changes when these IDs change in the future. Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* | cnic: Improve ->iscsi_nl_msg_send()Michael Chan2010-12-231-5/+16
| | | | | | | | | | | | | | | | | | | | | | | | 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>
* | cnic: Prevent "scheduling while atomic" when calling ->cnic_init()Michael Chan2010-12-231-2/+1
| | | | | | | | | | | | | | | | | | cnic_dev_list is protected by rtnl_lock and cnic_dev_lock spin_lock during modifications. When looping on cnic_dev_list and calling ->cnic_init(), we should just hold rtnl_lock since ->cnic_init() may sleep. Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* | cnic: Fix iSCSI TCP port endian order.Michael Chan2010-12-231-10/+13
| | | | | | | | | | | | | | | | Pass the TCP port parameter for iSCSI connections to the firmware in proper endian order. Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* | drivers/net/cnic.c: Remove unnecessary semicolonsJoe Perches2010-11-151-1/+1
|/ | | | | Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* cnic: Add support for 57712 deviceMichael Chan2010-10-141-15/+79
| | | | | | | | | | Add new interrupt ack functions and other hardware interface logic to support the new device. Update version to 2.2.6. Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* cnic: Decouple uio close from cnic shutdownMichael Chan2010-10-141-14/+42
| | | | | | | | | | | | | | | | | | | During cnic shutdown, the original driver code requires userspace to close the uio device within a few seconds. This doesn't always happen as the userapp may be hung or otherwise take a long time to close. The system may crash when this happens. We fix the problem by decoupling the uio structures from the cnic structures during cnic shutdown. We do not unregister the uio device until the cnic driver is unloaded. This eliminates the unreliable wait loop for uio to close. All uio structures are kept in a linked list. If the device is shutdown and later brought back up again, the uio strcture will be found in the linked list and coupled back to the cnic structures. Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* cnic: Add cnic_uio_dev structMichael Chan2010-10-141-90/+105
| | | | | | | | and put all uio related structures and ring buffers in it. This allows uio operations to be done independent of the cnic device structures. Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* cnic: Add cnic_free_uio()Michael Chan2010-10-141-10/+27
| | | | | | | to free all UIO related structures. Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* cnic: Defer iscsi connection cleanupMichael Chan2010-10-141-4/+106
| | | | | | | | | | | | | The bnx2x devices require a 2 second quiet time before sending the last RAMROD command to destroy a connection. This sleep wait adds up to a long delay when iscsid is serially destroying maultiple connections. Create a workqueue to perform the final connection cleanup in the background to speed up the process. This significantly speeds up the process as the wait time can be done in parallel for multiple connections. Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* cnic: Add cnic_bnx2x_destroy_ramrod()Michael Chan2010-10-141-14/+25
| | | | | | | Refactoring code for the next patch to defer connection clean up. Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* cnic: Convert ctx_flags to bit fieldsMichael Chan2010-10-141-2/+2
| | | | | | | so that we can additional bit definitions without requiring a spinlock. Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* cnic: Add common cnic_request_irq()Michael Chan2010-10-141-12/+20
| | | | | | | | to reduce some duplicate code. Also, use tasklet_kill() in cnic_free_irq() to wait for the cnic_irq_task to complete. Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* bnx2x, cnic: Fix SPQ return creditDmitry Kravkov2010-10-061-8/+10
| | | | | | | | | | Return proper L2 and L5 SPQ (slow path queue) credits. Previously, all SPQ events were counted as L5 types. 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>
* bnx2x, cnic, bnx2i: use new FW/HSIDmitry Kravkov2010-10-061-147/+138
| | | | | | | | | | | | | | | | 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>
* cnic: Fine-tune ring init code.Michael Chan2010-10-061-6/+18
| | | | | | | | | | Initialize the rings only during cnic_uio_open() and shut them down during cnic_uio_close(). Check for the new bit CNIC_LCL_FL_RINGS_INITED before checking for ring interrupt. Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* cnic: Use pfid for internal memory offsets.Michael Chan2010-10-061-70/+74
| | | | | | | | | | The pfid (physical function ID) is the same as PCI function on production devices. The pfid for future devices will be different and will be used for internal memory offsets. Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* cnic: Pass cp pointer to BNX2X_HW_CID.Michael Chan2010-10-061-8/+5
| | | | | | | | Preparation work for upcoming firmware interface changes. Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* drivers/net: Convert unbounded kzalloc calls to kcallocJoe Perches2010-08-171-1/+1
| | | | | | | | | | | | | These changes may be slightly safer in some instances. There are other kzalloc calls with a multiply, but those calls are typically "small fixed #" * sizeof(some pointer)" and those are not converted. Signed-off-by: Joe Perches <joe@perches.com> Acked-by: Gertjan van Wingerde <gwingerde@gmail.com> Acked-by: Luciano Coelho <luciano.coelho@nokia.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* bnx2x: Create separate folder for bnx2x driverDmitry Kravkov2010-07-271-3/+3
| | | | | | | | | | | | | | | | | | This commit includes files movement to newly created folder using git-mv command and fixes references in cnic and bnx2x code to each other. files moved using following: #!/bin/bash mkdir drivers/net/bnx2x/ list=$(cd drivers/net/ && ls bnx2x*.[ch]) for f in $list; do git mv -f drivers/net/$f drivers/net/bnx2x/$f done Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com> Signed-off-by: Eilon Greenstein <eilong@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* cnic: Further unify kcq handling code.Michael Chan2010-06-251-37/+34
| | | | | | | | This eliminates some of the duplicate code for the various devices that require the same basic kcq handling. Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>