summaryrefslogtreecommitdiffstats
path: root/drivers/net/cnic.c
Commit message (Collapse)AuthorAgeFilesLines
* 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>
* cnic: Restructure kcq processing.Michael Chan2010-06-251-54/+22
| | | | | | | | By doing more work in the common function cnic_get_kcqes(), and making full use of the kcq_info structure. Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* cnic: Unify kcq allocation for all devices.Michael Chan2010-06-251-56/+87
| | | | | | | | | By creating a common data stucture kcq_info for all devices, the kcq (kernel completion queue) for all devices can be allocated by common code. Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* cnic: Unify IRQ code for all hardware types.Michael Chan2010-06-251-13/+20
| | | | | | | By creating a common cnic_doirq(). Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* cnic: Fine-tune CID memory space calculation.Michael Chan2010-06-251-14/+18
| | | | | | | | | | | | The current code makes assumptions about the CID (context ID) memory space and starting CID that may not be always correct when firmware changes. In particular, BNX2_ISCSI_START_CID may not always be fixed. We now calculate cp->max_cid_space and cp->iscsi_start_cid dynamically instead of using fixed constants. The unused cp->max_iscsi_conn is also eliminated. Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* Merge branch 'master' of ↵David S. Miller2010-06-231-21/+34
|\ | | | | | | | | | | | | master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6 Conflicts: net/ipv4/ip_output.c
| * cnic: Disable statistics initialization for eth clients that do not support ↵Dmitry Kravkov2010-06-231-21/+34
| | | | | | | | | | | | | | | | | | | | | | statistics Disable statistics initialization for eth clients that do not support statistics. This prevents memory corruption on bnx2x hw. Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com> Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
* | cnic: Fix cnic_cm_abort() error handling.Michael Chan2010-06-151-11/+18
| | | | | | | | | | | | | | | | | | | | | | Fix the code that handles the error case when cnic_cm_abort() cannot proceed normally. We cannot just set the csk->state and we must go through cnic_ready_to_close() to handle all the conditions. We also add error return code in cnic_cm_abort(). Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: Eddie Wai <waie@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* | cnic: Refactor and fix cnic_ready_to_close().Michael Chan2010-06-151-16/+10
| | | | | | | | | | | | | | | | | | | | | | Combine RESET_RECEIVED and RESET_COMP logic and fix race condition between these 2 events and cnic_cm_close(). In particular, we need to (test_and_clear_bit(SK_F_OFFLD_COMPLETE, &csk->flags)) before we update csk->state. Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: Eddie Wai <waie@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* | cnic: Refactor code in cnic_cm_process_kcqe().Michael Chan2010-06-151-6/+9
| | | | | | | | | | | | | | | | | | Move chip-specific code to the respective chip's ->close_conn() functions for better code organization. Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: Eddie Wai <waie@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* | cnic: Return error code in cnic_cm_close() if unsuccessful.Michael Chan2010-06-151-0/+2
| | | | | | | | | | | | | | | | | | So that bnx2i can handle the error condition immediately and not have to wait for timeout. Signed-off-by: Michael Chan <mchan@broadcom.com. Signed-off-by: Eddie Wai <waie@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* | net-next: remove useless union keywordChangli Gao2010-06-101-1/+1
|/ | | | | | | | | | remove useless union keyword in rtable, rt6_info and dn_route. Since there is only one member in a union, the union keyword isn't useful. Signed-off-by: Changli Gao <xiaosuo@gmail.com> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* cnic: Fix context memory init. on 5709.Michael Chan2010-05-281-7/+3
| | | | | | | | | | | | We need to zero context memory on 5709 in the function cnic_init_context(). Without this, iscsid restart on 5709 will not work because of stale data. TX context blocks should not be initialized by cnic_init_context() because of the special remapping on 5709. Update version to 2.1.2. Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* cnic: Return SPQ credit to bnx2x after ring setup and shutdown.Michael Chan2010-05-181-1/+70
| | | | | | | | | | | | | Everytime the iSCSI ring finishes setup or shutdown, we need to return the SPQ (slow path queue) credit to the bnx2x driver. Without this step, the SPQ will eventually be full causing iSCSI to fail. This can happen after 3 or 4 MTU changes for example. Add code to wait for these slow path commands to complete in the RX ring and return the SPQ credit to bnx2x. Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* cnic: Convert cnic_local_flags to atomic ops.Michael Chan2010-05-181-3/+3
| | | | | | | | | It is easier to expand the flags for other purposes because it does not require a spin_lock. The next bug fix patch needs a flag in cnic_local_flags. Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* drivers/net: Remove unnecessary returns from void function()sJoe Perches2010-05-141-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>
* cnic: Fix crash during bnx2x MTU change.Michael Chan2010-04-071-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>
* cnic: Update version to 2.1.1.Michael Chan2010-02-261-1/+1
| | | | | | | And update copyright to 2010. Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* cnic: Use union for the status blocks of different devices.Michael Chan2010-02-261-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>
OpenPOWER on IntegriCloud