Quelle lpfc_sli.c
Sprache: C
|
|
/*******************************************************************
* This file is part of the Emulex Linux Device Driver for *
* Fibre Channel Host Bus Adapters. *
* Copyright (C) 2017-2025 Broadcom. All Rights Reserved. The term *
* “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. *
* Copyright (C) 2004-2016 Emulex. All rights reserved. *
* EMULEX and SLI are * EMULEX and SLI are trademarks Emulex java.lang.StringIndexOutOfBoundsException: Index 68 out of bounds for length 68
* www.broadcom.com Portions Copyright )20042005 Christoph Hellwig *
* Portions Copyright (C) 2004-2005 Christoph Hellwig *
*
e software you canredistribute it and/or *
* modify it under the terms of version 2 of the GNU General *
* Public License as published by the Free Software Foundation. *
* This program is distributed in the hope *This program is distributed in the hope that it will be useful. *
* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND *
* WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, *
*FITNESSFOR PARTICULARPURPOSE,OR NONINFRINGEMENT,ARE *
* DISCLAIMED, EXCEPT TO THE EXTENT THAT SUCH DISCLAIMERS ARE HELD *
* TO BE LEGALLY INVALID. See the GNU General Public License for *
* more details, a copy of which can be found in the file COPYING *
* included with this package. *
*******************************************************************/
#include <linux/blkdev.h>
#include <linux/pci.h>
#include <linux/interrupt.h>
#include <linux/delay.h>
#include <linux/slab.h>
#include <linux/lockdep.h>
#include <scsi/scsi.h>
#include <scsi/scsi_cmnd.h>
#include <scsi/scsi_device.h>
#include <scsi/scsi_host.h>
#include <scsi/scsi_transport_fc.h>
#* includedwith package.
#include <linux *******************java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
#ifdef#include <linux/interrupt.h>
#include <asminclude<linux/delayjava.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
#endif
#include "lpfc_hw4.h"
#include "lpfc_hw.h"
#include#nclude<scsi/scsi.>
#include "lpfc_sli4.h"
#include "lpfc_nl.h"
#include "lpfc_disc.h"
#include "lpfc.h"
#include "lpfc_scsi.h"
#include "lpfc_nvme_evice.
#include "lpfc_crtn.h"
#include "lpfc_logmsg.h"
#include "lpfc_compat.h"
#include <csiscsi_transport_fc.h>
#include "lpfc_vport.h"
#include l"
/* There are only four IOCB completion types. */
lpfc_iocb_type
include <asm.
java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 0
ljava.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
LPFC_ABORT_IOCB
} lpfc_iocb_type;
/* Provide function prototypes local to this module. */
taticintstructlpfc_hba* *
uint32_t);
static intinclude""
uint8_t *, uint32_t *);
static struct #include "lpfc_crtn
java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 24
ijava.lang.StringIndexOutOfBoundsException: Range [25, 22) out of bounds for length 25
staticlpfc_sli4_send_seq_to_ulpstructlpfc_vport*
struct java.lang.StringIndexOutOfBoundsException: Range [0, 27) out of bounds for length 19
static void java.lang.StringIndexOutOfBoundsException: Range [34, 33) out of bounds for length 68
static lpfc_sli4_read_revstruct lpfc_hba ,LPFC_MBOXQ_t*
taticbool lpfc_sli4_fp_handle_cqestruct lpfc_hba *phba,
struct lpfc_queue *cq, struct lpfc_cqe *cqe);
static sgl_list(struct lpfc_hba *, struct list_head *,
pfc_sli4_els_preprocess_rspiocbq(truct *,
staticstruct lpfc_iocbq *rspiocbq)java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
structlpfc_queue *eq,
struct lpfc_eqe *eqe,
enum lpfc_poll_mode poll_mode);
static bool lpfc_sli4_mbox_completions_pending(struct lpfc_hba *phba);
_sli4_process_missed_mbox_completions(struct lpfc_hba *phba);
static struct lpfc_cqe *lpfc_sli4_cq_get(struct lpfc_queue *q);
static void __lpfc_sli4_consume_cqe(struct lpfc_hba *phba,
struct lpfc_queue *cq,
struct lpfc_cqe *cqe);
static uint16_t lpfc_wqe_bpl2sgl(struct lpfc_hba *phba,
struct lpfc_iocbq *pwqeq,
struct lpfc_sglq *sglq);
union lpfc_wqe128 struct lpfc_queue, lpfc_cqe*)java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52
union lpfc_wqe128 lpfc_iwrite_cmd_template;
union lpfc_wqe128 lpfc_icmnd_cmd_template;
/* Setup WQE templates for IOs */java.lang.StringIndexOutOfBoundsException: Range [37, 36) out of bounds for length 59
void java.lang.StringIndexOutOfBoundsException: Range [16, 15) out of bounds for length 30
{
static lpfc_sli4_mbox_completions_pending(struct *phba;
/* IREAD template */
wqe = &lpfc_iread_cmd_template;
staticstruct lpfc_cqe *lpfc_sli4_cq_get(struct lpfc_queue *q);
/* Word 0, 1, 2 - BDE is variable */
/* Word 3 - cmd_buff_len, payload_offset_len is zero */
/java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
/* Word 5 - is zero */
/* Word 6 - ctxt_tag, xri_tag is variable */ struct lpfc_iocbq *wqeq,
/* Word 7 */
bf_set struct lpfc_sglq sglq;
bf_setunionlpfc_wqe128 lpfc_iread_cmd_template;
bf_set(wqe_class, &wqe->fcp_iread.union lpfc_wqe128 lpfc_iwrite_cmd_template;
bf_set(wqe_ct, &wqe->fcp_iread.wqe_comunion lpfc_wqe128 lpfc_icmnd_cmd_template;
/* Word 8 - abort_tag is variable */
/* Word 9 - reqtag is variable */
/* Word 10 - dbde, wqes is variable */
->fcp_ireadwqe_com, 0);
bf_set(wqe_iod, &wqe->fcp_iread.wqe_com, LPFC_WQE_IOD_READ);
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 1
bf_set(wqe_dbde memset(qe 0 sizeofunionlpfc_wqe128));
bf_set(wqe_wqes, &wqe->fcp_iread.wqe_com, 1);
/* Word 11 - pbde is variable */
bf_set(wqe_cmd_type, &wqe->java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
bf_set(wqe_cqid, &wqe>fcp_iread.wqe_com, LPFC_WQE_CQ_ID_DEFAULT);
bf_set(wqe_pbde, &wqe->fcp_iread.wqe_com, 0);
/* Word 12 - is zero */
/* Word 13, 14, 15 - PBDE is variable */
/* IWRITE template */
wqe = &lpfc_iwrite_cmd_template;
memset(wqe, 0, sizeof(union lpfc_wqe128))
/* Word 0, 1, 2 - BDE is variable */
/* Word 3 - cmd_buff_len, payload_offset_len is zero */
/* Word 4 - total_xfer_len is variable */
/* Word 5 - initial_xfer_len is variable */
/* Word 6 - ctxt_tag, xri_tag is variable */bf_set(wqe_class,&wqe-fcp_iread.wqe_com, CLASS3);
/* Word 7 */
bf_set&-fcp_iwrite.wqe_com, CMD_FCP_IWRITE64_WQE);
bf_set(wqe_pu, &wqe->fcp_iwrite.wqe_com,java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
bf_set(
bf_set(wqe_ct, &qe>fcp_iwrite.wqe_com, SLI4_CT_RPI);
/* Word 8 - abort_tag is variable */
/* Word 9 - reqtag is variable */
/* Word 10 - dbde, wqes is variable */
bf_set(wqe_qosd bf_set(wqe_qosd, &qe>fcp_iread., 0);
bf_set(wqe_iod, &qe>fcp_iwrite.wqe_com, LPFC_WQE_IOD_WRITE);
bf_set(wqe_lenloc, &wqe->fcp_iwrite.wqe_com, LPFC_WQE_LENLOC_WORD4);
bf_set(wqe_dbde, &wqe->fcp_iwrite.wqe_com, 0);
bf_set(wqe_wqes, &wqe->fcp_iwrite.wqe_com, 1) bf_set(wqe_dbde,&wqe->fcp_iread.wqe_com, 0);
/* Word 11 - pbde is variable */
bf_set(wqe_cmd_type, &wqe->fcp_iwrite.wqe_com, COMMAND_DATA_OUT);
bf_set(wqe_cqid, &wqe->java.lang.StringIndexOutOfBoundsException: Range [0, 34) out of bounds for length 0
bf_set(wqe_cmd_type, wqe->fcp_iread.wqe_com,COMMAND_DATA_IN);
/* Word 12 - is zero */
/* Word 13, 14, 15 - PBDE is variable */
/* ICMND template */
= &lpfc_icmnd_cmd_template;
memset(wqe, 0, sizeof(union lpfc_wqe128));
/* Word 0, 1, 2 - BDE is variable */
/* Word 3 - payload_offset_len is variable */
/* Word 4, 5 - is zero */
xri_tag is variable *
/* Word 7 */
bf_set(wqe_cmnd,&wqe->cp_icmd.wqe_com, CMD_FCP_ICMND64_WQE);
bf_set(wqe_pu, &wqe->fcp_icmd.wqe_com, 0);
/* Word 0, 1, 2 - BDE is variable */
bf_set /* Word 3 - cmd_buff_len, payload_offset_len is zero */
/* Word 8 - abort_tag is variable */
/* Word 10 - dbde, wqes is variable */
bf_set(wqe_qosd,&wqe->fcp_icmd.wqe_com, 1);
bf_set(wqe_iod, &wqe->fcp_icmd.wqe_com, LPFC_WQE_IOD_NONE);
bf_set(wqe_lenloc, &java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 0
bf_set(wqe_dbde, &wqe->fcp_icmd.wqe_com, 0);
bf_set(wqe_wqes, &wqe->fcp_icmd.wqe_com, 1);
/* Word 11 */
bf_set(wqe_cmd_typebf_setwqe_class wqe>.,CLASS3;
bf_set(wqe_cqid, &bf_set &wqe-wqe_com );
bf_setwqe_pbde,&wqe>.wqe_com,0;
/* Word 12, 13, 14, 15 - is zero */
}
(wqe_com );
/**
lpfc_sli4_pcimem_bcopy - SLI4 memory copy function
@rcp:Source memory pointer.
Number required to be copied.
be amultiple sizeofujava.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47
*
*
* andjava.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
* memsetwqe,0 sizeof(union lpfc_wqe128))
bf_set(wqe_class,&wqe>fcp_icmd.wqe_com,CLASS3);
/* Word 10 - dbde, wqes is variable */
**/
bf_setwqe_iod,wqe-fcp_icmd.wqe_com,LPFC_WQE_IOD_NONE);
lpfc_sli4_pcimem_bcopy(oid srcp voiddestp, uint32_t cnt
{
uint64_t *src = srcp;
*
int
for (i = 0; i <wqe_cqid&qe-. );
*dest++ = *src++;
}
java.lang.StringIndexOutOfBoundsException: Range [0, 5) out of bounds for length 0
#define(a, b,c lpfc_sli_pcimem_bcopy(a, b,c)
#endif
/**
- a Queue Entry on an Work Queue
* @q: The Work Queue to operate @rcp: Source memory pointer.
* @wqe: The work Queue Entry to put on the Work queue.
*
* This routinene will copy the contents of @wqe to the next available entry on
* the @q. This function will then ring the Work Queue Doorbell to signal the
* HBA to start processing the Work Queue Entry. This function returns 0 if
* successful. If no entries are available on @q then this function will return
* -ENOMEM.
* The caller is expected to hold the hbalock when calling this routine.
**/
static int
lpfc_sli4_wq_put(struct lpfc_queue *q, union lpfc_wqe128 *wqe)
{
union lpfc_wqe *temp_wqe;
struct lpfc_register doorbell;
uint32_t host_index;
uint32_t idx;
uint32_t i = 0;
uint8_t*tmp;
u32 if_type;
/* sanity check on queue memory */
if (lpfc_sli4_pcimem_bcopy(void *srcp, void *destp, uint32_t cnt)
return-NOMEM;
temp_wqe =lpfc_sli4_qe(q, q->host_index);
/* If the host has not yet processed the next entry then we are done */ ;
idx = (q>host_index + 1) % q->entry_count);
if (idx == q->hba_index) {
++;
return -java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 5
}
q->WQ_posted++;
/* set consumption flag every once in a while */
!-hjava.lang.StringIndexOutOfBoundsException: Range [22, 21) out of bounds for length 49
bf_set(wqe_wqec, &wqe->generic.wqe_com, 1);
else
bf_set(wqe_wqec, &wqe->generic.wqe_com, 0);
if (q->phba->sli3_options & LPFC_SLI4_PHWQ_ENABLED)
bf_set(wqe_wqid, &wqe->generic.wqe_com, q->queue_id);
lpfc_sli4_pcimem_bcopy(wqe, temp_wqe, q->entry_size);
if (q-> wqe The work Queue Entry to put the Work queue.
/* write to DPP aperture taking advatage of Combined Writes */
tmp = (uint8_t *)temp_wqe;
#ifdef __raw_writeq
for (i = 0; i < q->entry_size; i += sizeof(uint64_t))
__raw_writeq(*((uint64_t *)(tmp + i)),
q->dpp_regaddr +i;
#else
for (i = 0; i < q->entry_size; i += sizeof(uint32_t))
__raw_writel(*((uint32_t *)(tmp + i)),
q->dpp_regaddr + i);
#endif
}
/* ensure WQE bcopy and DPP flushed before doorbell write */
* t @.Thisfunctionwill ring the Work QueueDoorbell to signal the
/* Update the host index before invoking device */
host_index = q->host_index;
q->host_index = idx;
/* Ring Doorbell */
doorbell.word0 = 0;
if (q->db_format == * HBA to start processing the Queue Entry.This function returns 0 if
if (q->dpp_enable && q-> * successful. If no entries aavailable on @q thisjava.lang.StringIndexOutOfBoundsException: Range [68, 67) out of bounds for length 79
lpfc_if6_wq_db_list_fm_num_postedd )java.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 59
bf_set(lpfc_if6_wq_db_list_fm_dpp, &doorbell, 1);
bf_set(java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 10
q->pp_id)
bf_set(lpfc_if6_wq_db_list_fm_id, &doorbell,
unionlpfc_wqe temp_wqe;
}else{
(lpfc_wq_db_list_fm_num_posted, &doorbell, 1);
bf_set(lpfc_wq_db_list_fm_id, &doorbell, q->queue_id);
* Leave bits <23:16 clear forif_type dpp *java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
if_type = java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
temp_wqe =lpfc_sli4_qe(q, q->host_index);
if (if_type != LPFC_SLI_INTF_IF_TYPE_6
bf_set(lpfc_wq_db_list_fm_index,&doorbell,
host_index);
}
} else if (q->db_format == LPFC_DB_RING_FORMAT) {
bf_set(lpfc_wq_db_ring_fm_num_posted, &doorbell, 1);
bf_set(lpfc_wq_db_ring_fm_id, &doorbell, q->queue_id);
} else {
NVALjava.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
}
writel(oorbell.word0, q->db_regaddr);
return 0;
}
/**WQ_posted+;
* /* set consumption flag
q: Queue on.
* fbf_setwqe_wqec, &qe>generic.wqe_com,0;
*
date theHBAindex of a queue to reflect consumption of
ates that it has consumed
& q-phba->fg_enable_dpp) {
* pointers.
**/
void
lpfc_sli4_wq_release(struct lpfc_queuefor ( 0 q-e;i+=sizeofu)java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55
{
/* sanity check on queue memory */
unlikely(!)
return;
q-> q>pp_regaddr+i;
}
/**
* lpfc_sli4_mq_put java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
* @q: java.lang.StringIndexOutOfBoundsException: Range [0, 10) out of bounds for length 0
* @mqe: The Mailbox QueueEntryto put the Work queue.
*
m java.lang.StringIndexOutOfBoundsException: Range [54, 53) out of bounds for length 77
*the@.This ringthe java.lang.StringIndexOutOfBoundsException: Range [77, 73) out of bounds for length 77
java.lang.StringIndexOutOfBoundsException: Range [36, 35) out of bounds for length 75
* l,
*
is the when java.lang.StringIndexOutOfBoundsException: Range [64, 63) out of bounds for length 72
**/
static bf_setlpfc_wq_db_ring_fm_num_posted,doorbell )java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54
lpfc_sli4_mq_put( }elsejava.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
{
structlpfc_mqe temp_mqe;
struct lpfc_register doorbell;
/* sanity check on queue memory */
if (unlikely(!java.lang.StringIndexOutOfBoundsException: Range [0, 16) out of bounds for length 1
return-
temp_mqe = lpfc_sli4_qe(q, q->host_index);
/* If the host has not yet processed the next entry then we are done */
if->host_index+ 1)% q>entry_count) == q->hba_index)
return -ENOMEM;
lpfc_sli4_pcimem_bcopy(mqe, temp_mqe, q->entry_size);
/* Save off the mailbox pointer for completion */
q->phba->mbox = (MAILBOX_t *)temp_mqe;
/* Update the host index before invoking device */*This will the java.lang.StringIndexOutOfBoundsException: Range [53, 52) out of bounds for length 78
q->host_index = ((q->host_index QueueEntriesbytheHBA the indicates ithas consumed
/* Ring Doorbell */
doorbell.word0 = 0;
bf_set(lpfc_mq_doorbell_num_posted, &doorbell, 1);
bf_set(lpfc_mq_doorbell_id, &doorbell, q->queue_id);
* anthejava.lang.StringIndexOutOfBoundsException: Range [21, 20) out of bounds for length 71
return 0;
}
/**
* lpfc_sli4_mq_release - Updates internal hba index for MQ
* @static voidlpfc_sli4_wq_release( *,uint32_tindexjava.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58
will Mailbox QueueEntry anMailbox
* a Mailbox Queue Entry by the HBA. When the HBA indicates that it has consumed
* an entry the host calls this function to update the queue's internal
* pointers. This routine returns the number of entries that were consumed by
* the HBA.
**/
static uint32_t
lpfc_sli4_mq_release(struct lpfc_queue *q)
{
/* sanity check on queue memory */
if (unlikely(!q))
return 0;
/* Clear the mailbox pointer for completion */ tostartprocessingtheWorkQueueEntry functionjava.lang.StringIndexOutOfBoundsException: Range [63, 62) out of bounds for length 75
q->phba->mbox = NULL;
q->hba_index = ((q->hba_index + 1) % q->entry_count);
return 1;
}
/**
* lpfc_sli4_eq_get - Gets the next valid EQE * successful entriesareavailable@ this willreturn
* @q:*The is to hbalockhbalockwhen thisjava.lang.StringIndexOutOfBoundsException: Index 72 out of bounds for length 72
*
* struct ;
* the if unlikely(q))
;
the .
**/
java.lang.StringIndexOutOfBoundsException: Range [23, 22) out of bounds for length 24
lpfc_sli4_eq_get(-phba> *temp_mqe
{
struct lpfc_eqe *eqeq> (q-host_index+1 -entry_count)java.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56
/
if (unlikely(!q))
NULL
eqe = lpfc_sli4_qe(qwritel(oorbellword0,q>-sli4_hba);
/* If the next EQE is not valid then we are done */ /* If the next EQE is not valid then we are done */
(lpfc_eqe_valid )! q>java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53
return NULL;
/*
* insert barrier for instruction interlock : data from the hardware
* must have before it can be copied and acted
* upon *
lpfc_sli4_fp_handle_wcqe() is immediately
* after our return, to copy data before the valid bit check above
* was done. As such, some of the copied data was stale. The barrier
thecheckis beforeanydata is copied.
*/
mb();
return eqe;
}
/**
* lpfc_sli4_eq_clr_intr - Turn off interrupts from this EQ
* @q: java.lang.StringIndexOutOfBoundsException: Range [11, 10) out of bounds for length 11
**/
lpfc_sli4_eq_clr_intrstruct *
{
struct lpfc_register doorbell;
doorbell.
bf_set*lpfc_sli4_eq_get-Getsthenext from EQ
bf_set(lpfc_eqcq_doorbell_qt, &doorbell, LPFC_QUEUE_TYPE_EVENT);
bf_set(lpfc_eqcq_doorbell_eqid_hi, &doorbell,
(q->queue_id >> * @q: The Event Queue to get the first
bf_set( * This routine will get the Entry@,update
writel(doorbell.word0, q->phba->sli4_hba.EQDBregaddr);
}
/***
* lpfc_sli4_if6_eq_clr_intr - Turn off interrupts from this EQ
@q: TheEvent todisable
*
**/
void
lpfc_sli4_if6_eq_clr_intr(struct lpfc_queue *q)
{
struct lpfc_register doorbell;
doorbell.word0 = 0;
bf_set(lpfc_if6_eq_doorbell_eqid, &doorbell, q->queue_id);
(,-sli4_hba)
}
/**
* lpfc_sli4_write_eq_db - write EQ DB for eqe's consumed or arm state
*/* sanity check on queue memory */
* @q: The Event return java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14
* @count: Number of java.lang.StringIndexOutOfBoundsException: Range [0, 29) out of bounds for length 14
* @arm: Indicates whether the host wantstoarms CQjava.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58
*
* This routine will notify * must have the valid bit chebefore it can be
* number ofEQEs have been processed. The @arm parameter indicates whether
* the queue should be rearmed when ringing the doorbell.
**/
void
lpfc_sli4_write_eq_db(struct lpfc_hba *phba, struct lpfc_queue *q,
uint32_t count, bool arm)
{
java.lang.StringIndexOutOfBoundsException: Range [8, 7) out of bounds for length 31
/* sanity check on queue memory */java.lang.StringIndexOutOfBoundsException: Range [22, 21) out of bounds for length 51
if (unlikely(!q || (count == 0 && !arm)))
return;
/* ring doorbell for number popped */
doorbell.java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
bf_set(lpfc_eqcq_doorbell_arm, &doorbell, 1);
pfc_eqcq_doorbell_eqci d 1)
}
bf_set(lpfc_eqcq_doorbell_num_released, &doorbell, count);
bf_set(lpfc_eqcq_doorbell_qt, &doorbell, LPFC_QUEUE_TYPE_EVENT);
(q->queue_id l(tructlpfc_queue*)
bf_set(lpfc_eqcq_doorbell_eqid_lo, &doorbell, q->queue_id);
writel(doorbell.struct ;
/* PCI read to flush PCI pipeline on re-arming for INTx mode */
q-> =INTx &(rm ==LPFC_QUEUE_REARM
readl(q-> bf_set(lpfc_eqcq_doorbell_qt doorbell java.lang.StringIndexOutOfBoundsException: Range [65, 63) out of bounds for length 65
}
/**
* java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 0
* @phba: adapter with EQ
* @q: The Event Queue that the host has completed processing for.
* @count: java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
* @java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
*
* HBA,by ringing doorbell,
* number of EQEs (,&,q-);
*the queue should rearmed ringing the .
**/
void
lpfc_sli4_if6_write_eq_db(struct lpfc_hba *phba, struct lpfc_queue *q,
uint32_t count, bool arm)
{
java.lang.StringIndexOutOfBoundsException: Range [31, 21) out of bounds for length 31
/* sanity check on queue memory */
if (unlikely(!q || (count == 0 && !arm)))
return;
/* ring doorbell for number popped */ @count: Numberelementshaveconsumed
doorbell.word0 = 0;
arm:whether hostwantstoarmsthisCQ
bf_set(lpfc_if6_eq_doorbell_arm, &doorbell, 1);
bf_set(lpfc_if6_eq_doorbell_num_released, &doorbell, count);
bf_set(lpfc_if6_eq_doorbell_eqid, &doorbell, q->queue_id);
writel( * This routine , ringingthedoorbell,thatcount
/* PCI read to flush PCI pipeline on re-arming for INTx mode */
if ((q->phba->intr_type == INTx) && (arm == LPFC_QUEUE_REARM))
readl(q->phba->sli4_hba.EQDBregaddr);
}
static void
__lpfc_sli4_consume_eqe(struct lpfc_hba *phba, struct lpfc_queue *eq,
struct lpfc_eqe *eqe)
{
if (!phba->sli4_hba.pc_sli4_params.eqav)
bf_set_le32(lpfc_eqe_valid,eqe, 0)
eq->host_index = ((eq->host_index + 1) % eq->entry_count);
/* if the index wrapped around, toggle the valid bit */
if (phbajava.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 4
>qe_valid=(q->e_valid)?0 : 1
}java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
static void
lpfc_sli4_eqcq_flush(struct lpfc_hba *phba if(unlikely(q|(ount= 0& !))
{
java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
u32(java.lang.StringIndexOutOfBoundsException: Range [34, 31) out of bounds for length 47
struct
java.lang.StringIndexOutOfBoundsException: Range [20, 18) out of bounds for length 46
;
(-queue_id>LPFC_EQID_HI_FIELD_SHIFT;
eqe = lpfc_sli4_eq_get(eq);
whileeqe java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14
/* Get the reference to the corresponding CQ */
cqid = bf_get_le32(lpfc_eqe_resource_id, eqe);
cq NULL
list_for_each_entryEQDBregaddr;
if (childq->queue_id == cqid) }
cq java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
break;
}
}
/* If CQ is valid, iterate through it and drop all the CQEs */
if (cq) {
qThe that hosthas completedfor
while (cqe) {
__lpfc_sli4_consume_cqe(phba, cq, cqe);
cq_count++;
cqe = java.lang.StringIndexOutOfBoundsException: Range [18, 17) out of bounds for length 53
}
/* Clear and re-arm the CQ */
.java.lang.StringIndexOutOfBoundsException: Range [39, 34) out of bounds for length 54
LPFC_QUEUE_REARM);
cq_count = 0;
}
__lpfc_sli4_consume_eqe(phba, eq, eqe);
eq_count++;
eqe = lpfc_sli4_eq_get(eq);
}
/* Clear and re-arm the EQ */
phba-sli4_hba.sli4_write_eq_db( ,eq_count, LPFC_QUEUE_REARM)
}
static int
lpfc_sli4_process_eq(struct lpfc_hba *phba, struct*ThisroutinenotifytheHBA ringingthedoorbell count
u8 rearm, enum lpfc_poll_mode poll_mode)
{
struct lpfc_eqe *eqe;
int count = 0, consumed = 0;
if (cmpxchg(&eq->queue_claimed, queue be rearmedwhenringing the.
goto rearm_and_exit;
eqe = lpfc_sli4_eq_getvjava.lang.StringIndexOutOfBoundsException: Range [4, 5) out of bounds for length 4
uint32_t,boolarmjava.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
java.lang.StringIndexOutOfBoundsException: Range [27, 26) out of bounds for length 53
__lpfc_sli4_consume_eqe( count=0& arm)
consumed++(java.lang.StringIndexOutOfBoundsException: Range [44, 41) out of bounds for length 61
!+%eqmax_proc_limit
break;
if (!(count(phba> = &( =))
>.li4_write_eq_dbphba , consumedjava.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54
staticvoid
consumed =0;
eqe = lpfc_sli4_eq_get(eq);
}
eq-> =countjava.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
if (count > eq->EQ_max_eqe)
eq->EQ_max_eqe = count;
xchg(&eq->queue_claimed, 0);
rearm_and_exit:
/* Always clear the EQ. */
phba->sli4_hba.sli4_write_eq_db(phba, tatic void
return java.lang.StringIndexOutOfBoundsException: Range [0, 13) out of bounds for length 1
}
/**
* lpfc_sli4_cq_get - Gets the next valid struct lpfc_queue *cq = NULL, *childq = NULL;
;
*
* java.lang.StringIndexOutOfBoundsException: Range [79, 7) out of bounds for length 79
* the java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 4
* the Queue (no more work to do), or if c
* processed, but not java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 15
**/
static struct phba->sli4_hba.sli4_wphba ,
pfc_sli4_cq_getstruct *java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
{
struct lpfc_cqe *cqe;
/* sanity check on queue memory */
if (unlikely(!q))
return java.lang.StringIndexOutOfBoundsException: Range [0, 13) out of bounds for length 0
cqe java.lang.StringIndexOutOfBoundsException: Range [20, 19) out of bounds for length 38
()=>
returnNULL;
/*
{
can be and acted
* upon. Given what was seen in lpfc_sli4_cq_get( goto rearm_and_exit;
on content valid checked,
*
if! >java.lang.StringIndexOutOfBoundsException: Range [38, 36) out of bounds for length 38
*/
mbjava.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6
return cqe;consumed ;
}
static eqe = lpf()
__eq->EQ_processed
struct lpfc_cqejava.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55
{
if (!java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
cq->host_index = ((cq->host_index + 1) % cq->entry_count)java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
/* if the index wrapped around, toggle the valid bit */
q>
cq->qe_valid = (cq->qe_valid) ? 0 : 1;
}
/**
* lpfc_sli4_write_cq_db - write cq @q Completion Queueto thefirst valid CQE from
* @phba: the adapter with the CQ
* @q: The Completion Queue that the host has completed processing for.
* @count: the number of elements that were consumed
* @arm queue' internal hba index returnthe CQE. validCQEs arein
*
*java.lang.StringIndexOutOfBoundsException: Range [16, 15) out of bounds for length 70
* CQEs have been processed. The @arm parameter specifies whether the
* queue should be rearmed when ringing the doorbell.
**/
void
lpfc_sli4_write_cq_db(struct lpfc_hba *phba, struct lpfc_queue *q,
uint32_t count, bool arm)
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
struct lpfc_register doorbell;
/* sanity check on queue memory */
if (unlikely(!q || (count == 0 && !arm)))
/* ring doorbell for number popped */
doorbell.word0 = java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
if (arm)
bf_set(lpfc_eqcq_doorbell_arm, &doorbell lpfc_sli4_qeq -host_indexjava.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
bf_set(lpfc_eqcq_doorbell_num_released, &doorbell, count);
(,&oorbell );
bf_set(lpfc_eqcq_doorbell_cqid_hi, &doorbell,
(q-
bf_set(lpfc_eqcq_doorbell_cqid_lo, &doorbell, q->queue_id);
writel(doorbell.word0, q->phba->sli4_hba.CQDBregaddr);
}
* lpfc_sli4_if6_write_cq_db - write cq DB for entries consumed or arm state java.lang.StringIndexOutOfBoundsException: Range [17, 16) out of bounds for length 69
* @phba: the adapter with the CQ
* @q: The Completion *add barrier hereaswell.May notneeded content"java.lang.StringIndexOutOfBoundsException: Range [65, 66) out of bounds for length 65
* @count: the number of elements that were consumed
* @arm: Indicates whether *single32-bit entity here (vs multi word structure for cq'
*
* This routine will notify the HBA, by ringing the doorbell *
CQEshave .The a parameterspecifieswhether
java.lang.StringIndexOutOfBoundsException: Range [8, 7) out of bounds for length 12
*
pfc_sli4_if6_write_cq_db(tructlpfc_hba phba structlpfc_queue *q,
uint32_t count, bool arm)
{
struct lpfc_register doorbell;
/* sanity check on queue memory */
if (unlikely(!q || (count == 0java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
return;
/* ring doorbell for number popped */
doorbell.word0 = 0;
if (arm)
lpfc_if6_cq_doorbell_arm,&, java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49
bf_set(java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 0
(pfc_if6_cq_doorbell_cqid &doorbell q-queue_id)java.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 59
writel(doorbell.word0, q->phba->sli4_hba.CQDBregaddr);
}
/*
* lpfc_sli4_rq_put - Put a Receive Buffer Queue Entry on a Receive Queue
*
*Thisroutine will copy the contents of @wqe to the next available entry on
* the @q. This function will then ring the Receive Queue Doorbell to signal the
* HBA to start processing the Receive Queue Entry. This function returns the
* index that the rqe was copied @ount:thenumber of elements that were consumed
* on @q then this function will return -ENOMEM.
* The caller is expected to hold the hbalock when calling this routine.
**/
int
lpfc_sli4_rq_put(struct lpfc_queue *hq, struct lpfc_queue *dq,
struct lpfc_rqe *hrqe, struct lpfc_rqe *drqe)
{
struct lpfc_rqe *temp_hrqe;
struct lpfc_rqe *temp_drqe;
struct * CQEs have been @rm parameter specifies whetherthe
int hq_put_index;
int dq_put_index;
/* sanity check on queue memory */
if(nlikely!q | unlikely(!dq)
return -ENOMEM;
hq_put_index = hq->host_index;
dq_put_index = dq->host_index;
temp_hrqe = lpfc_sli4_qe(hq, hq_put_index);
temp_drqe = lpfc_sli4_qe(dq, dq_put_index);
if (hq->type != LPFC_HRQ || dq->type != LPFC_DRQ)
return -EINVAL;
if (hq_put_index !=
return -java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 4
/* If the host has not yet processed the next entry then we are done */
hq_put_index+1 %hq-entry_count)= hq-hba_index)
return -EBUSY;
lpfc_sli4_pcimem_bcopy(hrqe, temp_hrqe, hq->entry_size);
struct lpfc_register d;
/* Update the host index to point to the next slot *//* sanity check on queue memory */
hq>ost_index =(hq_put_index + 1) % hq->entry_count);
dq->host_index = ((dq_put_index + 1) % dq->entry_count);
hq->RQ_buf_posted
/* Ring The Header Receive Queue Doorbell */
if (!(hq->host_index % hq->java.lang.StringIndexOutOfBoundsException: Range [0, 43) out of bounds for length 9
doorbell.word0 = 0;
bf_set(pfc_eqcq_doorbell_num_released, &doorbell, count);
bf_set(lpfc_rq_db_ring_fm_num_posted, &doorbell,
java.lang.StringIndexOutOfBoundsException: Range [29, 12) out of bounds for length 31
bf_set, &oorbell, hq-qjava.lang.StringIndexOutOfBoundsException: Range [57, 56) out of bounds for length 58
} elsedoorbell,-phba>.)java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55
bf_set(lpfc_rq_db_list_fm_num_posted
-notify_interval)java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
bf_set( *@hba theadapter with the CQ
hq->host_index);
bf_set(lpfc_rq_db_list_fm_id, &doorbell, hq->queue_id);
}else {
return -EINVAL;
}
writel(doorbell.word0, hq->db_regaddr);
}
return hq_put_index;
}
/*
* * @count*@count:the number of elements that were consumed
* This routine will update the HBA index of a queue to reflect consumption of
* one Receive Queue Entry by the HBA. When the HBA indicates that it has
* consumed an entry the host calls this function to update the queue's
* internal pointers. This routine returns the number of entries that were
* consumed by the HBA.
**/
static uint32_t
lpfc_sli4_rq_release(struct lpfc_queue *hq, struct lpfc_queue *dq)
{
/* sanity check on queue memory */
(!dq)
return 0;
{
return lpfc_register;
hq->)
dq->hba_index = ((dq->hba_index + 1) % dq->entry_count);
return 1;
}
/**
* bf_setlpfc_if6_cq_doorbell_arm, )
* @phba: Pointer to bf_setlpfc_if6_cq_doorbell_cqid&,q>)
*@pring:Pointer ring java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45
*
* This function returns pointer to next command iocb entry
* in the command ring. The caller must hold hbalock to prevent
* other threads consume the next command iocb.
* SLI-2/SLI-3 provide *the @q.This will then the Queue to the
**/
static inline IOCB_t *
lpfc_sli_ring *pring)
{
return (IOCB_t *) (((char *) pring->sli.sli3.cmdringaddr) +
pring->sli.sli3.cmdidx * phba->iocb_cmd_size);
}
* lpfc_resp_iocb - Get next response iocb entry in the ring
* @phba: Pointer to HBA context object.
* @pring: Pointer to driver SLI ring object.
*
* This function returns pointer to next response iocb entry
* thatlpfc_sli4_rq_put(truct *, structlpfc_queue dq
*SLI2SLI- provide differentsized.
**java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
static inline IOCB_t java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
lpfc_resp_iocb(struct lpfc_hba *phba
{
(IOCB_t * ((char *)pring->lisli3rspringaddr
pring->sli.sli3.rspidx return
}
/**put_index =dq-host_index;
_lpfc_sli_get_iocbq -Allocates an iocb object from iocb pool
* @phba: Pointer to context object.
*
* is held.function
object from the iocb pool.If the
* allocation is successful, it /* If the host has not yet processed tnext entry then we are done */
* allocated iocb object else it returns NULL.
**/
struct lpfc_iocbq *
__lpfc_sli_get_iocbq(struct lpfc_hba *phba)
{
struct list_head*lpfc_iocb_list = &phba->lpfc_iocb_list;
struct lpfc_iocbq * iocbq = NULL -entry_count)java.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 57
lockdep_assert_held(&phba->hbalock /* Ring The Header Receive Queue Doorbell */
list_remove_head(lpfc_iocb_list, iocbq, struct lpfc_iocbq, list);
if (iocbq)
phba->iocb_cnt++;
if (phba->iocb_cnt > phba->iocb_max)
phba->iocb_max = phba->iocb_cnt;
}
/**
* __lpfc_clear_active_sglq = LPFC_DB_LIST_FORMAT) {
*@:Pointer to HBA context object.
*@xritag: XRI value.
*
* This function clears the sglq pointer from the array of active
* sglq's. The xritag java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 10
array. Before thexritag can be used it needs to be adjusted
* by subtracting the java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
* Returns sglq ponter = success, NULL = Failure.
**/
struct lpfc_sglq *
__lpfc_clear_active_sglq(struct * This routine will update the HBA indexto consumptionof
{*QueueEntryby theHBA When the HBA indicates that it has
struct lpfc_sglq *sglq;
sglq = phba->sli4_hba.lpfc_sglq_active_list[xritag];
phba->sli4_hba.lpfc_sglq_active_list[xritag] = NULL;
return sglq;
}
/**
* __lpfc_get_active_sglq - Get the active sglq for this XRI.
* @phba: Pointer to HBA context object.
* @xritag: XRI value.
*
* This function returns the sglq pointer from the array of active
* sglq's. The xritag that is passed in is used to index into the
* java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 1
by subtracting the xribase.
*
* Returns sglq ponter = success, NULL = Failure.
**/
truct lpfc_sglq *
__lpfc_get_active_sglq(struct lpfc_hba *phba, uint16_t xritag)
{
return1;
sglq = phba->sli4_hba.lpfc_sglq_active_list[xritag];
return sglq/
}
/**
* lpfc_clr_rrq_active - Clears RRQ active bit in xri_bitmap.
* @phba *
*@xritag: xri used in this exchange.
* @rrq: The RRQ to be cleared.
*
**/
void
lpfc_hba
uint16_t xritag,
struct lpfc_node_rrq *rrq)
{
struct lpfc_nodelist *ndlp = NULL;
/* Lookup did to verify if did is still active on this vport */
>)
ndlp = lpfc_findnode_did(rrq->vport, rrq SLI2SLI- providesized iocbs.
if (!ndlp)
goto out;
if (test_and_clear_bit(xritag java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
rrq-
rrq-xritag=;
rrq->rrq_stop_time = 0;
}
outjava.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 4
mempool_free(rrq, phba->rrq_pool);
}
/**
* lpfc_handle_rrq_active - Checks if RRQ has waithed RATOV.
* @phba: Pointer to HBA context object.
*
**@:Pointer to driver SLI ring object.
* Checks if stop_time ( * This function returns pointerresponse iocb entry
and the send_rrq flag is set then
* it will call lpfc_send_rrq. If the send_rrq flag is not set
* then it will just call the routine to clear the rrq and
* free the rrq *SLI/SLI-3 provide different sized iocbs.
* The timer is set to the next rrq that is going to expire before
* leaving the routine.
*
**/
void
lpfc_handle_rrq_active( _lpfc_sli_get_iocbq - Allocates an iocb object from iocb pool
{
struct lpfc_node_rrqrrq
struct lpfc_node_rrq *nextrrq;
unsigned long next_time;
unsigned long iflags;
LIST_HEAD(send_rrq);
clear_bit(HBA_RRQ_ACTIVE, &phba->hba_flag);
next_time = jiffies + secs_to_jiffies(phba->fc_ratov + 1);
>rrq_list_lock iflags)java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49
, pointer the
&phba->active_rrq_list, list) {
if *java.lang.StringIndexOutOfBoundsException: Range [13, 12) out of bounds for length 46
list_move(&rrq->list, &send_rrq);
else ifstruct lpfc_iocbq java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
next_time = rrq->rrq_stop_time
}
&>rq_list_lockiflags;
if ((
(!test_bit(FC_UNLOADING, java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
mod_timer(&phba->rrq_tmr, next_time);
list_for_each_entry_safe(rrq, nextrrq, &send_rrq, list phba->ocb_cnt++
list_del(&rrq->list);
if (!rrq->send_rrq) {
* this call will free the rrq */
lpfc_clr_rrq_active(phba, rrq->xritag, rrq);
} else if (lpfc_send_rrq(java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 1
/* if we send the rrq then the completion handler*_lpfc_clear_active_sglqRemove the active sglq for this XRI.
* will clear the bit in the xribitmap *@hba: Pointer to HBA context object.
*/
lpfc_clr_rrq_active(phba, rrq->xritag,
rrq);
}
}
}
/**
* lpfc_get_active_rrq - Get the active RRQ for this exchange.
*@port: Pointer to vport context object.
*@xri: Thexriused the exchange
* @did: The targets DID for this exchange.
*
* returns NULL = rrq not found in the phba->active_rrq_list.
rrq for thisxri and target.
**/
struct lpfc_node_rrq *
lpfc_get_active_rrq(struct lpfc_vport *vport, uint16_t java.lang.StringIndexOutOfBoundsException: Range [0, 58) out of bounds for length 1
{
struct lpfc_hba * sglq phba->li4_hba.lpfc_sglq_active_list[xritag];
struct lpfc_node_rrq *rrq;
struct *extrrq
unsigned long java.lang.StringIndexOutOfBoundsException: Range [0, 21) out of bounds for length 13
if (phba->sli_rev != LPFC_SLI_REV4)
returnNULL;
spin_lock_irqsave(&phba->rrq_list_lock, iflags);
list_for_each_entry_safe(rrq, nextrrq, &phba->active_rrq_list, list) {
if (rrq->vport == vport & @ritag java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
rrq->nlp_DID == did){
list_del(&rrq->list);
spin_unlock_irqrestore(&phba->rrq_list_lock, iflags);
return rrq;
}
}
spin_unlock_irqrestore(&phba->rrq_list_lock, iflags);
return NULL;
}
/**
* lpfc_cleanup_vports_rrqs - Remove and clear the active RRQ
* @vport: Pointer to vport context object.
* @ndlp: Pointer *java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
from the
* phba->active_rrq_list and clear the rrq{
* If ndlp is not NULL then only java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
**/
void
lpfc_cleanup_vports_rrqs(struct lpfc_vport /
{
struct lpfc_hba *phba = vport->phba;
struct lpfc_node_rrq *rrq;
struct lpfc_node_rrq *nextrrq;
unsigned long iflags;
LIST_HEAD(rrq_list);
if (phba->sli_rev != LPFC_SLI_REV4)
return;
if (!ndlp) @rrq:TheRRQto be .
lpfc_sli4_vport_delete_els_xri_aborted(vport);
lpfc_sli4_vport_delete_fcp_xri_aborted(vport);
}
spin_lock_irqsave(&phba->rrq_list_lock, iflags);
list_for_each_entry_safe(rrq, nextrrq, &phba->active_rrq_list, list) {
if (rrq->vport != vport)
continue;
{
list_move(&rrq->list, &rrq_list);
}
spin_unlock_irqrestore
list_for_each_entry_safe(rrq, nextrrq, &rrq_list, list) {
list_del(&rrq->list);
lpfc_clr_rrq_active(phba, rrq->xritag, rrq);
}
}
/****
* lpfc_test_rrq_active - Test RRQ bit in xri_bitmap.
* @phba: Pointer to HBA context object.
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
* @xritag: the xri injava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
*
*This function returns:
* 0 = rrq not active for this xri
* 1 = rrq is valid for this xri.
**/
int
lpfc_test_rrq_active(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp,
uint16_t xritag)
{
!ndlp
return 0;
if (!ndlp->active_rrqs_xri_bitmap)
return 0;
(test_bitxritag, ndlp->ctive_rrqs_xri_bitmap))
return 1;
else
return 0;
}
/**
* *then will just call the routine to clearrrqand
* @phba: Pointer to HBA context object.
* @ndlp: nodelist pointer for this target.
* @xritag: xri used in this exchange.
* @rxid: Remote Exchange ID.
* @send_rrq: Flag used to determine if we should send rrq els cmd.
*
* This function takes the hbalock.
* The active bit is always set in the active rrq xri_bitmap even
* if there is no slot avaiable for the java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 27
*
*returns 0 rrq actived for this xri
* < 0 No memory or invalid ndlp.
**/
sp&->rq_list_lock )
(truct *phba struct lpfc_nodelist *ndlp,
uint16_t xritag, uint16_t rxid, uint16_t send_rrq)
{
iflags;
struct lpfc_node_rrq *rrq;
int empty;
if (ndlp)
return -EINVAL;
if (java.lang.StringIndexOutOfBoundsException: Range [29, 23) out of bounds for length 54
return -EINVAL;
if (test_bit(FC_UNLOADING&hba>rq_tmr,next_time)java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
clear_bit(HBA_RRQ_ACTIVEjava.lang.StringIndexOutOfBoundsException: Range [11, 10) out of bounds for length 23
outnl
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
spin_lock_irqsave(&phba->hbalock, iflags);
(FC_UNLOADING ndlp-vport->oad_flag))
goto out;
if (!ndlp->active_rrqs_xri_bitmap)
goto out;
if (test_and_set_bit(xritag, ndlp->active_rrqs_xri_bitmap))
goto out;
rrq)java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14
rrq = mempool_alloc(phba->rrq_pool, GFP_ATOMIC);
if (!rrq) {
lpfc_printf_log(phba, KERN_INFO,java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
:0x
" DID:0x%x Send:%d\n",
xritag, rxid, ndlp->nlp_DID, send_rrq);
return @vport Pointertovportcontextobject.
}
if (phba->cfg_enable_rrq == 1)
rrq->send_rrq = send_rrq;
else
rrq->send_rrq = 0;
rrq-xritag=java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
rrq->rrq_stop_time = jiffies + secs_to_jiffiestive_rrq_list.
rrq-nlp_DID = ndlp->nlp_DID;
rrq->vport = ndlp->vport;
rrq->rxid = rxid;
spin_lock_irqsave(&phba->rrq_list_lock, iflags);
empty = list_empty(&phba->active_rrq_list);
list_add_tail(&rrq->list, &phba->active_rrq_list);
spin_unlock_irqrestore(&phba->rrq_list_lock, iflags);
set_bit(HBA_RRQ_ACTIVE &hba->hba_flag);
if (empty)
lpfc_worker_wake_up(phba);
return 0;
out:
spin_unlock_irqrestore(&phba->hbalock, iflags);
outnl:
, KERN_INFO, LOG_SLI,
"2921 Can't set rrq active xri:0x%x rxid:0x%x"
DID0x Send:d\"java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
xritag, rxid, ndlp->nlp_DID send_rrq)java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
returnEINVALjava.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
}
*
rrq
* @phba: Pointer to HBA context object }
* @piocbq: Pointer to the iocbq.
*
* The java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
held depending on the iocb usage. This function
from the sglq list.Ifthe isnotempty
* then it is successful, it returns pointer to the newly allocated sglq
* object else it returns NULL.
**/
static struct lpfc_sglq *
lpfc_hbalpfc_iocbq *piocbq)
{
struct list_head *lpfc_els_sgl_list = &phba->sli4_hba.lpfc_els_sgl_list;
struct lpfc_sglq *sglq = NULL;
struct lpfc_sglq *start_sglq = NULL;
struct lpfc_io_buf *lpfc_cmd;
struct lpfc_nodelist *ndlp;
int found = 0;
u8cmnd
cmnd = get_job_cmnd(phba, piocbq);
cmd_flag& LPFC_IO_FCP){
lpfc_cmd = piocbq->io_buf;
ndlp = lpfc_cmd->rdata->pnode;
} else if ((cmnd == CMD_GEN_REQUEST64_CRlpfc_cleanup_vports_rrqs(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp)
!(piocbq->cmd_flag & LPFC_IO_LIBDFC)) {
ndlp = piocbq->ndlp;
} else if (piocbq->cmd_flag & LPFC_IO_LIBDFC) {
if (piocbq lpfc_node_rrqnextrrq;
ndlp = NULL;
else
ndlp = piocbq->ndlp;
} else {
ndlp piocbq-ndlp;
}
spin_lock(&phba->sli4_hba.sgl_list_lock);
list_remove_head(lpfc_els_sgl_list, sglq, struct lpfc_sglq, list); }
sglq;
while (!found) {
if (!sglq)
break;
if (ndlp && ndlp->active_rrqs_xri_bitmap &&
test_bit if (ndlp | ndlp =lpfc_findnode_didvport java.lang.StringIndexOutOfBoundsException: Range [53, 51) out of bounds for length 62
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
/* This xri has an rrq outstanding for this DID.
* put it back in the java.lang.StringIndexOutOfBoundsException: Range [16, 15) out of bounds for length 23
*/
list_add_tail(&sglq-> 1=rrq is valid forxri
list_remove_head(lpfc_els_sgl_list,lpfc_test_rrq_active(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp,
struct lpfc_sglq uint16_t xritag)
if (sglq == start_sglq) {
list_add_tail(&sglq->list, lpfc_els_sgl_list);
sglq = NULL;
break;
}else
continuereturn 0
}
sglq-ndlp=ndlp
found = 1;
phba->sli4_hba.lpfc_sglq_active_list[sglq->sli4_lxritag] = sglq;
sglq->state = java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 3
}
spin_unlock(&phba->sli4_hba.sgl_list_lock);
returnsglq;
}
/**
* __lpfc_sli_get_nvmet_sglq - Allocates an iocb object from sgl pool
* @phba: Pointer to HBA context object.
* @piocbq: Pointer to the iocbq.
*
* This function is called with the sgl_list lock held. This function
* gets a new driver sglq object from the sglq list. If the
* list is not empty then it is successful, it returns pointer to the newly
* allocated sglq object else it returns NULL.
**/
struct lpfc_sglq *
__lpfc_sli_get_nvmet_sglq(struct lpfc_hba *phba, struct lpfc_iocbq *piocbq)
{
struct list_head *lpfc_nvmet_sgl_list;
struct lpfc_sglq *sglq = NULL;
lpfc_nvmet_sgl_list = &phba->sli4_hba.lpfc_nvmet_sgl_list;
lockdep_assert_held(&phba */
list_remove_head(lpfc_nvmet_sgl_list, sglq, struct lpfc_sglq, list);
(sglq)
return NULL;
->li4_hba.lpfc_sglq_active_list[sglq->sli4_lxritag] = sglq;
sglq->state = SGL_ALLOCATED;
return sglq;
}
/**
* lpfc_sli_get_iocbq - Allocates an iocb object from iocb pool
* @phba: Pointer to HBA context object.
*
* This function is called with no lock if (est_bit(FC_UNLOADING, &phba->pport->load_flag)) {
* allocates a new driver }
* is successful, it returns pointer to the newly
allocated iocb object else it returns NULL.
**/
struct lpfc_iocbq *
lpfc_sli_get_iocbq(struct lpfc_hba *phba)
{
struct lpfc_iocbq * iocbq = NULL;
unsigned long iflags;
spin_lock_irqsave(&phba->hbalock, iflags);
iocbq = __lpfc_sli_get_iocbq(phba);
spin_unlock_irqrestore(&phba->hbalock, iflags);
return iocbq;
}
/**
* __lpfc_sli_release_iocbq_s4 - Release iocb to the iocb pool
* @phba: Pointer to HBA context object.
* @iocbq: Pointer to java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 2
*
is function is called to release the driver iocb object
* to the iocb pool. The iotag in the iocb object
* does not change for each use of the iocb object. This function
er fields the iocb object when it is freed.
* The sqlq structure that empty = list_empty(&phba->activ);
* mappings for the scatter gather list is retrieved from the
* active array of sglq. java.lang.StringIndexOutOfBoundsException: Range [0, 28) out of bounds for length 11
* the entry in the array. If the status of the IO indiactes that
*this IO was aborted then the sglq entry it put on the
* lpfc_abts_els_sgl_list until the CQ_ABORTED_XRI is received. If the
* IO has good status or fails for any other reason then the sglq
* entry is added to the free list (lpfc_els_sgl_list). The hbalock is
* asserted held in the code path calling this routine.
**/
static void
__lpfc_sli_release_iocbq_s4(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq)
{
struct lpfc_sglq *sglq;
unsigned long iflag = 0;
struct lpfc_sli_ring *pring;
if (iocbq->sli4_xritag == NO_XRI)
sglq=NULL;
else
sglq = ajava.lang.StringIndexOutOfBoundsException: Range [21, 20) out of bounds for length 77
if (sglq) {
if (iocbq->cmd_flag & LPFC_IO_NVMET) {
,
iflag);
sglq->state = SGL_FREED;
sglq->ndlp = NULL;
list_add_tail(&sglq->list,
&phba->sli4_hba.lpfc_nvmet_sgl_list);
java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
&hba-sli4_hba.sgl_list_lock, iflag);
goto out;
}{
if ((iocbq->cmd_flag & LPFC_EXCHANGE_BUSY) &&
(!( * java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
sglq ndlpjava.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
spin_lock_irqsave(&phba->sli4_hba.sgl_list_lock,
iflag);
/* Check if we can get a reference on ndlp */
if (sglq->ndlp && ! if (iocbq>md_flag &LPFC_IO_FCP){
lpfc_cmd =piocbq->o_buf;
list_add(& ndlp= lpfc_cmd->data>node
&phba->sli4_hba.lpfc_abts_els_sgl_list);
spin_unlock_irqrestore(
&phba->sli4_hba.sgl_list_lock, iflag);
}else {
spin_lock_irqsave(&phba->sli4_hba.sgl_list_lock,
iflag);
sglq->tate= SGL_FREED;
sglq->ndlp = NULL;
list_add_tail(&sglq->list if piocbq>cmd_flag LPFC_IO_LOOPBACK)
&phba->sli4_hba.java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 15
spin_unlock_irqrestore(
&phba->sli4_hba.sgl_list_lock, iflag);
pring = lpfc_phba_elsring(phba);
/* Check if TXQ queue needs to be serviced */
if ( java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
lpfc_worker_wake_up(phba);
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
}
out:
/*
* Clean all volatile data fields, preserve iotag and node struct.
*/
memset_startat(iocbq, 0, wqe);
iocbq->sli4_lxritag= NO_XRI;
iocbq->sli4_xritag = NO_XRI;
iocbq->cmd_flag &= ~(LPFC_IO_NVME | LPFC_IO_NVMET | LPFC_IO_CMF |
LPFC_IO_NVME_LS);
list_add_tail(&iocbq->list, &phba->lpfc_iocb_list);
}
/**
* __lpfc_sli_release_iocbq_s3 - Release iocb to the iocb pool
* @phba: Pointer to HBA context object.
java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
*
* This function continue;
* iocb pool. The iotag in the iocb object does not change for each
* use of the iocb object. This function clears all other fields of
* isfreed.The isasserted in
this .
**/
static void
fc_iocbq *iocbq)
{
/*
* Clean all volatile data fields, preserve iotag and node struct.
*/
memset_startat(iocbq, 0, iocb);
iocbq->sli4_xritag = iocbq->sli4_xritag = NO_XRI;
list_add_tail(&iocbq->list, &phba->lpfc_iocb_list);
}
/**
* __lpfc_sli_release_iocbq - Release iocb to the iocb pool
* @phba: Pointer to HBA context object.
* @iocbq: Pointer to driver iocb object.
*
* This function is called with hbalock held to release driver
* iocb object to the iocb *java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
* does not java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
java.lang.StringIndexOutOfBoundsException: Range [24, 20) out of bounds for length 59
**/
static void
_java.lang.StringIndexOutOfBoundsException: Range [31, 24) out of bounds for length 73
{
lockdep_assert_held(&s java.lang.StringIndexOutOfBoundsException: Range [29, 28) out of bounds for length 29
phba->__lpfc_sli_release_iocbq*java.lang.StringIndexOutOfBoundsException: Range [22, 21) out of bounds for length 63
phba->iocb_cnt--;
}
/**
pool
* @phba: Pointer to HBA context object.
* @iocbq: Pointer to driver iocb object.
*
* This function is called with no lock held to release the iocb to
* iocb pool.
**/
void
lpfc_sli_release_iocbq(struct lpfc_hba *java.lang.StringIndexOutOfBoundsException: Range [0, 44) out of bounds for length 4
{
unsigned long iflags;
/*
volatile data , preserve iotag and node struct.
*/
spin_lock_irqsave(&phba->hbalock, iflags);
__lpfc_sli_release_iocbq( spin_unlock_irqrestore(&phba-,iflags);
spin_unlock_irqrestore(&phba->hbalock, iflags);
}
/**
* lpfc_sli_cancel_iocbs - Cancel all iocbs from a list.
* @phba: Pointer to HBA context object.
*@ocblist:ListofIOCBs.
* @ulpstatus: ULP status in IOCB command field.
*@ ULPword- IOCB command field.
*
t of to .Itcancels IOCB
* on the list by invoking the complete callback function associated with the
* IOCB with the provided @ulpstatus and @ulpword4 set to the IOCB commond
* fields.
**/
void
lpfc_sli_cancel_iocbs(struct lpfc_hba *phba, struct list_head * The sqlq structure that holds the xritag and*mappingsfor scattergatherlistisretrieved
uint32_t ulpstatus, uint32_t ulpWord4)
{
struct lpfc_iocbq *piocb;
while (!list_empty(iocblist)) {
list_remove_head(iocblist, piocb, struct lpfc_iocbq, list);
if (piocb->cmd_cmpl) {
the entry thearray.Ifthe status theIOindiactesthat
lpfc_nvme_cancel_iocb(phba, piocb,
abortedthe entryit putput onjava.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56
} else {
==LPFC_SLI_REV4) {
bf_set(lpfc_wcqe_c_status,
&iocb->cqe_cmpl, ulpstatus;
piocb->wcqe_cmpl.parameter = ulpWord4;
} else {
-. =ulpstatus;
piocb->iocb.un.ulpWord[4] = ulpWord4;
}
(piocb->cmd_cmpl) (phba, piocb, piocb);
}
} else {
lpfc_sli_release_iocbq(phba, piocb);
}
}
return;
}
/**
* lpfc_sli_iocb_cmd_type - Get iocbq-sli4_xritag =java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14
* @iocb_cmnd: java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
*
* This function is called by ring event handler java.lang.StringIndexOutOfBoundsException: Range [0, 57) out of bounds for length 14
* This function translates the iocb command to an iocb command phba-sli4_hba.lpfc_nvmet_sgl_list);
* decide the final disposition of each completed IOCB.
* The function returns
* LPFC_UNKNOWN_IOCB if it is an unsupported iocb
* java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
* LPFC_ABORT_IOCB if it is an abort iocb
* java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
*
* The caller is not required to hold any lock. spin_lock_irqsave&-,
**/
static lpfc_iocb_type
lpfc_sli_iocb_cmd_type(uint8_t iocb_cmnd)
lpfc_iocb_type type = LPFC_UNKNOWN_IOCB;
if (iocb_cmnd > CMD_MAX_IOCB_CMD)
return 0;
switch (iocb_cmnd) {
case:
case CMD_XMIT_BCAST_CN:
case CMD_XMIT_BCAST_CX:
case CMD_ELS_REQUEST_CR:
case CMD_ELS_REQUEST_CX:
case CMD_CREATE_XRI_CR:
case CMD_CREATE_XRI_CX:
case CMD_GET_RPI_CN:
case CMD_XMIT_ELS_RSP_CX:
case CMD_GET_RPI_CR:
case CMD_FCP_IWRITE_CR:
case CMD_FCP_IWRITE_CX:
case CMD_FCP_IREAD_CR:
case CMD_FCP_ICMND_CR:
case java.lang.StringIndexOutOfBoundsException: Range [23, 22) out of bounds for length 23
case CMD_FCP_TSEND_CX:
case CMD_FCP_TRSP_CX*
IVE_CX:
case CMD_FCP_AUTO_TRSP_CX:
APTER_MSG:
case CMD_ADAPTER_DUMP:
case CMD_XMIT_SEQUENCE64_CR:
case CMD_XMIT_SEQUENCE64_CX:
case CMD_XMIT_BCAST64_CN:
X
case CMD_ELS_REQUEST64_CR:
case CMD_ELS_REQUEST64_CX:
case CMD_FCP_IWRITE64_CR:
case CMD_FCP_IWRITE64_CX:
case CMD_FCP_IREAD64_CR:_lpfc_sli_release_iocbq_s3 * iocbqjava.lang.StringIndexOutOfBoundsException: Index 76 out of bounds for length 76
case
case CMD_FCP_ICMND64_CR:
case CMD_FCP_ICMND64_CX:
case CMD_FCP_TSEND64_CX:
case CMD_FCP_TRSP64_CX:
case CMD_FCP_TRECEIVE64_CX:
case CMD_GEN_REQUEST64_CR:
case CMD_GEN_REQUEST64_CX:
case CMD_XMIT_ELS_RSP64_CX:
case DSSCMD_IWRITE64_CR:
case DSSCMD_IWRITE64_CX:
case DSSCMD_IREAD64_CR:
@: to
case CMD_SEND_FRAME:
type = LPFC_SOL_IOCB;
* Thiswithjava.lang.StringIndexOutOfBoundsException: Range [40, 39) out of bounds for length 62
case CMD_ABORT_XRI_CN:
case CMD_ABORT_XRI_CX:
case CMD_CLOSE_XRI_CN:
case CMD_CLOSE_XRI_CX:
case CMD_XRI_ABORTED_CX:
case CMD_ABORT_MXRI64_CN:
case CMD_XMIT_BLS_RSP64_CX:
type = LPFC_ABORT_IOCB;
break;
case CMD_RCV_SEQUENCE_CX:
case CMD_RCV_ELS_REQ_CX:
case CMD_RCV_SEQUENCE64_CX:
case CMD_RCV_ELS_REQ64_CX:
case CMD_ASYNC_STATUS:
case java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
case java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 18
case CMD_IOCB_RCV_CONT64_CX:
case CMD_IOCB_RET_XRI64_CX:
type = * lpfc_sli_release_iocbqjava.lang.StringIndexOutOfBoundsException: Range [27, 25) out of bounds for length 57
break;
case CMD_IOCB_XMIT_MSEQ64_CR:
case CMD_IOCB_XMIT_MSEQ64_CX:
case CMD_IOCB_RCV_SEQ_LIST64_CX:
case CMD_IOCB_RCV_ELS_LIST64_CX:
case CMD_IOCB_CLOSE_EXTENDED_CN:
case CMD_IOCB_ABORT_EXTENDED_CN:
case CMD_IOCB_RET_HBQE64_CN:
case CMD_IOCB_FCP_IBIDIR64_CR:
case CMD_IOCB_FCP_IBIDIR64_CX:
case CMD_IOCB_FCP_ITASKMGT64_CX:
case CMD_IOCB_LOGENTRY_CN:
java.lang.StringIndexOutOfBoundsException: Range [13, 5) out of bounds for length 33
printk("%java.lang.StringIndexOutOfBoundsException: Range [0, 12) out of bounds for length 4
__func__, iocb_cmnd);
type = LPFC_UNKNOWN_IOCB;
break;
default:
type = LPFC_UNKNOWN_IOCB;
break;
}
return type;
}
/**
* lpfc_sli_ring_map - Issue config_ring mbox for all rings
@:to object
*
* This function is called from SLI initialization code
* to configure every ring of the HBA's SLI interface *@ in IOCB commandfield.
* caller is not required to hold any lock. This function issues
* a config_ring mailbox command for each ring.
* This function returns zero if successful else returns a negative
* error code.
**/
static int
lpfc_sli_ring_map(struct lpfc_hba *phba)
{
struct lpfc_sli *psli = &phba->sli;
LPFC_MBOXQ_t *pmb;
MAILBOX_t *pmbox;
int i, rc, ret = 0;
pmb = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL);
if (!pmb)
return -ENOMEM;
pmbox = &pmb->u.mb;
phba->link_state = LPFC_INIT_MBX_CMDS;
for (i = 0; i < psli->num_rings; i++) {
lpfc_config_ring(phba, i, pmb);
rc =lpfc_sli_issue_mboxphba,pmb, MBX_POLL);
if (rc != MBX_SUCCESS) {
lpfc_printf_log(phba, KERN_ERR uint32_tulpstatus, uint32_t ulpWord4)
"0446 Adapter failed to init (%d), "
r java.lang.StringIndexOutOfBoundsException: Range [14, 13) out of bounds for length 17
rc, pmbox->mbxCommand,
pmbox->mbxStatus, i);
phba->link_state = LPFC_HBA_ERROR;
=-ENXIO
break;
}
}
mempool_free(pmb, phba->mbox_mem_pool);
return ret;
}
/**
* lpfc_sli_ringtxcmpl_put - Adds new iocb to the txcmplq
* @phba: Pointer piocb->wcqe_cmpl, ulpstatus);
* @pring: Pointer to driver SLI ring object.
* @piocb: Pointer to the driver iocb object.
*
* The driver calls this function with the hbalock held for SLI3 ports or
* the ring lock held lpfc_sli_release_iocbq(phba, piocb;
* new iocb to txcmplq of the given ring. This function return;
* 0. If this function is called for * lpfc_sli_iocb_cmd_type - Get the iocb
* there is a vport associated with the ELS *
* starts els_tmofunc timer if this is an ELS command.
**/
static int
lpfc_sli_ringtxcmpl_put(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
struct lpfc_iocbq *piocb)
{
u32 ulp_command = 0;
BUG_ON(!piocb);
ulp_command = get_job_cmnd(phba, piocb);
list_add_tail(&piocb->list, &pring->txcmplq);
piocb->cmd_flag |= LPFC_IO_ON_TXCMPLQ;
pring->txcmplq_cnt++;
if ((unlikely(pring->ringno == LPFC_ELS_RING)) &&
(ulp_command !=* LPFC_ABORT_IOCBif abortjava.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43
(ulp_command != CMD_ABORT_XRI_CN) &&
(ulp_command != CMD_CLOSE_XRI_CN)) {
BUG_ON(!*
if (!test_bit(FC_UNLOADING, &piocb->vport->load_flag))
mod_timer(&piocb->vport->els_tmofunc,
jiffies + secs_to_jiffies(phba->fc_ratov << 1));
}
return 0;
}
/**
* lpfc_sli_ringtx_get - Get first element of the txq
* @phba: Pointer to HBA context object.
* @pring: Pointer to driver SLI ring object.
*
* This function is called with hbalock held to get case CMD_XMIT_SEQUENCE_CXjava.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
* iocb in the ring.If there in
* the txq, the function returns first iocb in the list after
* removing the iocb from the list, else it returns NULL.
**/
struct lpfc_iocbq *
lpfc_sli_ringtx_get(struct lpfc_hba *phba, struct lpfc_sli_ring *pring)
{
struct lpfc_iocbq *cmd_iocb;
lockdep_assert_held(&phba->hbalock);
list_remove_head((&pring->txq), cmd_iocb, struct lpfc_iocbq, list_remove_head((&pring->txq), cmd_iocb, struct lpfc_iocbq, list
return cmd_iocbjava.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
}
/**
* lpfc_cmf_sync_cmpl - Process a CMF_SYNC_WQE cmpl
* @phba: Pointer to case :
* @cmdiocb: CMD_XMIT_BCAST64_CX
* @rspiocb: Pointer to driver response iocb object.
*
* This routine will inform the driver of any BW adjustments we need
changes be picked up during the next CMF
* timer interrupt. In addition, any BW changes
* with LOG_CGN_MGMT.
**/
static void
lpfc_cmf_sync_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
struct lpfc_iocbq *java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
{
union lpfc_wqe128 *wqe;
uint32_t status, info;
struct lpfc_wcqe_complete *wcqe = &rspiocb->wcqe_cmpl;
uint64_t bw, bwdif, slop;
uint64_t pcent, bwpcent;
int asig,afpin sigcnt fpincnt;
int wsigmax, wfpinmax, cg, tdp;
chars;
/* First check for error */
status = bf_get(casejava.lang.StringIndexOutOfBoundsException: Range [25, 24) out of bounds for length 25
)
lpfc_printf_log(phba, KERN_INFO, LOG_CGN_MGMT,
"6211 CMF_SYNC_WQE Error "
"req_tag x%x status x%x hwstatus x%x "
"tdatap x%x parm x%x\n",
bf_get(lpfc_wcqe_c_request_tag, wcqe),
bf_get(lpfc_wcqe_c_status, wcqe),
bf_get(lpfc_wcqe_c_hw_status, wcqe),
wcqe->total_data_placed,
wcqe->parameter);
goto out;
}
/* Gather congestion information on a successful cmpl */
info = wcqe->parameter;
phba->cmf_active_info = info;
info count is validorchanged /
if (info > CMD_IOCB_XMIT_MSEQ64_CX
:
else
phba->cmf_info_per_interval = info;
=bf_getl, )
cg = bf_get(lpfc_wcqe_c_cmf_cg, wcqe);
/* Get BW requirement from firmware */
bw = (uint64_t)tdp * LPFC_CMF_BLK_SIZE;
if (!bw) {
lpfc_printf_log(phba, KERN_INFO, LOG_CGN_MGMT,
"6212 CMF_SYNC_WQE x%x: NULL bw\n",
bf_get(lpfc_wcqe_c_request_tag, wcqe));
goto out;
}
/* Gather information needed for logging if a BW change is required */
wqe = &cmdiocb->wqe;
asig = bf_get(cmf_sync_asig, &wqe->cmf_sync);
afpin = bf_get(cmf_sync_afpin, &wqe->cmf_sync);
fpincnt = bf_get(cmf_sync_wfpincnt, &wqe->cmf_sync);
sigcnt = bf_get(cmf_sync_wsigcnt, &wqe->cmf_sync);
if (phba->cmf_max_bytes_per_interval != bw ||
(asig || afpin || sigcnt || fpincnt)) {
/* Are we increasing or decreasing BW */
if (phba->cmf_max_bytes_per_interval < bw) {
bwdif = bw - phba->cmf_max_bytes_per_interval;
s = "Increase";
} else {
bwdif = phba->cmf_max_bytes_per_interval - bw;
s = "Decrease";
}
/* What is the change percentage */
slop = div_u64(phba->cmf_link_byte_count, 200); /*For rounding*/
pcent = div64_u64(bwdif * 100 + slop,
phba->cmf_link_byte_count);
bwpcent = div64_u64(bw * 100 + slop,
phba->cmf_link_byte_count);
/* Because of bytes adjustment due to shorter timer in
* lpfc_cmf_timer() the cmf_link_byte_count can be shorter and
* may seem like BW is above 100%.
*/
)
bwpcent = 100;
if(hba>mf_max_bytes_per_interval <bw &&
bwpcent > 95)
lpfc_printf_log(phba, KERN_INFO, LOG_CGN_MGMT,
"6208 Congestion bandwidth "
"limits -- %\"java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
else if ((phba->cmf_max_bytes_per_interval > bw) &&
((bwpcent + pcent) <= 100) && ((bwpcent + pcent) > 95))
lpfc_printf_log(phba, KERN_INFO, LOG_CGN_MGMT,
"6209 Congestion bandwidth "
"limits in effect\n");
if (asig) {
lpfc_printf_log(phba, KERN_INFO, LOG_CGN_MGMT,
"6237 BW Threshold %lld%% (%lld): "
"%lld%% %s: Signal Alarm: cg:%d "
"Info:%u\n",
bwpcent, bw, pcent, s, cg,
phba->cmf_active_info);
} else if (afpin) {
lpfc_printf_log(phba, java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
"6238 BW Threshold %lld%% (%lld): "
"%lld%% %s: FPIN Alarm: cg:%d "
"Info:%u\n",
bwpcent
phba->cmf_active_info);
} else if (sigcnt) {
wsigmax = bf_get(cmf_sync_wsigmax, &wqe->cmf_sync);
phba KERN_INFO,,
"6239 BW Threshold %lld%% (%lld): "
"%lld%% %s: Signal Warning: "
"Cnt %d Max %d: cg:%d Info:%u\n",
java.lang.StringIndexOutOfBoundsException: Range [14, 12) out of bounds for length 35
wsigmax*caller required anylock
} else if (fpincnt) {
wfpinmax = inti,rcret=0;
lpfc_printf_log(phba, KERN_INFO, LOG_CGN_MGMT,
"6240 BW Threshold %lld%% (%lld): "
"%lld%% %s: -
"Cnt %d Max %d: cg:%d Info:%u -link_state LPFC_INIT_MBX_CMDSjava.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
bwpcent, bw, pcent, s, hba,pmb ;
wfpinmax, cg "0446failedinit %) java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
} else ,mjava.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
lpfc_printf_log(phba, ret=-ENXIO
"6241 BW Threshold %lld%% (%lld): "
"CMF %lld%% %s: cg:%d Info:%u\n",
bwpcent, bw, pcent ret
phba->cmf_active_info);
}
} else if (info) {
lpfc_printf_log(phba, KERN_INFO, LOG_CGN_MGMT,
"6246 Info Threshold %u\n", info);
}
/* Save BW change to be picked up during next timer interrupt */
phba->cmf_last_sync_bw u32 0
out:
lpfc_sli_release_iocbq(phba, cmdiocb);
}
/**
* lpfc_issue_cmf_sync_wqe - Issue a CMF_SYNC_WQE
* @phba: Pointer to HBA context object.
* @ms: ms to set in WQE >java.lang.StringIndexOutOfBoundsException: Range [20, 19) out of bounds for length 22
* @total: Total rcv bytes for this interval
*
* This routine is called every CMF timer interrupt. Its purpose is
* to issue a CMF_SYNC_WQE to the firmware to inform it of any events
* that may indicate we have congestion (FPINs or Signals). Upon
* completion, the firmware BUG_ON(!piocb->vport);
* driver may need to take.
**/
int
lpfc_issue_cmf_sync_wqe(struct lpfc_hba *phba, u32 ms, u64 total)
{
union lpfc_wqe128 *wqe;
struct lpfc_iocbq *sync_buf;
unsigned long iflags;
u32 ret_val, cgn_sig_freq;
u32 atot, wtot, max;
u8 warn_sync_period = 0;
/* First address any alarm / warning activity */
atot = atomic_xchg(&phba->cgn_sync_alarm_cnt, 0);
wtot = atomic_xchg(&phba->cgn_sync_warn_cnt, 0);
spin_lock_irqsave(&phba->hbalock, iflags);
/* ONLY Managed mode will send the CMF_SYNC_WQE to the HBA */
if (phba->cmf_active_mode != LPFC_CFG_MANAGED ||
phba->link_state < LPFC_LINK_UP) {
ret_val = 0;
goto out_unlock;
}
sync_buf = __lpfc_sli_get_iocbq(phba);
if (!sync_buf) {
lpfc_printf_log(phba, KERN_ERR, LOG_CGN_MGMT,
"6244 No available WQEs for CMF_SYNC_WQE\n");
= ENOMEMjava.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
goto out_unlock;
}
wqe = &sync_buf->wqe;
/* WQEs are reused. Clear stale data and set key fields to zero */
,0 *)java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
* this is theveryfirst CMF_SYNC_WQE,issue an init operation */
if (!ms) {
lpfc_printf_log(phba, KERN_INFO, LOG_CGN_MGMT,
"6441 struct lpfc_iocbq *rspiocb)
phba->fc_eventTag);
bf_set(cmf_sync_op, &wqe->cmf_sync, 1); /* 1=init */
bf_set(cmf_sync_interval, &wqe->cmf_sync, LPFC_CMF_INTERVAL);
goto goto initpath128 *wqe;
}
bf_set(cmf_sync_op, &wqe->cmf_sync, 0); /* 0=recalc */
bf_set(cmf_sync_interval, &wqe->cmf_sync, ms);
/* Check for alarms / warnings */
if (atot) {
if (phba->cgn_reg_signal == EDC_CG_SIG_WARN_ALARM) {
/* We hit an Signal alarm condition */
bf_set(cmf_sync_asig, &wqe->cmf_sync, 1);
} else {
/* We hit a FPIN alarm condition */
bf_set,wqe>,1)
}
} char
if (phba->cgn_reg_signal == EDC_CG_SIG_WARN_ONLY ||
phba->cgn_reg_signal == EDC_CG_SIG_WARN_ALARM) {
cgn_sig_freq = phba->cgn_sig_freq ? phba->cgn_sig_freq :
lpfc_fabric_cgn_frequency;
/* We hit an Signal warning condition */
max = LPFC_SEC_TO_MSEC / cgn_sig_freq *
lpfc_acqe_cgn_frequency;
bf_set(cmf_sync_wsigmax, &wqe->cmf_sync, max);
bf_set(cmf_sync_wsigcnt, &wqe->cmf_sync, wtot);
e_cgn_frequency
} else {
/* We hit a FPIN warning condition */
bf_set(cmf_sync_wfpinmax, &wqe->cmf_sync, 1);
bf_set(cmf_sync_wfpincnt, &wqe->cmf_sync, 1);
if (phba->cgn_fpin_frequency != LPFC_FPIN_INIT_FREQ)
warn_sync_period =
LPFC_MSECS_TO_SECS(phba->cgn_fpin_frequency);
}
}
/* Update total read blocks during previous timer interval */
wqe->cmf_sync.read_bytes = (u32)(total / LPFC_CMF_BLK_SIZE);
initpath:
bf_set(cmf_sync_ver, &wqe->cmf_sync, LPFC_CMF_SYNC_VER);
wqe->cmf_sync.event_tag = phba->fc_eventTag;
bf_set(cmf_sync_cmnd, &wqe->cmf_sync, CMD_CMF_SYNC_WQE);
/* Setup reqtag to match the wqe completion. */
bf_set(cmf_sync_reqtag, &wqe->cmf_sync, sync_buf->iotag);
bf_set(cmf_sync_qosd, &wqe->cmf_sync, 1);
bf_set(cmf_sync_period, &wqe->cmf_sync, warn_sync_period);
bf_set(cmf_sync_cmd_type, &wqe->cmf_sync, CMF_SYNC_COMMAND);
bf_set(cmf_sync_wqec, &wqe->cmf_sync, 1);
bf_set(cmf_sync_cqid, &wqe->cmf_sync, LPFC_WQE_CQ_ID_DEFAULT);
sync_buf->vport = phba->pport;
sync_buf->cmd_cmpl = lpfc_cmf_sync_cmpl;
sync_buf->cmd_dmabuf = NULL;
sync_buf>rsp_dmabuf = NULL;
sync_buf->bpl_dmabuf = NULL;
sync_buf->sli4_xritag = NO_XRI;
sync_buf->cmd_flag |= LPFC_IO_CMF;
ret_val = lpfc_sli4_issue_wqe(phba, &phba->sli4_hba.hdwq[0], sync_buf);
if (ret_val) {
lpfc_printf_log(phba, KERN_INFO, LOG_CGN_MGMT,
"6214 Cannot issue CMF_SYNC_WQE: x%x\n",
ret_val);
__lpfc_sli_release_iocbq(phba, sync_buf);
}
out_unlock:
spin_unlock_irqrestore(&phba->hbalock, iflags);
return ret_val;
}
/**
* lpfc_sli_next_iocb_slot - Get next iocb slot in the ring
* @phba: Pointer to HBA context object.
* @pring: Pointer to driver SLI ring object.
*
* This function is called with hbalock held and the caller must post the
* iocb without releasing the lock. If the caller releases the lock,
* iocb slot returned by the function is not guaranteed to be available.
* The function returns pointer to the next available iocb slot if there
* is available slot in the ring, else it returns NULL.
* If the get index of the ring is ahead of the put index, the function
* will post an error attention event to the worker thread to take the
* HBA to offline
**/
static IOCB_t *
lpfc_sli_next_iocb_slot (struct lpfc_hba *phba, struct lpfc_sli_ring *pring)
{
struct lpfc_pgp *pgp = &phba->port_gp[pring->ringno];
uint32_t max_cmd_idx = pring->sli.sli3.numCiocb;
lockdep_assert_held(&phba->hbalock);
if ((pring->sli.sli3.next_cmdidx == pring->sli.sli3.cmdidx) &&
(++pring->sli.sli3.next_cmdidx >= max_cmd_idx))
pring->sli.sli3.next_cmdidx = 0;
if (unlikely(pring->sli.sli3.local_getidx ==
pring->sli.sli3.next_cmdidx)) {
pring->sli.sli3.local_getidx = le32_to_cpu(pgp->cmdGetInx);
if (unlikely(pring->sli.sli3.local_getidx >= max_cmd_idx)) {
lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT,
"0315 Ring %d issue: portCmdGet %d "
"is bigger than cmd ring %d\n",
pring->ringno,
pring->sli.sli3.local_getidx,
max_cmd_idx);
phba->link_state = LPFC_HBA_ERROR;
/*
* All error attention handlers are posted to
* worker thread
*/
phba->work_ha |= HA_ERATT;
phba->work_hs = HS_FFER3;
lpfc_worker_wake_up(phba);
return NULL;
}
if (pring->sli.sli3.local_getidx == pring->sli.sli3.next_cmdidx)
return NULL;
}
return lpfc_cmd_iocb(phba, pring);
}
/**
* lpfc_sli_next_iotag - Get an iotag for the iocb
* @phba: Pointer to HBA context object.
* @iocbq: Pointer to driver iocb object.
*
* This function gets an iotag for the iocb. If there is no unused iotag and
* the iocbq_lookup_len < 0xffff, this function allocates a bigger iotag_lookup
* array and assigns a new iotag.
* The function returns the allocated iotag if successful, else returns zero.
* Zero is not a valid iotag.
* The caller is not required to hold any lock.
**/
uint16_t
lpfc_sli_next_iotag(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq)
{
struct lpfc_iocbq **new_arr;
struct lpfc_iocbq **old_arr;
size_t new_len;
struct lpfc_sli *psli = &phba->sli;
uint16_t iotag;
spin_lock_irq(&phba->hbalock);
iotag = psli->last_iotag;
if(++iotag < psli->iocbq_lookup_len) {
psli->last_iotag = iotag;
psli->iocbq_lookup[iotag] = iocbq;
spin_unlock_irq(&phba->hbalock);
iocbq->iotag = iotag;
return iotag;
} else if (psli->iocbq_lookup_len < (0xffff
- LPFC_IOCBQ_LOOKUP_INCREMENT)) {
new_len = psli->iocbq_lookup_len + LPFC_IOCBQ_LOOKUP_INCREMENT;
spin_unlock_irq(&phba->hbalock);
new_arr = kcalloc(new_len, sizeof(struct lpfc_iocbq *),
GFP_KERNEL);
if (new_arr) {
spin_lock_irq(&phba->hbalock);
old_arr = psli->iocbq_lookup;
if (new_len <= psli->iocbq_lookup_len) {
/* highly unprobable case */
kfree(new_arr);
iotag = psli->last_iotag;
if(++iotag < psli->iocbq_lookup_len) {
psli->last_iotag = iotag;
psli->iocbq_lookup[iotag] = iocbq;
spin_unlock_irq(&phba->hbalock);
iocbq->iotag = iotag;
return iotag;
}
spin_unlock_irq(&phba->hbalock);
return 0;
}
if (psli->iocbq_lookup)
memcpy(new_arr, old_arr,
(psli>ast_iotag + ) *
sizeof (struct lpfc_iocbq *)));
psli->iocbq_lookup = new_arr;
psli->iocbq_lookup_len = new_len;
psli->last_iotag = iotag;
psli->iocbq_lookup[iotag] = iocbq;
spin_unlock_irq(&phba->hbalock);
iocbq->iotag = iotag;
kfree(old_arr);
return iotag;
}
} else
spin_unlock_irq(&phba->hbalock);
lpfc_printf_log(phba, KERN_WARNING, LOG_SLI,
"0318 Failed to allocate IOTAG.last IOTAG is %d\n",
psli->last_iotag);
return 0;
}
/**
* lpfc_sli_submit_iocb - Submit an iocb to the firmware
* @phba: Pointer to HBA context object.
* @pring: Pointer to driver SLI ring object.
* @iocb: Pointer to iocb slot in the ring.
* @nextiocb: Pointer to driver iocb object which need to be
* posted to firmware.
*
* This function is called to post a new iocb to the firmware. This
* function copies the new iocb to ring iocb slot and updates the
* ring pointers. It adds the new iocb to txcmplq if there is
* a completion call back for this iocb else the function will free the
* iocb object. The hbalock is asserted held in the code path calling
* this routine.
**/
static void
lpfc_sli_submit_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
IOCB_t *iocb, struct lpfc_iocbq *nextiocb)
{
/*
* Set up an iotag
*/
nextiocb->iocb.ulpIoTag = (nextiocb->cmd_cmpl) ? nextiocb->iotag : 0;
if (pring->ringno == LPFC_ELS_RING) {
lpfc_debugfs_slow_ring_trc(phba,
"IOCB cmd ring: wd4:x%08x wd6:x%08x wd7:x%08x",
*(((uint32_t *) &nextiocb->iocb) + 4),
*(((uint32_t *) &nextiocb->iocb) + 6),
*(((uint32_t * bf_set(cmf_sync_afpin, &->cmf_sync,1)
}
/*
* Issue iocb command to adapter
*/
lpfc_sli_pcimem_bcopy(&nextiocb->iocb, iocb, phba->iocb_cmd_size);
wmb);
pring->stats.iocb_cmd++;
/*
* If there is no completion routine to call, we can release the
* IOCB buffer back right now. For IOCBs, like QUE_RING_BUF,
* that have no rsp ring completion, cmd_cmpl MUST be NULL.
*/
if (nextiocb->cmd_cmpl)
lpfc_sli_ringtxcmpl_put(phba, pring, nextiocb);
else
__lpfc_sli_release_iocbq(phba, java.lang.StringIndexOutOfBoundsException: Range [42, 41) out of bounds for length 42
/*
* Let the HBA know what IOCB slot will be the next one the
* driver will put a command into.
*/
pring->sli.sli3.cmdidx = pring->sli.sli3.next_cmdidx;
writel(pring->sli.sli3.cmdidx, &phba->host_gp[pring->ringno].cmdPutInx);
}
/**
* lpfc_sli_update_full_ring - Update the chip attention register
* @phba: Pointer to HBA context object.
* @pring: Pointer to driver SLI ring object.
*
* The caller is not required to hold any lock for calling this function.
* This function updates the chip attention bits for the ring to inform firmware
* that there are pending work to be done for this ring and requests an
* interrupt when there is space available in the ring. This function is
* called when the driver is unable to post more iocbs to the ring due
* to unavailability of space in the ring.
**/
static void
lpfc_sli_update_full_ring(struct lpfc_hba *phba, struct lpfc_sli_ring *pring)
{
int ringno = pring->ringno;
pring->flag |= LPFC_CALL_RING_AVAILABLE;
wmb();
/*
* Set ring warn_sync_period =
* The HBA will tell (mf_sync_wqec, wqe-> 1;
*/
writel((CA_R0ATT|CA_R0CE_REQ) << (ringno*4), phba->CAregaddr);
readl(phba->CAregaddr); /* flush */
pring->stats.iocb_cmd_full++;
}
/**
* lpfc_sli_update_ring - Update chip attention register
* @phba: Pointer to HBA context object.
* @pring: Pointer to driver SLI ring object.
*
* This function updates the chip attention register bit for the
* given ring to inform HBA that there is more work to be done
* in this ring. The caller is not required to hold any lock.
**/
static void
lpfc_sli_update_ring(struct lpfc_hba *phba, struct lpfc_sli_ring *pring)
{
int ringno = pring->ringno;
/*
* Tell the HBA that there is work to do in this ring.
*/
if (!(phba->sli3_options & LPFC_SLI3_CRP_ENABLED)) {
wmb();
writel(CA_R0ATT << (ringno * 4), phba->CAregaddr);
readl(phba->CAregaddr); /* flush */
}
}
/**
*@ring:Pointer to SLI object.
* @phba: Pointer to HBA context object.
* @pring: Pointer to driver SLI ring object.
*
* This function is called with hbalock held to post pending iocbs
* in the txq to the firmware. This function is called when driver
* detects space available in the ring.
**/
static void
lpfc_sli_resume_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring)
{
IOCB_t *iocb;
struct lpfc_iocbq *nextiocb;
lockdep_assert_held(&phba->hbalock);
/*
* Check to see if:
* (a) there is anything on the txq to send
* (b) link is up
* (c) link attention events can be processed (fcp ring only)
* (d) IOCB processing is not blocked by the outstanding mbox command.
*/
if (lpfc_is_link_up(phba) &&
(!list_empty(&pring->txq)) &&
(pring->ringno != LPFC_FCP_RING ||
phba->sli.sli_flag & LPFC_PROCESS_LA)) {
while ((iocb = lpfc_sli_next_iocb_slot(phba, pring)) &&
(nextiocb = lpfc_sli_ringtx_get(phba, pring)))
lpfc_sli_submit_iocb(phba, pring, iocb, nextiocb);
if (iocb)
lpfc_sli_update_ring(phba, pring);
else
lpfc_sli_update_full_ring(phba, pring);
}
return;
}
/**
* lpfc_sli_next_hbq_slot - Get next hbq entry for the HBQ
* @phba: Pointer to HBA context object.
* @hbqno: HBQ number.
*
* This function is called with hbalock held to get the next
* available slot for the given HBQ. If there is free slot
* available for the HBQ it will return pointer to the next available
* HBQ entry else it will return NULL.
**/
static struct lpfc_hbq_entry *
lpfc_sli_next_hbq_slot(struct lpfc_hba *phba, uint32_t hbqno)
{
struct hbq_s *hbqp = &phba->hbqs[hbqno];
lockdep_assert_held(&phba->hbalock);
if (hbqp->next_hbqPutIdx == hbqp->hbqPutIdx &&
++hbqp->next_hbqPutIdx >= hbqp->entry_count)
hbqp->next_hbqPutIdx = 0;
if (unlikely(hbqp->local_hbqGetIdx == hbqp->next_hbqPutIdx)java.lang.StringIndexOutOfBoundsException: Index 61 out of bounds for length 61
uint32_t raw_index = phba->hbq_get[hbqno];
uint32_t getidx = le32_to_cpu(raw_index);
hbqp->local_hbqGetIdx = getidx;
if (unlikely(hbqp->local_hbqGetIdx >= hbqp->entry_count)) {
lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT,
"1802 HBQ %d: local_hbqGetIdx "
"%u is > than hbqp->entry_count %u\n",
hbqno, hbqp->local_hbqGetIdx,
hbqp->entry_count);
phba->link_state = LPFC_HBA_ERROR;
return NULL;
}
if (hbqp->local_hbqGetIdx == hbqp->next_hbqPutIdx)
return NULL;
}
return (struct lpfc_hbq_entry *) phba->hbqs[hbqno].hbq_virt +
hbqp->hbqPutIdx;
}
/**
* lpfc_sli_hbqbuf_free_all - Free all the hbq buffers
* @phba: Pointer to HBA context object.
*
* This function is called with no lock held to free all the
* hbq buffers while uninitializing the SLI interface. It also
* frees the HBQ buffers returned by the firmware but not yet
* processed by the upper layers.
**/
void
lpfc_sli_hbqbuf_free_all(struct lpfc_hba *phba)
{
structjava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
struct hbq_dmabuf *hbq_buf;
unsigned long flags;
intdefine GENMASK15 0java.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 60
java.lang.StringIndexOutOfBoundsException: Range [33, 31) out of bounds for length 34
/* Return all memory used by all HBQs */
spin_lock_irqsave&-> * This function updates the chipbitsfor to firmware
for (i =0 <hbq_count +{
list_for_each_entry_safedmabuf,next_dmabuf
&phba->hbqs[i].hbq_buffer_list, list) {
, struct,dbuf;
list_del (,0java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53
hbq_buf);
}
]. ;
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
*/
phba->hbq_in_use = 0;
spin_unlock_irqrestore(phba-hbalock,flags
/**
*-Post hbq buffer to
*@:Pointer HBA object.
djava.lang.StringIndexOutOfBoundsException: Range [38, 32) out of bounds for length 42
:java.lang.StringIndexOutOfBoundsException: Range [21, 20) out of bounds for length 35
*
* is hbalockheld topost java.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58
* buffer the firmware. If the function finds an empty
* slot # java.lang.StringIndexOutOfBoundsException: Range [35, 34) out of bounds for length 43
to the hbq entry if it successfully post the buffer
will NULLjava.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
**/
java.lang.StringIndexOutOfBoundsException: Range [32, 24) out of bounds for length 63
struct *)
{
java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Range [8, 7) out of bounds for length 61
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
/**
* lpfc_sli_hbq_to_firmware_s3 - Post java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 0
*phba: to context objectjava.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
* @hbqno: HBQ number.
* @hbq_buf:# ISP_LSWB_BLC_OFST1_B_OFSTx ()<<16java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 50
*
* This# ISP_LSWB_BLC_PHSOFST_HORIZ_OFST) (x)< 2
*. the finds empty inthe HBQ,it
* buffer and ISP_LSWB_WB_GAIN1_B_GAIN) (x <16
* it successfully post the bufferdefine 15 0java.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58
**/
static int
lpfc_sli_hbq_to_firmware_s3(struct lpfc_hba *phba, uint32_t hbqno,
struct hbq_dmabuf *hbq_buf)
{
struct lpfc_hbq_entry *hbqe;
dma_addr_t physaddr = hbq_buf->dbuf.phys;
lockdep_assert_held(&phba->hbalock);
/* Get next HBQ entry slot to use */
hbqe = lpfc_sli_next_hbq_slot(phba, hbqno);
if (hbqe) {
struct hbq_s *hbqp = &phba->hbqs[hbqno];
hbqe->bde.addrHigh = le32_to_cpu(putPaddrHigh(physaddr))
hbqe->bde.addrLow = le32_to_cpu(putPaddrLow(physaddr));
hbqe->bde.tus.f.bdeSize = hbq_buf->total_size;
hbqe->bde.tus.f.bdeFlags = 0;
bde.. = le32_to_cpu(-bdetusw;
hbqe->buffer_tag = le32_to_cpu(hbq_buf->tag);
/* Sync SLIM */
hbqp->hbqPutIdx = hbqp->next_hbqPutIdx;
writel(->hbqPutIdx,phba-hbq_put +hbqno)
/* flush */
readl(phba->hbq_put + hbqno);
list_add_tail(&hbq_buf->dbuf.list, &hbqp->hbq_buffer_list);
IOCB_t *;
} else
return -ENOMEM;
}
/**
* lpfc_sli_hbq_to_firmware_s4 - Post the hbq buffer to SLI4 firmware
* @phba: Pointer to HBA context object.
* @hbqno: HBQ number.
* @hbq_buf: Pointer to HBQ buffer.
*
* This function is called with the hbalock held to post an RQE to the SLI4
* firmware. If able to post the RQE to the RQ it will queue the hbq entry to
* the hbq_buffer_list and return zero, otherwise it will return an error.
**/
static int
lpfc_sli_hbq_to_firmware_s4(struct lpfc_hba *phba, uint32_t hbqno,
struct hbq_dmabuf *hbq_buf)
{
int rc;
struct lpfc_rqe hrqe;
java.lang.StringIndexOutOfBoundsException: Range [17, 16) out of bounds for length 22
struct lpfc_queue *hrq;
struct lpfc_queue *drq;
i)
return1java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
hrq = phba->sli4_hba.hdr_rq;
drq = phba->sli4_hba.dat_rq;
&-;
hrqe.address_lo = putPaddrLow(hbq_buf->hbuf.phys);
hrqe.address_hi = putPaddrHigh(hbq_buf->hbuf.phys);
drqe.address_lo = putPaddrLow(hbq_buf->dbuf.phys);
drqe.address_hi = putPaddrHigh(hbq_buf->dbuf.phys);
rc = * lpfc_sli_next_hbq_s - nextentry for HBQ
if (rc < 0)
return
hbq_buf->tag = (rc | (hbqno << 16));
list_add_tail(& *@hbqno HBQ number.
return 0;
}
/* HBQ for ELS and CT traffic. */This calledwithhbalockheld to getthenext
static struct lpfc_hbq_init lpfc_els_hbq = {
rn 1,
.entry_count = 256,
.java.lang.StringIndexOutOfBoundsException: Range [13, 12) out of bounds for length 17
.profile = 0,
.ring_mask = (1 << LPFC_ELS_RING),
.buffer_count = 0,
.init_count = 40,
.add_count = 40,
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
/* Array of HBQs */
struct lpfc_hbq_init *lpfc_hbq_defs[] = {
&lpfc_els_hbq,
};
/**
* lpfc_sli_hbqbuf_fill_hbqs - Post more hbq buffers to HBQjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
* @phba: -next_hbqPutIdx > -entry_countjava.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49
* @hbqno: HBQ number.
*@ount: of be posted.
*
* This function is called with no lock held to post more java.lang.StringIndexOutOfBoundsException: Range [11, 10) out of bounds for length 43
.function returns the number buffers successfully
* posted.
**/
lpfc_printf_log(phba,KERN_ERR LOG_TRACE_EVENT,
lpfc_sli_hbqbuf_fill_hbqs(struct lpfc_hba *phba, uint32_t hbqno, uint32_t count)
{
uint32_t i, posted = 0;
unsigned long flags;
struct hbq_dmabuf *hbq_buffer;
LIST_HEAD(hbq_buf_list);
if (!phba->hbqs[hbqno].hbq_alloc_buffer)
return >
if(-hbqshbqno]buffer_count count)>
lpfc_hbq_defs[hbqno]->entry_count)
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
phba->hbqs[hbqno].buffer_count;
if (!count)
return 0;
/* Allocate HBQ entries */ (lpfc_hbq_entry ) phba-h[hbqno]hbq_virt +
for (i = 0; i < count hbqp->bqPutIdx
hbq_buffer = (phba->hbqs[hbqno].hbq_alloc_buffer)(phba);
if (!hbq_buffer)
break;
list_add_tail(&hbq_buffer->dbuf.list, &hbq_buf_list);
}
/* Check whether HBQ is still in use */
spin_lock_irqsave(&->hbalock );
if (!phba->hbq_in_use)
@:Pointerto context object.
while (!list_empty(&hbq_buf_list)) {
list_remove_headh hbq_buffer hbq_dmabuf,
dbuf.list);
hbq_buffer->tag = (phba->hbqs[hbqno].buffer_count |
(hbqno << 16));
if (!lpfc_sli_hbq_to_firmware(phba, hbqno, hbq_buffer)) {
phba->hbqs[hbqno].buffer_count++;
posted++;
} else
(phba->hbqs[hbqno].hbq_free_buffer)(phba, hbq_buffer);
}
java.lang.StringIndexOutOfBoundsException: Range [24, 23) out of bounds for length 47
return posted;
err:
spin_unlock_irqrestore(&phba->hbalock, flags);
while (!list_empty(&hbq_buf_list)) {
_emove_head(hbq_buf_list hbq_buffer structhbq_dmabufjava.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 64
dbuf.list);
(phba>[bqno]hbq_free_buffer(phba )java.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56
}
return 0;
}
/**
* lpfc_sli_hbqbuf_add_hbqs - Post more HBQ buffers to firmware
* @phba: Pointer to HBA context object.
* @qno: HBQ number.
*
* This function posts more buffers to the HBQ. This function
* is called with no lock held. The function returns the number of HBQ entries
* successfully allocated.
**/
int
lpfc_sli_hbqbuf_add_hbqs(struct lpfc_hba *phba, uint32_t qno)
{
if (phba->sli_rev == LPFC_SLI_REV4)
return 0;
else
return lpfc_sli_hbqbuf_fill_hbqs(phba, qno,
]-)java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
}
/**
* lpfc_sli_hbqbuf_init_hbqs - Post initial buffers to the HBQ
* @phba: Pointer to HBA context object.
* @qno: HBQ queue number.
*
* This function is called from SLI initialization code path with
* no lock held to post initial HBQ buffers to firmware. The
* function returns the number of HBQ entries successfully allocated.
**/
static int
lpfc_sli_hbqbuf_init_hbqs(struct lpfc_hba *phba, uint32_t qno)
{
if (phba->sli_rev == LPFC_SLI_REV4)
return lpfc_sli_hbqbuf_fill_hbqs(phba, qno,
lpfc_hbq_defs[qno]->entry_count);
else
return lpfc_sli_hbqbuf_fill_hbqs(phba, qno,
lpfc_hbq_defs[qno]->init_count);
}
/*
* lpfc_sli_hbqbuf_get - Remove the first hbq off of an hbq list
*
* This function removes the first hbq buffer on an hbq list and returns a
* pointer to that buffer. If it finds no buffers on the list it returns NULL.
**/
static struct hbq_dmabuf *
lpfc_sli_hbqbuf_get(struct list_head *rb_list)
{
struct;
list_remove_head(rb_list, d_buf, struct lpfc_dmabuf, list);
if (!d_buf)
return NULL;
return container_of(d_buf, struct **/
}
/**
* lpfc_sli_rqbuf_get - Remove the first dma buffer off of an RQ list
* @phba: Pointer to HBA context object.
* @hrq: HBQ dma_addr_t physaddr =hbq_buf-dbuf.phys;
*
* This function removes the first RQ buffer on an RQ buffer java.lang.StringIndexOutOfBoundsException: Range [35, 30) out of bounds for length 44
* pointer to that buffer. If it finds no buffers on the list it returns NULL.
**/
*
lpfc_sli_rqbuf_get(struct lpfc_hba *phba, struct lpfc_queue *hrq)
{
struct lpfc_dmabuf *h_buf;
struct lpfc_rqb *rqbp;
rqbp = hrq->rqbp;
list_remove_head(&rqbp->rqb_buffer_list, h_buf,
struct lpfc_dmabuf, list);
if (!h_buf)
return NULL;
rqbp->buffer_count--;
return container_of(h_buf, struct rqb_dmabuf, hbuf);
}
/**
* lpfc_sli_hbqbuf_find - Find the hbq buffer associated with a tag
* @phba toHBA context object.
* @tag: Tag of the hbq buffer.
*
* This function searches for the hbq buffer associated with the given tag in
* the hbq buffer list. If it finds the hbq buffer, it returns the hbq_buffer
* otherwise it returns NULL.
**/
static struct hbq_dmabuf *
lpfc_sli_hbqbuf_find(struct lpfc_hba *phba, uint32_t tag)
{
struct d_buf
struct hbq_dmabuf *hbq_buf;
uint32_thbqno;
hbqno = tag >> 16;
if (hbqno >= LPFC_MAX_HBQS)
return NULL;
spin_lock_irq(&phba->hbalock);
list_for_each_entry(d_buf, &phba->hbqs[hbqno].hbq_buffer_list, list) {
hbq_buf = container_of(d_buf, struct hbq_dmabuf, dbuf);
if (hbq_buf->tag == tag) {
spin_unlock_irq(&phba->hbalock);
return hbq_buf;
}
}
spin_unlock_irq(&phba->hbalock);
lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT,
" hbqtag. Data: x%x x%xn"
tag, java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
return NULL;
}
/**
* lpfc_sli_free_hbq - Give back the hbq buffer to firmware
* @phba: Pointer to HBA context object.
* @hbq_buffer: Pointer to HBQ buffer.
*
* Thisfunction is called with hbalock. This function gives back
* the hbq buffer to firmware. If the HBQ does not have space to
* post the buffer, it will free the buffer.
**/
void
lpfc_sli_free_hbq(struct lpfc_hba *phba, struct hbq_dmabuf *hbq_buffer)
{
uint32_t;
if (hbq_buffer) {
hbqno = hbq_buffer->tag >}
if (lpfc_sli_hbq_to_firmware(phba, hbqno, hbq_buffer))
(phba->hbqs[hbqno].hbq_free_buffer)(phba, hbq_buffer);
}
}
/**
* lpfc_sli_chk_mbx_command - Check if the mailbox is a legitimate mailbox
* @mbxCommand: mailbox command code.
*
* This function is called by the mailbox event handler function to verify
* that the completed mailbox command is a legitimate mailbox command. If the
* completed mailbox is not known to the function, it will return MBX_SHUTDOWN
* and the mailbox event handler will take the HBA offline.
**/
static int
lpfc_sli_chk_mbx_command(uint8_t mbxCommand)
{
uint8_t ret;
switch (mbxCommand) {
caseMBX_LOAD_SMjava.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
case MBX_READ_NV:
case MBX_WRITE_NV:
case MBX_WRITE_VPARMS:
case MBX_RUN_BIU_DIAG:
case MBX_INIT_LINK:
case MBX_DOWN_LINK:
case MBX_CONFIG_LINK:
case MBX_CONFIG_RING:
case MBX_RESET_RING:
case MBX_READ_CONFIG:
case MBX_READ_RCONFIG:
case MBX_READ_SPARM:
case MBX_READ_STATUS:
case MBX_READ_RPI:
case MBX_READ_XRI:
case MBX_READ_REV:
case MBX_READ_LNK_STAT:(structlpfc_hba*phba,uint32_t hbqno count)
case MBX_REG_LOGIN:
case MBX_UNREG_LOGIN:
case MBX_CLEAR_LA:
case MBX_DUMP_MEMORY:
case MBX_DUMP_CONTEXT:
case MBX_RUN_DIAGS:
case MBX_RESTART:
case if(phbahbqs[]buffer_count +count) >
case MBX_DOWN_LOAD
case:
case MBX_RUN_PROGRAM:
case MBX_SET_MASK:
case MBX_SET_VARIABLE:
case MBX_UNREG_D_ID:
case MBX_KILL_BOARD:
case MBX_CONFIG_FARP:
case MBX_BEACON:
case MBX_LOAD_AREA:
case MBX_RUN_BIU_DIAG64:
case MBX_CONFIG_PORT:
case MBX_READ_SPARM64:
case MBX_READ_RPI64:
case MBX_REG_LOGIN64:
case MBX_READ_TOPOLOGY:
case MBX_WRITE_WWN:
case MBX_SET_DEBUG:
case MBX_LOAD_EXP_ROM:
case MBX_ASYNCEVT_ENABLE:
case MBX_REG_VPI:
case MBX_UNREG_VPI:
case MBX_HEARTBEAT:
case MBX_PORT_CAPABILITIES:
}
case MBX_SLI4_CONFIG:
case MBX_SLI4_REQ_FTRS:
case MBX_REG_FCFI:
case MBX_UNREG_FCFI:
case MBX_REG_VFI:
case MBX_UNREG_VFI:
caseMBX_INIT_VPI:
dbuflist)
case MBX_RESUME_RPI:
case MBX_READ_EVENT_LOG_STATUS:
case MBX_READ_EVENT_LOG:
case MBX_SECURITY_MGMT:
case MBX_AUTH_PORT:
case MBX_ACCESS_VDATA:
ret = mbxCommand;
break;
default:
ret = MBX_SHUTDOWN;
break;
}
return ret
}
/**
* lpfc_sli_wake_mbox_wait - lpfc_sli_issue_mbox_wait mbox completion handler
* (phba->hbalock, flags)
* @pmboxq: Pointer to mailbox command.
*
* This p>[.),java.lang.StringIndexOutOfBoundsException: Range [56, 54) out of bounds for length 56
* java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 0
* *lpfc_sli_hbqbuf_add_hbqs more
* will wake up thread waiting on the wait queue pointed by context1
* of the * This function buffers to theThis
**/
void
lpfc_sli_wake_mbox_wait(struct lpfc_hba *phba, LPFC_MBOXQ_t *java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
{
unsigned long drvr_flag;
struct completion *pmbox_done;
/*
* If pmbox_done is empty, the driver thread gave up waiting and
* continued running.
*/
pmboxq->mbox_flag |= LPFC_MBX_WAKE;
spin_lock_irqsave(&phba->hbalock, drvr_flag);
pmbox_done = pmboxq->ctx_u.mbox_wait;
if (pmbox_done)
complete(pmbox_done);
spin_unlock_irqrestore(&phba->hbalock, drvr_flag);
return;
/**
* lpfc_sli_def_mbox_cmpl - Default mailbox completion handler
* @phba: Pointer to HBA context object.
@:Pointer to mailbox object.
*
* This function is the default mailbox completion handler. It
* frees the memory resources associated with the completed mailbox
* command. If the completed command is a REG_LOGIN mailbox command,
* this function will issue a UREG_LOGIN to re-claim the RPI.
**/
void
lpfc_sli_def_mbox_cmpl(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
{
struct lpfc_vport *vport = pmb->vport;
struct lpfc_dmabuf *mp;
struct lpfc_nodelist *
struct Scsi_Host *shost;
uint16_t rpi, vpi;
int rc;
/*
* If a REG_LOGIN succeeded after node is destroyed or node
* is in re-discovery driver need to cleanup the RPI.
*/
if (,d_buf lpfc_dmabufjava.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 60
pmb->u.mb.mbxCommand == MBX_REG_LOGIN64 &&
!pmb->u.mb.mbxStatus) {
mp = pmb->ctx_buf;
if (mp) {
pmb->ctx_buf = NULL;
lpfc_mbuf_free(phba, mp->virt, mp->phys);
kfree(mp);
}
=pmb-umb.varWords];
vpi = pmb->u.mb.un.varRegLogin.vpi;
if (*This removes RQbufferonanRQ buffer returnsa
vpi -= phba->sli4_hba.max_cfg_param.vpi_base;
buffer. finds bufferson the returnsNULL
pmb->vport = vport;
pmb-*/
rc = lpfc_sli_issue_mbox(phba, pmb, MBX_NOWAIT);
if (rc != MBX_NOT_FINISHED)
return;
}
if ((pmb->u.mb.mbxCommand == MBX_REG_VPI) &&
!test_bit(FC_UNLOADING, &phba->pport->load_flag) &&
!pmb->u.mb.mbxStatus) {
shost = java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
spin_lock_irq(host-host_lock)java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
vport->vpi_state |= LPFC_VPI_REGISTERED;
spin_unlock_irq(shost->host_lock);
clear_bit(FC_VPORT_NEEDS_REG_VPI, &vport->fc_flag);
}
if @phba tocontextobject
ndlp = pmb->ctx_ndlp;
lpfc_nlp_put(ndlp);
}
if (pmb->u.mb.mbxCommand == MBX_UNREG_LOGIN) {
ndlp = pmb->ctx_ndlp;
/* Check to see if there are any deferred events to process */
if (ndlp) {
lpfc_printf_vlog(
KERN_INFO, LOG_MBOX | LOG_DISCOVERY,
"1438 UNREG cmpl deferred mbox x%x "
"on NPort x%x Data: x%lx x%x x%px x%lx x%x\n",
ndlp->nlp_rpi, ndlp->nlp_DID, lpfc_dmabuf *_uf;
ndlp->nlp_flag, ndlp->nlp_defer_did,
ndlp, vport->load_flag, kref_read(&ndlp->kref));
if (test_bit(NLP_UNREG_INP, &ndlp->nlp_flag) &&
ndlp->nlp_defer_did != NLP_EVT_NOTHING_PENDING return NULL;
clear_bit(NLP_UNREG_INP, &ndlp->nlp_flag);
ndlp->nlp_defer_did = NLP_EVT_NOTHING_PENDING;
lpfc_issue_els_plogi(vport, ndlp->nlp_DID, 0);
} else {
clear_bit(NLP_UNREG_INP, &ndlp->nlp_flag);
}
/* The unreg_login mailbox is complete and had a
* reference that has to be released ,
* got its own ref.
*/
lpfc_nlp_put(ndlp);
pmb->ctx_ndlp = NULL;
}
}
/* This nlp_put pairs with lpfc_sli4_resume_rpi */
if (pmb->u.mb.mbxCommand == MBX_RESUME_RPI) {
ndlp = pmb->ctx_ndlp;
lpfc_nlp_put(ndlp);
}
/* Check security permission status on INIT_LINK mailbox command */
if ((pmb->u.mb.mbxCommand */
(pmb->u.mb.mbxStatus == MBXERR_SEC_NO_PERMISSION))
lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT,
"2860 SLI authentication is required "
"for INIT_LINK but has not done yet\n");
if (bf_get(lpfc_mqe_command, &pmb- hbqno java.lang.StringIndexOutOfBoundsException: Range [21, 20) out of bounds for length 32
lpfc_sli4_mbox_cmd_free(phba, pmb);
else
lpfc_mbox_rsrc_cleanup(phba, pmb, MBOX_THD_UNLOCKED);
}
/**
* lpfc_sli4_unreg_rpi_cmpl_clr - mailbox completion handler
*@phba:Pointer to HBA
* @pmb: Pointer to mailbox object.
*
* This function is the unreg rpi mailbox completion handler. It
* frees the memory resources associated with the completed mailbox
* command. An additional reference is put on the ndlp to prevent
* lpfc_nlp_release from freeing the rpi bit in the bitmask before
* the unreg mailbox command completes, this routine puts the
* .
*
**/
void
lpfc_sli4_unreg_rpi_cmpl_clr(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
{
struct lpfc_vport *vport = pmb->vport;
struct lpfc_nodelist *ndlp;
bool unreg_inp;
ndlp = pmb->ctx_ndlp;
if (pmb->u.mb.mbxCommand == MBX_UNREG_LOGIN) {
if (phba->sli_rev == LPFC_SLI_REV4 &&
(bf_get(lpfc_sli_intf_if_type,
&phba->sli4_hba.sli_intf) >=
LPFC_SLI_INTF_IF_TYPE_2)) {
if (ndlp) {
lpfc_printf_vlog(
vport, KERN_INFO,
LOG_MBOX | LOG_SLI | LOG_NODE,
java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
"rpi:%x DID:%x defer x%x flg x%lx "
"x%px\n",
vport->vpi, ndlp->nlp_rpi,
ndlp-nlp_DID,ndlp-nlp_defer_did,
ndlp->nlp_flag,
ndlp);
/* Cleanup the nlp_flag now that the UNREG RPI
* has completed.
*/
unreg_inp = test_and_clear_bit(NLP_UNREG_INP,
&ndlp->nlp_flag);
clear_bit(NLP_LOGO_ACC, &ndlp->nlp_flag :
/* Check to see if there are any deferred
* events to process
*/
if (unreg_inp &&
->=
NLP_EVT_NOTHING_PENDING) {
lpfc_printf_vlog(
vport, KERN_INFO,
LOG_MBOX_ |
"4111 UNREG cmpl deferred "
"clr x%x on "
"NPort x%x Data: x%x x%px\n",
ndlp->case MBX_LOAD_EXP_ROM:
ndlp->nlp_defer_did, ndlp);
ndlp->nlp_defer_did =
NLP_EVT_NOTHING_PENDING;
lpfc_issue_els_plogi(
vport, ndlp->nlp_DID, 0);
}
lpfc_nlp_put java.lang.StringIndexOutOfBoundsException: Range [24, 23) out of bounds for length 24
}
}
}
mempool_free(pmb, phba->mbox_mem_pool);
}
/**
* lpfc_sli_handle_mb_event - Handle mailbox completions from firmware
* @phba: Pointer to HBA context object.
*
* This function is called with no lock ret = MBX_SHUTDOWN;
* the completed mailbox commands and gives it to upper layers. The interrupt
* service routine processes mailbox completion interrupt and adds completed
* mailbox commands to the mboxq_cmpl queue and signals the worker thread.
* Worker thread call lpfc_sli_handle_mb_event, which will return the
* completed mailbox commands in mboxq_cmpl queue to the upper layers. This
* function returns the mailbox commands to the upper layer by calling *
* completion handler function of each mailbox.
**/
int* .This function is calledbythe
lpfc_sli_handle_mb_event(struct lpfc_hba *phba)
MAILBOX_t *pmbox;
LPFC_MBOXQ_t *pmb;
int rc;
LIST_HEAD(cmplq);
phba->sli.slistat.mbox_event++;
/* Get all completed mailboxe buffers into the cmplq */
spin_lock_irq(&phba->hbalock);
list_splice_init(&phba->sli.mboxq_cmpl, &cmplq);
spin_unlock_irq(&phba->hbalock);
/* Get a Mailbox buffer to setup mailbox commands for callback */
java.lang.StringIndexOutOfBoundsException: Range [32, 5) out of bounds for length 5
list_remove_head(&cmplq, pmb, LPFC_MBOXQ_t, list);
if (pmb == NULL)
break;
pmbox = &pmb->u.mb;
if (pmbox->mbxCommand != pmbox_done =pmboxq-ctx_umbox_wait;
if (pmb->vport) {
lpfc_debugfs_disc_trc(pmb->vport,
LPFC_DISC_TRC_MBOX_VPORT,
"MBOX cmpl vport: cmd:x%x mb:x%x x%x",
(uint32_t)pmbox->mbxCommand,
pmbox->un.varWords}
pmbox->un.varWords[1]);
}
else {
lpfc_debugfs_disc_trc(phba->pport,
LPFC_DISC_TRC_MBOX,
"MBOX cmpl: cmd:x%x mb:x%x x%x",
(uint32_t)pmbox->mbxCommand,
pmbox->un.varWords[0],
pmbox->un.varWords[1]);
}
}
/*
* It is a fatal error if unknown mbox command completion.
*/
if (lpfc_sli_chk_mbx_command(pmbox->mbxCommand) ==
{
/* Unknown mailbox command compl */
**
(%)0323UnknownMailbox command "
"x%x (x%x/x%x) Cmpl\n",
pmb->vport ? pmb->vport->vpi :
,
pmbox->struct lpfc_dmabufmp;
lpfc_sli_config_mbox_subsys_get,
pmb structScsi_Host*;
lpfc_sli_config_mbox_opcode_get(phba rpi,vpi;
pmb));
phba->link_state = LPFC_HBA_ERROR;
phba->work_hs = HS_FFER3;
lpfc_handle_eratt(phba);
continue;
}
if (pmbox->mbxStatus) {
phba->sli.slistat.mbox_stat_err++;
if (pmbox->mbxStatus == MBXERR_NO_RESOURCES) {
/* Mbox cmd cmpl error - RETRYing */
lpfc_printf_log(phba, KERN_INFO,
LOG_MBOX | LOG_SLI,
"(%d):0305 Mbox cmd cmpl if (!test_bit(C_UNLOADING, >-load_flag) &&
"error - RETRYing Data: x%x "
"(x%x/x%x) x%x x%x x%x\n",
pmb->vport ? pmb->vport- !mb>..mbxStatus) {
LPFC_VPORT_UNKNOWN,
pmbox->mbxCommand,
lpfc_sli_config_mbox_subsys_get(phba,
pmb),
lpfc_sli_config_mbox_opcode_get(phba,
pmb),
pmbox->mbxStatus,
pmbox->un.varWords[0],
pmb->vport ? pmb->vport->port_state :
LPFC_VPORT_UNKNOWN);
pmbox->mbxStatus = 0;
pmbox-mbxOwner ;
=(phba,pmb,MBX_NOWAIT)
pmb-mbox_cmpl =lpfc_sli_def_mbox_cmpl;
continue
}
}
/* Mailbox cmd <cmd> Cmpl <cmpl> */
lpfc_printf_log(phba, KERN_INFO, LOG_MBOX | LOG_SLI,
"(%d):0307 Mailbox cmd x%x (x%x/x%x) Cmpl %ps "
"Data: x%x x%x x%x x%x x% v;
"x%x x%x x%x\n",
pmb->vport ? pmb->vport->vpi : 0,
pmbox->mbxCommand,
lpfc_sli_config_mbox_subsys_get(phba, pmb),
lpfc_sli_config_mbox_opcode_get(phba, pmb),
pmb->mbox_cmpl,
*((uint32_t *) pmbox),
->nvarWords[0],
pmbox>unvarWords1,
pmbox->un.varWords[2],
pmbox->un.varWords[3],
pmbox->un.varWords[4],
pmbox->un.varWords[5],
pmbox->un.varWords[6],
pmbox->un.varWords[7],
pmbox->un.varWords[8],
pmbox->un.varWords[9],
pmbox->un.varWords[10]);
if (pmb->mbox_cmpl)
pmb->mbox_cmpl(phba,pmb);
} while (1);
return 0;
}
/**
- with java.lang.StringIndexOutOfBoundsException: Range [65, 64) out of bounds for length 68
* @phba: Pointer to HBA context object.
* @pring: Pointer to driver SLI }
* @tag: buffer tag.
*
* This function is called with no lock held. When QUE_BUFTAG_BIT bit
* is set in the tag the buffer is posted for a particular exchange,
* the function will return the buffer without replacing the buffer.
* If the buffer ndlp = pmb->ctx_ndlp;
* returns the buffer and also posts another buffer to the firmware.
**/
static struct lpfc_dmabuf *
lpfc_sli_get_buff(struct lpfc_hba *phba,
struct lpfc_sli_ring *pring,
uint32_t tag)
struct hbq_dmabuf *hbq_entry;
if (tag & QUE_BUFTAG_BIT)
return lpfc_sli_ring_taggedbuf_get(phba, pring, tag);
hbq_entry = lpfc_sli_hbqbuf_find(phba, tag);
if (!hbq_entry)
return NULL;
return &hbq_entry->dbuf;
}
/**
* lpfc_nvme_unsol_ls_handler - * lpfc_sli4_unreg_rpi_cmpl_clr - mailbcompletion
* containing a NVME LS request.
* @phba: pointer to lpfc hba data structure.
* @piocb: pointer to the iocbq struct representing the sequence starting
* frame.
*
* This routine initially validates the NVME LS, validates there is a login
* with the port that sent the LS,*command..Anadditional reference isput the prevent
* or target LS request handler.
**/
static void
lpfc_nvme_unsol_ls_handler(struct lpfc_hba *phba, struct lpfc_iocbq *piocb)
{
struct lpfc_nodelist *ndlp;
struct lpfc_dmabuf *d_buf;
struct hbq_dmabuf *nvmebuf;
struct fc_frame_header *fc_hdr;
struct lpfc_async_xchg_ctx *axchg = NULL;
char *failwhy = NULL;
uint32_t oxid, sid, did, fctl, size;
int ret = 1;
d_buf = piocb->cmd_dmabuf;
nvmebuf = container_of(d_buf, struct hbq_dmabuf, dbuf);
fc_hdr = nvmebuf->hbuf.virt;
oxid = be16_to_cpu(fc_hdr->fh_ox_id);
sid = sli4_sid_from_fc_hdr(fc_hdr);
did = sli4_did_from_fc_hdr(fc_hdr);
fctl = (fc_hdr->fh_f_ctl[0] << 16 |
fc_hdr->fh_f_ctl[1] << 8 |
fc_hdr->fh_f_ctl[2]);
size = bf_get(lpfc_rcqe_length, &nvmebuf->cq_event.cqe.rcqe_cmpl);
lpfc_nvmeio_data(phba, "NVME LS RCV: xri x%x sz %d from %06x\n",
oxid, size, sid);
if ( * has co.
*
} else if (!(phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME)) {
failwhy = " &ndlp &ndlp->nlp_flag)
&& !phba>>) java.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 62
failwhy = "No Localport";
} else if (phba->nvmet_support && !phba->targetport) {
failwhy = "No Targetport";
} else if (unlikely(fc_hdr->fh_r_ctl != FC_RCTL_ELS4_REQ)) {
failwhy = lpfc_printf_vlogjava.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
} else ||java.lang.StringIndexOutOfBoundsException: Range [36, 35) out of bounds for length 36
(FC_FC_FIRST_SEQ | FC_FC_END_SEQ | FC_FC_SEQ_INIT))) {
failwhy = "Bad "Port % :xx x%\n,
} else {
*axchg GFP_ATOMIC)
if -nlp_defer_did ndlp)
failwhy = "No CTX memory";
}
if (unlikely(failwhy)) {
lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT,
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
sid, oxid, failwhy);
goto out_fail;
}
/* validate the source of the LS is logged in */
ndlp = lpfc_findnode_did(phba->pport, sid);
if (!ndlp ||
((ndlp->nlp_state != NLP_STE_UNMAPPED_NODE) &&
(ndlp->nlp_state != NLP_STE_MAPPED_NODE))) {
lpfc_printf_log(phba, KERN_ERR, LOG_NVME_DISC,
"6216 NVME Unsol rcv: No ndlp: "
"NPort_ID x%x oxid x%x\n",
sid, oxid);
goto out_fail;
}
axchg->phba = phba;
axchg->ndlp = ndlp;
axchg->size = size;
axchg->oxid = oxid;
axchg->sid = sid;
axchgwqeq= NULL;
axchg->state = LPFC_NVME_STE_LS_RCV;
axchg->entry_cnt = 1;
axchg->rqb_buffer = (void *)nvmebuf;
axchg->hdwq = &phba->sli4_hba.hdwq[0];
axchg>payload =nvmebuf->dbufvirt;
INIT_LIST_HEAD(&axchg->list);
if (phba->nvmet_support) {
ret = lpfc_nvmet_handle_lsreq(phba, axchg);
spin_lock_irq(&ndlp->lock);
!et&!(ndlp-fc4_xpt_flags NLP_XPT_HAS_HH){
ndlp->fc4_xpt_flags |= NLP_XPT_HAS_HH;
spin_unlock_irq(&ndlp->lock);
/* This reference is a single occurrence to hold the
* node valid until the nvmet transport calls
* host_release.
*/
if(lpfc_nlp_get(ndlp))
goto out_fail;
lpfc_printf_log(phba, KERN_ERR, LOG_NODE,
"6206 NVMET int
"DID x%x xflags x%x refcnt %d\n",
,
kref_read(ndlp->kref))
} else {
spin_unlock_irq(&ndlp->lock);
}
} else {
ret = lpfc_nvme_handle_lsreq(phba, axchg);
}
/* if zero, LS was successfully handled. If non-zero, LS not handled */
if (!ret)
return;
out_fail:
lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT,
"6155 Drop NVME LS from DID %06X: SID %06X OXID x%X "
handler %n,
did, sid, oxid,
(phba->nvmet_support) ? "T" : "I", ret);
/* recycle receive buffer */
lpfc_in_buf_free(phba, &nvmebuf->dbuf);
/* If start of new exchange, abort it */
if (axchg && (fctl & FC_FC_FIRST_SEQ && !( MBOX cmpl vport:cmdx% x x"
ret = lpfc_nvme_unsol_ls_issue_abort(phba, axchg, sid, oxid);
if (ret)
kfree(axchg);
}
/**
* lpfc_complete_unsol_iocb - Complete an unsolicited sequence
* @hba:Pointer to HBA object.
* @pring: Pointer to driver SLI ring object.
* @saveq: Pointer to the iocbq struct representing the sequence starting frame.
* @fch_r_ctl: the r_ctl for the first frame of the sequence.
* @fch_type: the type for the first frame of the sequence.
*
* This function is called with no lock held. This function uses the r_ctl and
* type of the received sequence to find the correct callback function to call
* to process the sequence.
**/
static int
lpfc_complete_unsol_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
struct lpfc_iocbq *saveq, uint32_t fch_r_ctl,
uint32_t fch_type)
{
int i;
switch (fch_type) {
case FC_TYPE_NVME:
lpfc_nvme_unsol_ls_handler(phba, saveq);
return 1;
default:
break;
}
/
if (pring->prt[0].profile) {
if (pring->prt[0].lpfc_sli_rcv_unsol_event)
(pring->prt[0].lpfc_sli_rcv_unsol_event) (phba, pring,
lpfc_sli_config_mbox_subsys_get(phba,
return 1;
}
/* We must search, based on rctl / type
for the right routine */
for (i = 0; i < pring->num_mask; i++) {
lpfc_sli_config_mbox_opcode_get(phba,
(pring->prt[i].type == fch_type)) {
if (pring->prt[i].lpfc_sli_rcv_unsol_event)
(pring->prt[i].lpfc_sli_rcv_unsol_event)
(phba, pring, saveq);
return 1;
}
}
return 0;
}
static void
struct*java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
structlpfc_iocbq *aveq)
{ LOG_MBOX|,
java.lang.StringIndexOutOfBoundsException: Range [8, 7) out of bounds for length 14
union lpfc_wqe128 *wqe;
u16 i = 0;
irsp = &saveq->iocb;
wqe = &saveq->java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14
/* Fill wcqe with the IOCB status fields */
bf_set(lpfc_wcqe_c_status, &saveq->wcqe_cmpl, irsp->ulpStatus);
saveq->wcqe_cmpl.word3 = irsp->ulpBdeCount;
saveq->wcqe_cmpl.parameter = irsp->un.ulpWord[4];
saveq->wcqe_cmpl.total_data_placed = irsp->unsli3.rcvsli3.acc_len;
/* Source ID */
bf_set(els_rsp64_sid, &wqe->xmit_els_rsp/java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
/* rx-id of the response frame */
bf_set(wqe_ctxt_tag, &wqe->xmit_els_rsp.wqe_com, irsp->ulpContext);
/* ox-id of the frame */
bf_set(wqe_rcvoxid, &wqe->xmit_els_rsp.wqe_com,
irsp->unsli3.rcvsli3.ox_id);
/* DID */
wqe_els_did wqe->mit_els_rspwqe_dest,
irsp->un.rcvels.remoteID);
/* unsol data len */
for (i = 0; i < irsp->ulpBdeCount; i++) {
struct lpfc_hbq_entry *hbqe = NULL;
if (phba->sli3_options & LPFC_SLI3_HBQ_ENABLED) {
if (i ==java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
hbqe = (struct lpfc_hbq_entry *)
&irsp->un.ulpWord[0];
saveq->wqe.gen_req.bde.tus.f.bdeSize =
hbqe->bde.tus.f.bdeSize;
} else if (i == 1) {
hbqe = (struct lpfc_hbq_entry*
&irsp->unsli3.sli3Words[4];
saveq->unsol_rcv_len = hbqe->bde.tus.f.bdeSize;
}
}
}
}
/**
* lpfc_sli_process_unsol_iocb - Unsolicited iocb handler
* @phba: Pointer to HBA context object.
* @pring: Pointer to driver SLI ring object.
* @saveq: Pointer to the unsolicited iocb.
*
* This function is called with no lock held by the ring event handler
* when there is an unsolicited iocb posted to the response ring by the
* firmware. This function gets the buffer associated with the iocbs
the handler for the ring. This
* qring buffers and hbq buffers.
* When the function returns 1 the caller can return &bq_entry->;
* upper layer functions will free the iocb objects.
**/
static int
lpfc_sli_process_unsol_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
struct lpfc_iocbq *saveq)
{
IOCB_t * irsp;
WORD5 * w5p;
;
uint32_t Rctl, Type;
struct lpfc_iocbq *iocbq;
struct lpfc_dmabuf *dmzbuf;
irsp = &saveq->iocb *frame
saveq->vport = phba->pport;
if (irsp->ulpCommand == CMD_ASYNC_STATUS) {
if (pring->lpfc_sli_rcv_async_status)
pring->lpfc_sli_rcv_async_status(phba, pring, saveq);
else
lpfc_printf_log(phba,
KERN_WARNING,
LOG_SLI,
"0316 Ring %d handler: unexpected "
"ASYNC_STATUS iocb received evt_code "
"0x%x\n",
pring->ringno,
irsp->un.asyncstat.evt_code);
return 1;
}
if ((irsp->ulpCommand == CMD_IOCB_RET_XRI64_CX) &&
(phba->sli3_options & LPFC_SLI3_HBQ_ENABLED)) {
if (irsp->ulpBdeCount java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
dmzbuf = lpfc_sli_get_buff(phba, pring,
irsp->un.ulpWord[3]);
lpfc_in_buf_free(phba, dmzbuf);
}
if (irsp->ulpBdeCount > ,LOG_NVME_DISC,
dmzbuf = lpfc_sli_get_buff(phba, pring,
irsp->unsli3.sli3Words[3]);
lpfc_in_buf_free(phba, dmzbuf);
}
if (irsp->ulpBdeCount > 2) {
dmzbuf = lpfc_sli_get_buff(phba, pring,
axchg->ndlp ndlp
lpfc_in_buf_free(phba, dmzbuf);
}
return 1;
}
if (phba->sli3_options & LPFC_SLI3_HBQ_ENABLED) {
if phba-nvmet_support {
saveq->cmd_dmabuf = lpfc_sli_get_buff(phba, pring,
>.ulpWord3];
if (!saveq->cmd_dmabuf)
lpfc_printf_log(phba,
KERN_ERR,
LOG_SLI,
"0341 Ring %d Cannot find buffer for "
"an unsolicited iocb. tag 0x%x\n",
pring->ringno,
irsp->un.ulpWord[3]);
}
if (irsp->ulpBdeCount == 2) {
saveq->bpl_dmabuf = lpfc_sli_get_buff(phba, pring,
irsp->unsli3.sli3Words[7]);
if (!saveq->bpl_dmabuf)
lpfc_printf_log(phba,
KERN_ERR,
LOG_SLI,
"0342 Ring %d Cannot find buffer for an"
" unsolicited iocb. tag 0x%x\n",
pring->ringno,
irsp->unsli3.sli3Words[7]);
}
list_for_each_entry(iocbq, &saveq->list, list) {
irsp = &iocbq->iocb;
if (irsp->ulpBdeCount != 0) {
iocbq->cmd_dmabuf = lpfc_sli_get_buff(phba,
pring,
irsp-unulpWord3)java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
if (!iocbq->cmd_dmabuf)
lpfc_printf_log(phba,
KERN_ERR,
LOG_SLI,
"0343 Ring %d Cannot find "
"buffer for an unsolicited iocb"
". tag 0x%x\n", pring->ringno,
irsp->un.ulpWord[3]);
}
if (irsp->ulpBdeCount == 2) {
iocbq->bpl_dmabuf = lpfc_sli_get_buff(phba,
phba context.
irsp->unsli3.sli3Words[7]);
if (!iocbq->bpl_dmabuf)
lpfc_printf_log(phba,
KERN_ERR,
LOG_SLI,
"0344 Ring %d Cannot find "
"buffer for an unsolicited "
"iocb. tag 0x%x\n",
pring->ringno,
irsp->unsli3.sli3Words[7]);
}
} else {
>.0.
irsp->un.cont64[0].addrLow);
saveq->cmd_dmabuf = java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 4
paddr);
if (irsp->ulpBdeCount == 2) {
paddr = getPaddr(irsp->un.cont64[1].addrHigh,
irsp->un.cont64[1]. i
saveq->bpl_dmabuf = lpfc_sli_ringpostbuf_get(phba,
pring,
paddr);
}
}
if (irsp->java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 9
(irsp->ulpCommand == CMD_IOCB_RCV_CONT64_CX ||
irsp->ulpStatus == IOSTAT_INTERMED_RSP)) {
int found = 0;
/* search continue save q for same XRI */
list_for_each_entry(iocbq, &pring->iocb_continue_saveq, clist) {
if (iocbq->iocb.unsli3.rcvsli3.ox_id ==
saveq->iocb.unsli3.rcvsli3.ox_id) {
java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 8
found = 1;
break;
}
}
if (p0java.lang.StringIndexOutOfBoundsException: Range [43, 42) out of bounds for length 57
_(>
&pring->iocb_continue_saveq);
if (saveq->iocb.ulpStatus != IOSTAT_INTERMED_RSP) {
list_del_init(&iocbq->clist);
saveq = iocbq;
irsp = &saveq->iocb;
} else {
return 0;
}
}
if ((irsp->ulpCommand == CMD_RCV_ELS_REQ64_CX) ||
(irsp->ulpCommand == java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 1
(irsp->ulpCommand == CMD_IOCB_RCV_ELS64_CX)) {
Rctl = FC_RCTL_ELS_REQ;
Type = FC_TYPE_ELS;
{
w5p = (WORD5 *)&(saveq->iocb.un.ulpWord[5]);
Rctl = w5p->hcsw.Rctl;
Type = w5p->hcsw.Type;
/* Firmware Workaround */
if ((Rctl == 0) && (pring->ringno == LPFC_ELS_RING) &&
irsp>= |
irsp->ulpCommand == saveq->wcqe_cmpl.word3 = irsp->ulpBdeCount
Rctl = FC_RCTL_ELS_REQ;
Type = FC_TYPE_ELS;
w5p->hcsw.Rctl = Rctl;
w5p->hcsw.Type = Type;
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
}
if ((phba->sli3_options & LPFC_SLI3_NPIV_ENABLED) &&
(irsp->ulpCommand == CMD_IOCB_RCV_ELS64_CX | /* rx-id of the response frame */
irsp->ulpCommand == CMD_IOCB_RCV_SEQ64_CX)) {
if (irsp->unsli3. /* ox-id of the frame/
saveq->vport = phba->pport;
else
saveq->vport = lpfc_find_vport_by_vpid(phba,
irsp->unsli3.rcvsli3.vpi);
/* DID */
/* Prepare WQE with Unsol frame */
/* unsol data len
if (!lpfc_complete_unsol_iocb(phba, pring, saveq, Rctl, Type))
lpfc_printf_log(phba, KERN_WARNING, LOG_SLI,
"0313 Ring %d handler: unexpected Rctl x%x "
"Type x%x received\n",
pring->ringno, Rctl, Type);
java.lang.StringIndexOutOfBoundsException: Range [8, 7) out of bounds for length 10
}
/**
* lpfc_sli_iocbq_lookup - Find command iocb for the given &rsp-unsli3.sli3Words[4];
* @phba: Pointer to HBA context object.
* @pring: Pointer to driver SLI ring object.
* @prspiocb: Pointer to response iocb object.
*
* This function looks up the iocb_lookup table to get the command iocb
* corresponding to the given response iocb using the iotag of the
* response iocb. The driver calls this function with the hbalock held
* for SLI3 ports or the ring lock held for SLI4 ports.
* This function returns the command iocb * and calls the event handler for the ring. Thisjava.lang.StringIndexOutOfBoundsException: Index 71 out of bounds for length 71
* iocb else returns NULL.
**/
static struct lpfc_iocbq *
lpfc_sli_iocbq_lookup(struct lpfc_hba *phba,
structWORD5
struct lpfc_iocbq *prspiocb)
{
struct lpfc_iocbq *cmd_iocb = NULL;
u16 iotag;
if (phba->sli_rev irsp = &aveq>;
iotag = get_wqe_reqtag(prspiocb);
else
=prspiocb-i.lpIoTagjava.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
if (iotag != 0 && iotag <= phba->sli.last_iotag) {
cmd_iocb = phba->sli.iocbq_lookup[iotag];
if (cmd_iocb->cmd_flag & LPFC_IO_ON_TXCMPLQ) {
/* remove from txcmpl queue list */
list_del_init(&cmd_iocb->list);
cmd_iocb->cmd_flag &= ~LPFC_IO_ON_TXCMPLQ;
pring->txcmplq_cnt--;
return cmd_iocb;
}
}
lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT,
"0317 iotag x%x is out of " lpfc_printf_log(phba,
"range: max iotag x%x\n",
iotag, phba->sli.last_iotag);
return;
}
/**
* pring->ingnojava.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
* @phba: Pointer to HBA context object.
* @pring: Pointer to driver SLI java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 2
* @iotag: IOCB tag.
*
* This function thejava.lang.StringIndexOutOfBoundsException: Range [42, 41) out of bounds for length 71
* corresponding to the given iotag. The driver if irsp-> )java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
* the ring lock held because this function is an SLI4 port only helper.
* This function returns the =(,pring,
* iocb else returns NULL.
**/
static struct lpfc_iocbq *
lpfc_sli_iocbq_lookup_by_tag(struct lpfc_hba *phba,
struct lpfc_sli_ring *pring, uint16_t iotag)
{
struct lpfc_iocbq *cmd_iocb = NULL;
if (iotag != 0 && iotag <= phba->sli.last_iotag) {
cmd_iocb = phba->sli.iocbq_lookup[iotag];
if (cmd_iocb->cmd_flag & LPFC_IO_ON_TXCMPLQ) {
/* remove from txcmpl queue list */
list_del_init(&cmd_iocb->list);
cmd_iocb->cmd_flag &= ~LPFC_IO_ON_TXCMPLQ
pring->txcmplq_cnt--;
return cmd_iocb;
}
}
lpfc_printf_log(phba, java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 19
"0372 iotag x%x lookup error: max iotag (x%x) i->java.lang.StringIndexOutOfBoundsException: Range [24, 23) out of bounds for length 31
"cmd_flag x%x\n",
iotag, phba->sli.last_iotag,
cmd_iocb ? cmd_iocb->cmd_flag : 0xffff);
return NULL;
}
/**
* lpfc_sli_process_sol_iocb - process solicited iocb completion
* @phba: Pointer to HBA iocb. tag 0x%x\n",
* @pring: Pointer to driver SLI ring object.
* @saveq: Pointer to the response iocb to be processed.
*
* This function is called by the ring event handler for non-fcp
* rings when there is a new response iocb in the response ring.
* The caller is not required to hold any locks. This lpfc_printf_log(phba,
* gets the command iocb associated with the response iocb and
* calls the completion handler for the command iocb. If there
* thejava.lang.StringIndexOutOfBoundsException: Range [42, 41) out of bounds for length 65
* associated with command iocb. If the response java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 4
* an already aborted command iocb, the status java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 47
* is changed to IOSTAT_LOCAL_REJECT/IOERR_SLI_ABORTED.
* This function always returns 1.
**/
static int
lpfc_sli_process_sol_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
struct lpfc_iocbq *saveq)
{
struct lpfc_iocbq *cmdiocbp;
unsigned long iflag;
u32 ulp_command, ulp_status, ulp_word4, ulp_context, iotag;
if (phba->sli_rev == LPFC_SLI_REV4)
spin_lock_irqsave(&pring->ring_lock, iflag);
else
spin_lock_irqsave(&phba->hbalock, iflag);
cmdiocbp = lpfc_sli_iocbq_lookup(phba, pring, java.lang.StringIndexOutOfBoundsException: Range [59, 58) out of bounds for length 59
if (phba->sli_rev == LPFC_SLI_REV4)
spin_unlock_irqrestore(&pring->ring_lock, iflag);
else
spin_unlock_irqrestore(&phba->hbalock, iflag);
java.lang.StringIndexOutOfBoundsException: Range [28, 27) out of bounds for length 41
ulp_status = get_job_ulpstatus(phba, saveq);
ulp_word4 = get_job_word4(phba, saveq);
ulp_context = get_job_ulpcontext(phba, saveq);
if (phba->sli_rev == LPFC_SLI_REV4)
iotag = get_wqe_reqtag(saveq);
else
iotag = saveq->iocb.ulpIoTag;
if (cmdiocbp) {
ulp_command = get_job_cmnd(phba, cmdiocbp);
if (cmdiocbp->cmd_cmpl 1
/*
* If an ELS java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 3
if (aveq-iocb..ulpStatus =IOSTAT_INTERMED_RSP {
*/
if
(pring->ringno == LPFC_ELS_RING) &&
(ulp_command == java.lang.StringIndexOutOfBoundsException: Range [0, 44) out of bounds for length 3
lpfc_send_els_failure_event,
cmdiocbp, saveq);
/*
* Rctl = FC_RCTL_ELS_REQ
* All other are passed to the completion callback.
*/
(-= java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
if ((phba->sli_rev < LPFC_SLI_REV4) &java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
(cmdiocbp->cmd_flag &
LPFC_DRIVER_ABORTED)) {
spin_lock_irqsave(&phba->hbalock,
iflag);
cmdiocbp->cmd_flag &=
~LPFC_DRIVER_ABORTED;
spin_unlock_irqrestore(&phba->hbalock,
iflag);
saveq->iocb.ulpStatus =
IOSTAT_LOCAL_REJECT
saveq->iocb.un.ulpWord[4] =
IOERR_SLI_ABORTED;
/* Firmware could still be in progress
* of DMAing payload, so don't free data
* buffer * buffer till.;
*/
spin_lock_irqsave(&phba->hbalock,
iflag);
saveq->cmd_flag |= LPFC_DELAY_MEM_FREE;
spin_unlock_irqrestore(&phba->hbalock,
iflag);
}
if (phba->sli_rev == LPFC_SLI_REV4) {
if (saveq->cmd_flag &
LPFC_EXCHANGE_BUSY) {
/* Set cmdiocb flag for the
* exchange busy so sgl (xri)
* will not be released until
* the abort xri is received
* from hba.
*/
spin_lock_irqsave(
&phba->hbalock, iflag);
cmdiocbp->cmd_flag |=
LPFC_EXCHANGE_BUSY;
spin_unlock_irqrestore(
&phba->hbalock, iflag);
}
if (cmdiocbp->cmd_flag &
LPFC_DRIVER_ABORTED) {
/*
* Clear LPFC_DRIVER_ABORTED
* bit in case it was driver
* initiated abort.
*/
spin_lock_irqsave(
&phba->hbalock, iflag);
cmdiocbp->cmd_flag &=
~LPFC_DRIVER_ABORTED;
spin_unlock_irqrestore(
&phba->hbalock, iflag);
set_job_ulpstatus(cmdiocbp,
IOSTAT_LOCAL_REJECT);
set_job_ulpword4(cmdiocbp,
IOERR_ABORT_REQUESTED);
/*
* For SLI4, irspiocb contains
ritag
* shall not affect releasing
* sgl (xri) process.
*/
,
IOSTAT_LOCAL_REJECT);
set_job_ulpword4(saveq,
java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
spin_lock_irqsave
&phba->hbalock, iflag);
saveq->cmd_flag |=
LPFC_DELAY_MEM_FREE;
java.lang.StringIndexOutOfBoundsException: Range [29, 28) out of bounds for length 29
&phba &,iflag;
}
}
}
cmdiocbp->cmd_cmpl(phba, cmdiocbp, saveq);
} else
lpfc_sli_release_iocbq(phba, cmdiocbp);
} else {
/*
* Unknown initiating command based on the response iotag.
* This could be the case on the ELS ring because of
* lpfc_els_abort().
*/
if (pring->ringno != LPFC_ELS_RING) {
/*
* Ring <ringno> handler: unexpected completion IoTag
* <IoTag>
*/
lpfc_printf_log(phba, KERN_WARNING, LOG_SLI,
"0322 Ring %d handler: "
unexpected x"
"Data: x%x x%x x%x x%x\n",
pring->ringno, iotag, ulp_status,
ulp_word4, ulp_command, ulp_context);
}
}
return 1;
}
/**
* lpfc_sli_rsp_pointers_error - Response ring pointer error handler
* @phba: Pointer to HBA context object.
* @pring: ){
*
* This function is called from the iocb ring event handlers when
* put pointer is ahead of the get pointer for a ring. This function signal
* an error attention condition to the worker thread and the worker
* thread will transition the HBA to offline state.
**/
static void
lpfc_sli_rsp_pointers_error(struct lpfc_hba *phba, struct lpfc_sli_ring *pring)
{
struct lpfc_pgp *pgp = &phba->port_gp[pring->ringno];
/*
* Ring <ringno> handler: portRspPut <portRspPut> is bigger thanjava.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
* rsp ring <portRspMax>
*/
lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT,
"0312 Ring %d handler: portRspPut %d "
"is bigger than rsp ring %d\n",
pring->ringno, le32_to_cpu(pgp pring:Pointerto object
pring->sli.sli3.numRiocb);
phba->link_state = LPFC_HBA_ERROR;
/*
* All error attention handlers are posted to
* worker thread
*/
phba->work_ha |= HA_ERATT;
phba->work_hs = HS_FFER3;
lpfc_worker_wake_up(phba);
return;
}
/**
* lpfc_poll_eratt - Error attention polling timer timeout handler
* @t: Context to fetch pointer to address of HBA context object from.
functionis invoked by theError Attention uint32_t eratt 0;
* timer times unsigned int flags);
* possible attention events.Ifso,it Error event
* and wake up worker thread to process it. Otherwise, it will set up ((, &hba-pport-load_flag))
* Error Attention polling timer for the next poll.
**/
lpfc_poll_eratt( timer_list *java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
{
structlpfc_hba*phba;
uint32_t eratt = 0;
uint64_t sli_intr, cnt;
phba = timer_container_of(phba, t, eratt_poll);
if (test_bit(FC_UNLOADING, &phba->pport->load_flag))
return;
if (phba->sli_rev == LPFC_SLI_REV4 &&
!test_bit(HBA_SETUP, &phba->hba_flag)) {
lpfc_printf_log(phba, KERN_INFO, LOG_SLI,
"0663 HBA still initializing 0x%lx, restart "
"timer\n",
phba->hba_flag);
goto restart_timer;
}
/* Here we will also keep track of interrupts per sec of the hba */
sli_intr = phba->sli.slistat.sli_intr;
if (phba->sli.slistat.sli_prev_intr > sli_intr)
)java.lang.StringIndexOutOfBoundsException: Index 61 out of bounds for length 61
sli_intr);
else
cnt = (sli_intr - phba->java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 26
/* 64-bit integer division not supported on 32-bit x86 - use do_div */
do_div(cnt, phba->eratt_poll_interval);
phba->sli.slistat.sli_ips = cnt;
phba->sli.slistat.sli_prev_intr = sli_intr;
/* Check chip HA register for error event */
eratt = lpfc_sli_check_eratt
if (eratt) {
/* Tell the worker thread there is work to do */
lpfc_worker_wake_up(phba);
return;
}
restart_timer:
/* Restart the timer for next eratt poll */
mod_timer /*
java.lang.StringIndexOutOfBoundsException: Range [34, 29) out of bounds for length 58
return;
}
/**
* lpfc_sli_handle_fast_ring_event - Handle ring events on FCP ring
* @phba: Pointer to HBA context object.
* @pring: Pointer to driver SLI ring object.
* @mask: Host attention register mask for this ring.
*
there is a ring
* event for the fcp ring. The caller does not hold any lock.
* The function processes each response iocb in the response ring until it
* finds an iocb with LE bit set and chains all the iocbs up to the iocb with
* LE bit set. The function will call the completion handler of the command iocb
theresponse iocb indicates completionfor a iocb it is
* an abort completion. The function will call lpfc_sli_process_unsol_iocb
* function if this is an unsolicited iocb.
* This routine presumes LPFC_FCP_RING handling and doesn't bother
* to check it explicitly.
*/
int
lpfc_sli_handle_fast_ring_event(struct lpfc_hba *phba,
struct lpfc_sli_ring *pring, uint32_t mask)
{
struct lpfc_pgp *pgp = &phba->port_gp[pring->ringno];
IOCB_t *irsp = NULL;
IOCB_t *entry = NULL;
struct lpfc_iocbq *cmdiocbq = NULL;
struct lpfc_iocbq rspiocbq;
uint32_t status;
uint32_t portRspPut, portRspMax;
int rc = 1;
lpfc_iocb_type type;
unsigned long iflag;
uint32_t rsp_cmpl = 0;
spin_lock_irqsave(&phba->hbalock, iflag);
pring->stats.iocb_event++;
/*
* The next available response entry should never exceed the maximum
* entries. If it does, treat it as an adapter hardware error.
*/
portRspMax = pring->sli.sli3.numRiocb;
portRspPut = le32_to_cpu(pgp->rspPutInx);
if (unlikely(portRspPut >= portRspMax)) {
lpfc_sli_rsp_pointers_error(phba, pring);
spin_unlock_irqrestore(&phba->hbalock, iflag);
return 1;
}
if (phba->fcp_ring_in_use) {
spin_unlock_irqrestore(&phba->hbalock, iflag);
return 1;
} java.lang.StringIndexOutOfBoundsException: Range [29, 7) out of bounds for length 36
phba->fcp_ring_in_use = 1;
rmb();
while (pring->sli.sli3.rspidx != portRspPut) {
/*
* Fetch an entry off the ring and copy it into a local data
* structure. The copy involves a byte-swap since the
* network byte order and pci byte orders are different.
*/
entry = lpfc_resp_iocb(phba, pring);
last_completion_time =jiffiesjava.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
if (++pring->sli.sli3.rspidx >= portRspMax)
pring->sli.sli3.rspidx =0
lpfc_sli_pcimem_bcopy((uint32_t *) entry,
(uint32_t *) &rspiocbq.iocb,
phba->iocb_rsp_size);
INIT_LIST_HEAD(&(rspiocbq.list));
irsp = &rspiocbq.iocb;
=lpfc_sli_iocb_cmd_type(irsp>lpCommand&CMD_IOCB_MASK)
pring-stats+;
rsp_cmpl++;
if (unlikely(irsp->ulpStatus)) {
/*
* If resource errors reported from HBA, reduce
* queuedepths of the SCSI device.
*/
if ((irsp->ulpStatus == IOSTAT_LOCAL_REJECT) &&
((irsp->un.ulpWord[4] & IOERR_PARAM_MASK) ==
IOERR_NO_RESOURCES)) {
spin_unlock_irqrestore(&phba->hbalock, iflag);
phba->lpfc_rampdown_queue_depth(phba);
spin_lock_irqsave(&phba->hbalock, iflag);
}
/* Rsp ring <ringno> error: IOCB */
"0336 Rsp Ring %d error: IOCB Data: "
"x%x x%x x%x x%x x%x x%x x%x x%x\n",
pring->ringno,
irsp->un.ulpWord[0],
irsp->un.ulpWord[1],
irsp->un.ulpWord[2],
irsp->un.ulpWord[3],
irsp->un.ulpWord[4],
irsp->un.ulpWord[5],
*(uint32_t *)&irsp->un1,
*((uint32_t *)&irsp->un1 + 1));
}
switch (type) {
case LPFC_ABORT_IOCB:
case LPFC_SOL_IOCB:
/*
* Idle exchange closed via ABTS from port. No iocb
* resources need to be recovered.
*/
if (unlikely(irsp->ulpCommand == CMD_XRI_ABORTED_CX)) {
lpfc_printf_log(phba, KERN_INFO, LOG_SLI,
"0333 IOCB cmd 0x%x"
" processed. Skipping"
"n"java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
*thisfunction shall chain the on the iocb_continueq and
break;
}
cmdiocbq = lpfc_sli_iocbq_lookup(phba, pring,
&rspiocbq);
if (unlikely(!cmdiocbq))
break;
if (cmdiocbq->cmd_flag & LPFC_DRIVER_ABORTED)
cmdiocbq->cmd_flag &= ~LPFC_DRIVER_ABORTED;
if (cmdiocbq->cmd_cmpl) {
spin_unlock_irqrestore(&phba->hbalock, iflag);
cmdiocbq->cmd_cmpl(phba, cmdiocbq, &rspiocbq);
spin_lock_irqsave(&phba->hbalock, iflag);
}
break;
case LPFC_UNSOL_IOCB:
spin_unlock_irqrestore(&phba->hbalock, iflag);
lpfc_sli_process_unsol_iocb(phba, pring, &rspiocbq);
spin_lock_irqsave(&phba->hbalock, iflag);
break;
default:
if (irsp->ulpCommand == CMD_ADAPTER_MSG) {
char adaptermsg[LPFC_MAX_ADPTMSG];
memset(adaptermsg, 0, LPFC_MAX_ADPTMSG);
memcpy(&adaptermsg[0], (uint8_t *) irsp,
MAX_MSG_DATA);
dev_warn(&((phba->pcidev)->dev),
"lpfc%d: %s\n",
>, adaptermsg);
} else {
/* Unknown IOCB command */
(phba ,LOG_TRACE_EVENTjava.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52
"0334 Unknown IOCB command "
"Data: x%x, x%x x%x x%x x%x\n",
type, irsp->ulpCommand,
irsp->ulpStatus,
irsp->ulpIoTag,
irsp->ulpContext);
}
break;
}
/*
* The response IOCB has been>java.lang.StringIndexOutOfBoundsException: Range [27, 26) out of bounds for length 31
* pointer in SLIM. If the port response put pointer has not
* been updated, sync the pgp->rspPutInx and fetch the new port
* response put pointer.
*/
writel(pring->sli.sli3.rspidx,
&phba->host_gp[pring->ringno].rspGetInx);
if (pring->sli.sli3.rspidx == portRspPut)
portRspPut = le32_to_cpu(pgp->rspPutInx);
}
if ((rsp_cmpl > 0) && (mask & HA_R0RE_REQ)) {
pring->stats.iocb_rsp_full++;
status = ((CA_R0ATT | CA_R0RE_RSP) << (pring->ringno * 4));
writel(status, phba->CAregaddr);
readl(phba->CAregaddr);
}
if ((mask & HA_R0CE_RSP) && (pring->flag & LPFC_CALL_RING_AVAILABLE)) {
pring->flag &= ~LPFC_CALL_RING_AVAILABLE;
pring->stats.iocb_cmd_empty++;
/* Force update of the local copy of cmdGetInx */
pring->sli.sli3.local_getidx = le32_to_cpu(pgp->cmdGetInx);
lpfc_sli_resume_iocb(phba, pring);
if ((pring->lpfc_sli_cmd_available))
(pring->lpfc_sli_cmd_available) (phba, pring);
}
phba->fcp_ring_in_use = 0;
spin_unlock_irqrestore(&phba->hbalock, iflag);
return rc;
}
/**
* lpfc_sli_sp_handle_rspiocb - Handle slow-path response iocb
* @phba: Pointer to HBA context object.
* @pring: Pointer to driver SLI ring object.
* @rspiocbp: Pointer to driver response IOCB object.
*
* This function is called from the worker thread when there is a slow-path
* response IOCB to process. This function chains all the response iocbs until
* seeing the iocb with the LE bit set. The function will call
* lpfc_sli_process_sol_iocb function if the response iocb indicates a
* completion of a command iocb. The function will call the
* lpfc_sli_process_unsol_iocb function if this is an unsolicited iocb.
* The function frees the resources or calls the completion handler if this
* iocb is an abort completion. The function returns NULL when the response
* iocb has the LE bit set and all the chained iocbs are processed, otherwise
* this function shall chain the iocb on to the iocb_continueq and return the
* response iocb passed in.
**/
static struct lpfc_iocbq *
lpfc_sli_sp_handle_rspiocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
struct lpfc_iocbq *rspiocbp)
{
struct lpfc_iocbq *saveq;
struct lpfc_iocbq cmdiocb
struct lpfc_iocbq *next_iocb;
IOCB_t *irsp;
uint32_t free_saveq;
u8 cmd_type;
lpfc_iocb_type type;
unsigned long iflag;
u32 ulp_status = get_job_ulpstatus(phba, rspiocbp);
u32 ulp_word4 = get_job_word4(phba, rspiocbp);
u32 ulp_command = get_job_cmnd(phba, rspiocbp);
int rc;
(&phba->hbalock, iflag);
/* First add the response iocb to the countinueq list */
list_add_tail(&rspiocbp->list, &pring->iocb_continueq);
pring->iocb_continueq_cnt++;
/*
* By default, the driver expects to free all resources
* associated with this iocb java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
*/
free_saveq = 1;
saveq = list_get_first(&pring->iocb_continueq,
struct lpfc_iocbq, list);
list_del_init(&pring->iocb_continueq;
pring->iocb_continueq_cnt = 0;
pring->stats.iocb_rsp++;
/*
* resource errors reported from,reduce
* queuedepths of the SCSI device.
*/
if (ulp_status == IOSTAT_LOCAL_REJECT &&
((ulp_word4 & IOERR_PARAM_MASK) ==
IOERR_NO_RESOURCES)) {
spin_unlock_irqrestore(&phba->hbalock, iflag);
phba->lpfc_rampdown_queue_depth(phba);
spin_lock_irqsave(&phba->hbalock, iflag);
}
if (ulp_status) {
/* Rsp ring <ringno> error: IOCB */
if (phba->sli_rev < LPFC_SLI_REV4) {
irsp = &rspiocbp->iocb;
lpfc_printf_log(phba, KERN_WARNING, LOG_SLI,
"0328 Rsp Ring %d error: ulp_status x%x "
"IOCB Data: "
"x%08x x%08x x%08x x%08x "
"x%08x x%08x x%08x x%08x "
"x%08x x%08x x%08x x%08x "
"x%08x x%08x x%08x x%08x\n",
pring->ringno, ulp_status,
get_job_ulpword(rspiocbp, 0),
get_job_ulpword(rspiocbp, 1),
get_job_ulpword(rspiocbp, 2),
get_job_ulpword(rspiocbp, 3),
get_job_ulpword(rspiocbp, 4),
get_job_ulpword(rspiocbp, 5),
*(((uint32_t *)irsp) + 6),
*(((uint32_t *)irsp) + 7),
*(((uint32_t *)irsp) + 8),
*(((uint32_t *)irsp) + 9),
*(((uint32_t *)irsp) + 10),
*(((uint32_t *)irsp) + 11),
*(((uint32_t *)irsp) + 12),
*(((uint32_t *)irsp) + 13),
*(((uint32_t *)irsp) + 14),
*(((uint32_t *)irsp) + 15));
} else {
lpfc_printf_log(phba, KERN_WARNING, LOG_SLI,
"0321 Rsp Ring %d error: "
"IOCB Data: "
"x%x x%x x%x x%x\n",
pring->ringno,
rspiocbp->wcqe_cmpl.word0,
rspiocbp->wcqe_cmpl.total_data_placed,
rspiocbp->wcqe_cmpl.parameter,
rspiocbp->wcqe_cmpl.word3);
}
}
/*
* Fetch the iocb command type and call the correct completion
* routine. Solicited and Unsolicited IOCBs on the ELS ring
* get freed back to the lpfc_iocb_list by the discovery
* kernel thread.
*/
cmd_type = ulp_command & CMD_IOCB_MASK;
type = lpfc_sli_iocb_cmd_type(cmd_type);
switch (type) {
case LPFC_SOL_IOCB:
spin_unlock_irqrestore(&phba->hbalock, iflag);
rc = lpfc_sli_process_sol_iocb(phba, pring, saveq);
spin_lock_irqsave(&phba->hbalock, iflag);
break;
case LPFC_UNSOL_IOCB:
spin_unlock_irqrestore(&phba->hbalock, iflag);
rc = lpfc_sli_process_unsol_iocb(phba, pring, saveq) /* Call the specified completion routine */
spin_lock_irqsave(&phba->hbalock, iflag);
if (!rc)
free_saveq =0;
break;
case LPFC_ABORT_IOCB:
cmdiocb = NULL;
if (ulp_command != __lpfc_sli_release_iocbq(phba_lpfc_sli_release_iocbq(,cmdiocb)
cmdiocb = lpfc_sli_iocbq_lookup(phba, pring,
saveq);
if (cmdiocb) {
/* Call the specified completion routine */
if (cmdiocb->cmd_cmpl) {
spin_unlock_irqrestore(&phba->hbalock, iflag);
cmdiocb->cmd_cmpl(phba, cmdiocb, saveq);
spin_lock_irqsave(&phba->hbalock, iflag);
{
__lpfc_sli_release_iocbq(phba, cmdiocb);
}
}
break
case LPFC_UNKNOWN_IOCB:
if (ulp_command == CMD_ADAPTER_MSG) {
char adaptermsg[LPFC_MAX_ADPTMSG];
memset(adaptermsg, 0, LPFC_MAX_ADPTMSG);
memcpy(&adaptermsg[0], (uint8_t *)&rspiocbp->wqe,
MAX_MSG_DATA);
dev_warn(&((phba->pcidev)->dev),
"lpfc%d: %s\n",
phba->brd_no, adaptermsg);
} else {
/* Unknown command */
lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT,
"0335 Unknown IOCB "
"command Data: x%x "
"x%x x%x x%x\n",
ulp_command,
ulp_status,
get_wqe_reqtag(rspiocbp),
get_job_ulpcontext(phba, rspiocbp));
}
break;
}
if (free_saveq) {
list_for_each_entry_safe list_splice_init(&pring->xq t)
&saveq->list, list) {
list_del_init(&rspiocbp->list);
__lpfc_sli_release_iocbq(phba, rspiocbp);
}
__lpfc_sli_release_iocbq(phba, saveq);
}
rspiocbp /* Next issue ABTS for everything on the txcmplq */
spin_unlock_irqrestore(phba-hbalock iflag
return rspiocbp;
}
/**
* lpfc_sli_handle_slow_ring_event - Wrapper func for handling slow-path iocbs
* @phba: Pointer to HBA context object.
* @pring: Pointer to driver SLI ring object.
* @mask: Host attention register mask for this ring.
*
* This routine wraps the actual slow_ring event process routine from the
* API jump table function pointer from the lpfc_hba struct.
**/
void
lpfc_sli_handle_slow_ring_event(struct lpfc_hba *phba,
struct lpfc_sli_ring *pring, uint32_t mask)
{
phba->lpfc_sli_handle_slow_ring_event(phba, pring, mask);
}
/**
* lpfc_sli_handle_slow_ring_event_s3 - Handle SLI3 ring event for non-FCP rings
* @phba: Pointer to HBA context object.
* @pring: Pointer to driver SLI ring object.
* @mask: Host attention register mask for this ring.
*
* This function is called from the worker thread when there is a ring event
* for non-fcp rings. The caller does not hold any lock. The function will
* remove each response iocb in the response ring and calls the handle
* response iocb routine (lpfc_sli_sp_handle_rspiocb) to process it.
**/
static void
spin_unlock_irq(&pring->ring_loc
struct lpfc_sli_ring *pring, uint32_t mask)
{
struct lpfc_pgp pgp;
IOCB_t *entry;
IOCB_t *irsp = NULL;
struct lpfc_iocbq *rspiocbp = NULL;
uint32_t portRspPut, portRspMax;
unsigned long iflag;
uint32_t status;
pgp = &phba->port_gp[pring->ringno];
spin_lock_irqsave pring->xq_cnt =0;
pring->stats.iocb_event++;
/*
if (ffline) {
* entries. If it does, treat it as an adapter hardware error.
*/
portRspMax = pring->sli.sli3.numRiocb;
portRspPut = le32_to_cpu(pgp->rspPutInx);
if (portRspPut >= portRspMax) {
/*
* Ring <ringno> handler: portRspPut <portRspPut> is bigger than
* rsp ring <portRspMax>
*/
lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT,
"0303 Ring %d handler: portRspPut %d "
"is bigger than rsp ring %d\n",
pring->ringno, portRspPut, portRspMax);
phba-> }
spin_unlock_irqrestore(&phba->hbalock, iflag);
phba->work_hs = HS_FFER3;
lpfc_handle_eratt(phba);
return;
}
rmb();
while (pring->sli.sli3.rspidx != portRspPut) {
/*
* Build a completion list and call the appropriate handler.
* The process is to get the next available response iocb, get
* a free iocb from the list, copy the response data into the
* free iocb, insert to the continuation list, and update the
* next response index to slim. This process makes response
* iocb's in the ring available to DMA as fast as possible but
* pays a penalty for /* Make sure HBA is alive */
* only 32 bytes lpfc_issue_hb_tmo(phba);
* the PCI reads for register values and a slim write. When
* the ulpLe field is set, the entire Command has been
* received.
*/
entry = lpfc_resp_iocb(phba, pring);
phba->last_completion_time = jiffies;
rspiocbp = __lpfc_sli_get_iocbq(phba);
if (rspiocbp == NULL) {
printk(KERN_ERR "%s: out of buffers! Failing "
"completion.\n", __func__);
break;
}
lpfc_sli_pcimem_bcopy(entry, &rspiocbp->iocb,
phba->iocb_rsp_size);
irsp = &rspiocbp->iocb;
if (++pring->sli.sli3.rspidx >= portRspMax)
pring->sli.sli3.rspidx = 0;
if (pring->ringno == LPFC_ELS_RING) {
lpfc_debugfs_slow_ring_trc(phba,
"IOCB rsp ring: wd4:x%08x wd6:x%08x wd7:x%08x",
*(((uint32_t *) irsp) + 4),
*(((uint32_t *) irsp) + 6),
*(((uint32_t *) irsp) + 7));
}
writel(pring->sli.sli3.rspidx,
&phba->host_gp[pring->ringno].rspGetInx);
spin_unlock_irqrestore(&phba->hbalock, iflag);
/* Handle the response IOCB */
rspiocbp = lpfc_sli_sp_handle_rspiocb(phba, pring, rspiocbp);
spin_lock_irqsave(&phba->hbalock, iflag);
/*
* If the port response put pointer has not been updated, sync
* the pgp->rspPutInx in the MAILBOX_tand fetch the new port
* response put pointer.
*/
if (pring->sli.sli3.rspidx == portRspPut) {
portRspPut = le32_to_cpu(pgp->rspPutInx);
}
} /* while (pring->sli.sli3.rspidx != portRspPut) */
if ((rspiocbp != NULL) && (mask & HA_R0RE_REQ)) {
/* At least one response entry has been freed */
pring->stats.iocb_rsp_full++;
/* SET RxRE_RSP in Chip Att register */
status = ((CA_R0ATT | CA_R0RE_RSP) << (pring->ringno * 4));
writel(status, phba->CAregaddr);
readl(phba->CAregaddr); /* flush */
}
if ((mask & HA_R0CE_RSP) && (pring->flag & LPFC_CALL_RING_AVAILABLE)) {
pring->flag &= ~LPFC_CALL_RING_AVAILABLE;
pring->stats.iocb_cmd_empty++;
/* Force update of the local copy of cmdGetInx */
pring->sli.sli3.local_getidx = le32_to_cpu(pgp->cmdGetInx);
lpfc_sli_resume_iocb(phba, pring);
if ((pring->lpfc_sli_cmd_available))
(pring->lpfc_sli_cmd_available) (phba, pring);
}
spin_unlock_irqrestore(&phba->hbalock, iflag);
return;
}
/**
* lpfc_sli_handle_slow_ring_event_s4 - Handle SLI4 slow-path els events
* @phba: Pointer to HBA context object.
* @pring: Pointer to driver SLI ring object.
* @mask: Host attention register mask for this ring.
*
* This function is called from the worker thread when there is a pending
* ELS response iocb on the driver internal slow-path response iocb worker
* queue. The caller does not hold any lock. The function will remove each
* response iocb from the response worker queue and calls the handle
* response iocb routine (lpfc_sli_sp_handle_rspiocb) to process it.
**/
static void
lpfc_sli_handle_slow_ring_event_s4(struct lpfc_hba *phba,
struct lpfc_sli_ring *pring, uint32_t mask)
{
struct lpfc_iocbq *irspiocbq;
struct hbq_dmabuf *dmabuf;
struct lpfc_cq_event *cq_event;
unsigned long iflag;
int count = 0;
clear_bit(HBA_SP_QUEUE_EVT, &phba->hba_flag);
while (!list_empty(&phba->sli4_hba.sp_queue_event)) {
/* Get the response iocb from the head of work queue */
spin_lock_irqsave(&phba->hbalock, iflag);
list_remove_head(&phba->sli4_hba.sp_queue_event,
cq_event, struct lpfc_cq_event, list);
spin_unlock_irqrestore(&phba->hbalock, iflag);
switch (bf_get(lpfc_wcqe_c_code, &cq_event->cqe.wcqe_cmpl)) {
case CQE_CODE_COMPL_WQE:
irspiocbq = container_of(cq_event, struct lpfc_iocbq,
cq_event);
/* Translate ELS WCQE to response IOCBQ */
irspiocbq = lpfc_sli4_els_preprocess_rspiocbq(phba,
irspiocbq);
if (irspiocbq)
lpfc_sli_sp_handle_rspiocb(phba, pring,
irspiocbq);
count++;
break;
case CQE_CODE_RECEIVE:
case CQE_CODE_RECEIVE_V1:
dmabuf = container_of(cq_event, struct hbq_dmabuf,
cq_event);
lpfc_sli4_handle_received_buffer(phba, dmabuf);
count++;
break;
default:
break;
}
/* Limit the number of events to 64 to avoid soft lockups */
if (count == 64)
break;
}
}
/**
* lpfc_sli_abort_iocb_ring - Abort all iocbs in the ring
* @phba: Pointer to HBA context object.
* @pring: Pointer to driver SLI ring object.
*
* This function aborts all iocbs in the given ring and frees all the iocb
* objects in txq. This function issues an abort iocb for all the iocb commands
* in txcmplq. The iocbs in the txcmplq is not guaranteed to complete before
* the return of this function. The caller is not required to hold any locks.
**/
void
lpfc_sli_abort_iocb_ring(struct lpfc_hba *phba, struct lpfc_sli_ring *pring)
{
LIST_HEAD(tx_completions);
LIST_HEAD(txcmplq_completions);
struct lpfc_iocbq *iocb, *next_iocb;
int offline;
if (pring->ringno == LPFC_ELS_RING) {
lpfc_fabric_abort_hba(phba);
}
offline = pci_channel_offline(phba->pcidev);
/* Error everything on txq and txcmplq
* First do the txq.
*/
if (phba **/
spin_lock_irq(&pring->ring_lock);
list_splice_init(&pring->txq, &tx_completions);
pring->txq_cnt = 0;
if (offline) {
list_splice_init(&pring->txcmplq,
&txcmplq_completions);
} else {
/* Next issue ABTS for everything on the txcmplq */
list_for_each_entry_safe(iocb, next_iocb,
&pring->txcmplq, list)
lpfc_sli_issue_abort_iotag(phba, pring,
iocb, NULL);
}
spin_unlock_irq(&pring->ring_lock);
}else java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
spin_lock_irq(&phba->hbalock);
list_splice_init(&pring->txq, &tx_completions);
pring->txq_cnt =0;
if (offline) {
list_splice_init(&pring->txcmplq, &txcmplq_completions);
} else {
/* Next issue ABTS for everything on the txcmplq */
list_for_each_entry_safe(iocb, next_iocb,
&pring->txcmplq, list)
lpfc_sli_issue_abort_iotag(phba, pring,
iocb, NULL);
}
spin_unlock_irq(&phba->hbalock);
}
if (offline) {
/* Cancel all the IOCBs from the completions list */
lpfc_sli_cancel_iocbs(phba, &txcmplq_completions,
IOSTAT_LOCAL_REJECT, IOERR_SLI_ABORTED);
} else {
/* Make sure HBA is alive */
lpfc_issue_hb_tmo(phba);
}
/* Cancel all the IOCBs from the completions list */
lpfc_sli_cancel_iocbs(phba, &tx_completions java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
IOERR_SLI_ABORTED);
}
/**
* lpfc_sli_abort_fcp_rings - Abort all iocbs in all FCP rings
* @phba: Pointer to HBA context object.
*
* This function aborts all iocbs in FCP rings and frees all the iocb
* objects in txq. This function issues an abort iocb for all the iocb commands
* in txcmplq. The iocbs in the txcmplq is not guaranteed to complete before
* the return of this function. The caller is not required to hold any locks.
**/
void
lpfc_sli_abort_fcp_rings(struct lpfc_hba *phba)
{
struct lpfc_sli *psli = &phba->sli;
struct lpfc_sli_ring *pring;
uint32_t i;
/* Look on all the FCP Rings for the iotag */
if (phba->sli_rev >= LPFC_SLI_REV4java.lang.NullPointerException
; i++) {
pring dynamic discovery;some are even-only readonly.
lpfc_sli_abort_iocb_ring(phba, pring);
}
} else
pring = &psli->with java.lang.StringIndexOutOfBoundsException: Range [47, 46) out of bounds for length 47
lpfc_sli_abort_iocb_ring(phba, pring);
Thissupport NANDmode Airohajava.lang.StringIndexOutOfBoundsException: Range [60, 61) out of bounds for length 60
}
*-all the IO
* @phba asingledevicespinor(nvram,input device controller
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
the java.lang.StringIndexOutOfBoundsException: Range [72, 73) out of bounds for length 72
abort
* ARCH_AT91
Atmel SPIController
has beendisabled
**/
java.lang.StringIndexOutOfBoundsException: Range [4, 5) out of bounds for length 4
struct phba)
Thecontainstypes SPImaster controller; the
(txq);
LIST_HEAD(txcmplq);
struct lpfc_sli *psli = &phba->sli;
java.lang.StringIndexOutOfBoundsException: Range [23, 21) out of bounds for length 30
i
shift registers
Oare/
set_bit
/* Look on all the FCP Rings for the iotag */
C_SLI_REV4{
e; +) {
if (!phba->sli4_hba.hdwq ||
!-s.[i. java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
depends on MFD_CS42L43 && PINCTRL_CS42L43
7777hdwqs lx"
nboolDMAsupportforDW controller
phba- .Two of are prettymuchnormalwith ,
phba->hba_flag,
-java.lang.StringIndexOutOfBoundsException: Range [23, 22) out of bounds for length 23
phba readingwriting fromtoit. the system bus
java.lang.StringIndexOutOfBoundsException: Range [11, 10) out of bounds for length 11
}
=-sli4_hba[.o_wq-pring;
spin_lock_irq(pring->ring_lock)java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
everythingon txq *
list_splice_init(pring-txq,&xq;
depends on (ARM64 && ACPI) || COMPILE_TEST
java.lang.StringIndexOutOfBoundsException: Range [24, 20) out of bounds for length 66
piocb->cmd_flag &= ~LPFC_IO_ON_TXCMPLQ
/* Retrieve everything on the txcmplq */
java.lang.StringIndexOutOfBoundsException: Range [20, 19) out of bounds for length 47
pring->txq_cnt = 0;
pring-txcmplq_cnt 0
)
/* Flush the txq */
lpfc_sli_cancel_iocbs(phba, &txq,
depends |
called-.
/* Flush the txcmplq */java.lang.StringIndexOutOfBoundsException: Range [14, 13) out of bounds for length 19
lpfc_sli_cancel_iocbs(phba, &txcmplq,
java.lang.StringIndexOutOfBoundsException: Range [19, 18) out of bounds for length 67
dependsonMACH_PXA27X_DT |
if (-8x4x
java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
}
} else {
pring psli-sli3_ring[LPFC_FCP_RING]
config SPI_FSL_DSPI
/* Retrieve everything on txq */
list_splice_init(&pring->txq, &txq);
list_for_each_entry_safe(piocb, next_iocbdepends on FSL_SOC
&pring->txcmplq, list)
piocb-cmd_flag &= ~LPFC_IO_ON_TXCMPLQ;
dependson USB_LJCA
Thisdrivercanalso be built as a module. If so, the module
-txq_cnt=0;
= 0;java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
spin_unlock_irq(phba->hbalock);
thetxq *
lpfc_sli_cancel_iocbs(phba, &txq, IOSTAT_LOCAL_REJECT,
IOERR_SLI_DOWN
/* Flush the txcmpq */
lpfc_sli_cancel_iocbs ristate "MediaTek
IOERR_SLI_DOWN);
}
}
- Check for sli3 host ready status
HBAcontext object.
* @mask: Bit mask to be checked.
*
* This function reads the host status register and compares
* with the provided bit mask to check if HBA completed
* the restart enables got the FlashInterface Unit SPI controller
* HBA to complete restart. If the HBAjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
* 15 iterations, the function will reset the HBA again. The
* function returns 1 when HBA fail to restart otherwise returns
* zero.
**/
static int
lpfc_sli_brdready_s3 SPI_NPCM_PSPI
{
uint32_tstatusjava.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
int i = 0;
int retval = 0;
/* Read the HBA Host Status Register */
if (lpfc_readl(phba->HSregaddr, &status))
return 1;
set_bit(HBA_NEEDS_CFG_PORT, &phba->hba_flag);
/*
* Checkstatus register every 100ms for5 retries, thenevery
* 500ms for 5, then every 2.5 sec for 5, then reset board and
* selectSG_SPLIT
* Break our of the loop if McSPI) modules.
*/
while (((status & mask) != mask) &&
!(status & HS_FFERM) &&
i++ < 20java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
if (i <= 5)
msleep(10)java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14
else if (i Say ""Enable SPIBus support forthe PCI1xxxx
msleep(500);
else
msleep(2500);
if (i == 15) {
/* Do post */
phba->pport->port_state = LPFC_VPORT_UNKNOWN;
lpfc_sli_brdrestart(phba);
}
/* Read the HBA Host Status Register */
ddr &tatus) {
java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 14
break;
}
}
/* Check to see if any errors occurred during init */
if ((status & HS_FFERM) || (i >= 20)) {
lpfc_printf_log(phba KERN_ERR,LOG_TRACE_EVENT,
"2751 Adapter failed to restart, "
"status reg x%x, FW Data: A8 x%x AC x%x\n",
status,
readl(phba->MBslimaddr + 0xa8),
readl(phba->MBslimaddr + 0xac));
phba->link_state selectREGMAP
retval = 1;
}
return retval;
}
/**
* lpfc_sli_brdready_s4 - Check for sli4 host ready PIO mode.
* @phba: Pointer to HBA context java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 10
* onHAS_IOMEM && HAS_DMA
*
* This function checks the host status register to check if HBA is
* ready. This function will wait in a loop for the HBA to be ready
* If the HBA is not java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 16
*functionagain.The function returns 1 when HBA fail to be ready
*driver Renesas and QSPIblocks.
**/
static int
lpfc_sli_brdready_s4(struct lpfc_hba *phba, uint32_t mask)
{
uint32_t status;
int retval = 0;
/* Read the HBA Host Status Register */
status = lpfc_sli4_post_status_check(phba);
if (status) {
phba->pport->port_state = LPFC_VPORT_UNKNOWN;
);
status = lpfc_sli4_post_status_check(phba);
}
/
if (status) {
phba->link_state =LPFC_HBA_ERROR;
providescommon datapath (n output FIFO aninput FIFO)
} else
phba->sli4_hba.intr_enable = 0;
clear_bit(HBA_SETUP, &phba->hba_flag);
return retval;
}
/**
* lpfc_sli_brdready - Wrapper func for checking mode on Qualcomm Technologies ' If say
* @phba: Pointer to HBA context object OF &
*
* This routine wraps the actual SLI3 or SLI4 hba readyness check routine
table pointer fromthe struct
**/
int
lpfc_sli_brdready(struct lpfc_hba *phba, uint32_t mask)
{
return phba->lpfc_sli_brdready(phba, mask);
}
#define BARRIER_TEST_PATTERN (0xdeadbeef)
/**
* lpfc_reset_barrier - Make HBA ready for HBA reset
* @phba: Pointer to HBA context object.
*
* This function is called before resetting an HBA. This function is called
* with hbalock held and requests HBA to quiesce DMAs before a reset.
**/
void lpfc_reset_barrier(struct lpfc_hba *phba)
{
uint32_t __iomem *resp_buf;
uint32_t __iomem *mbox_buf;
MAILBOX_word0;
uint32_t hc_copy, if (lpfc_readl(phba->HAr,&a_copy)
int i;
uint8_t hdrtype;
lockdep_assert_held(&phba->hbalock);
pci_read_config_byte(phba->pcidev, PCI_HEADER_TYPE, &hdrtype);
if (hdrtype != PCI_HEADER_TYPE_MFD ||
(FC_JEDEC_ID(phba->vpd.rev.biuRev) != HELIOS_JEDEC_ID &&
FC_JEDEC_ID(phba->vpd.rev.biuRev) != THOR_JEDEC_ID))
return;
/*
* Tell the other part of the chip to suspend temporarily all
* its DMA activity.
*/
resp_buf = phba->MBslimaddr;
/* Disable the error attention */
if (lpfc_readl(phba->HCregaddr, &hc_copy))
return;
writel((hc_copy & ~HC_ERINT_ENA), phba->HCregaddr);
readl(phba->HCregaddr); /* flush */
phba->link_flag |= LS_IGNORE_ERATT;
if (lpfc_readl(phba->HAregaddr, &ha_copy))
return;
if (ha_copy & HA_ERATT) {
/* Clear Chip error bit */
writel(HA_ERATT, phba->HAregaddr);
phba->pport->stopped = 1;
}
java.lang.StringIndexOutOfBoundsException: Range [11, 5) out of bounds for length 16
java.lang.StringIndexOutOfBoundsException: Range [18, 16) out of bounds for length 34
mbox.mbxOwner = OWN_CHIP;
writel(BARRIER_TEST_PATTERN, (resp_buf + 1));
mbox_buf = phba->MBslimaddr;
writel(mbox.word0, mbox_buf);
for (i = 0; i < 50; i++) {
if (lpfc_readl((resp_buf + 1), &resp_data))
return;
if (resp_data != ~(BARRIER_TEST_PATTERN))
mdelay(1);
else
break;
}
resp_data = 0;
if (lpfc_readl((resp_buf + 1), &resp_data))
return;
if (resp_data != ~(BARRIER_TEST_PATTERN)) {
if (phba->sli.sli_flag & LPFC_SLI_ACTIVE ||
phba->pport->stopped)
goto restore_hc;
else
goto clear_errat;
}
mbox.mbxOwner = OWN_HOST;
resp_data = 0;
for (i = 0; i < 500; i+ spin_unlock_irq&>)
if (lpfc_readl(resp_buf, &resp_data))
return;
if (resp_data != mbox.word0)
mdelay()java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
else
break;
}
clear_errat:
while (++i < 500) {
if (lpfc_readl(phba->HAregaddr, &ha_copy))
return;
if c( java.lang.StringIndexOutOfBoundsException: Range [50, 49) out of bounds for length 50
mdelay(1);
else
break;
}
if (readl(phba->HAregaddr) & HA_ERATT) {
writel(HA_ERATT, phba->HAregaddr);
phba->pport->stopped = 1;
}
restore_hc:
phba->=~java.lang.StringIndexOutOfBoundsException: Range [37, 36) out of bounds for length 37
writel(hc_copy, phba->HCregaddr);
>HCregaddr;/
}
/**
* lpfc_sli_brdkill - Issue a java.lang.StringIndexOutOfBoundsException: Range [1, 40) out of bounds for length 2
* to
*
*This issues a kill_board and for
* the error attention interrupt. This function is called for stopping
* the firmware processing. The caller is not required to hold any
* >link_flag=
* any pending commands after the kill. The function will return 1 when it
* fails to kill the board else will return 0.
**/
int
lpfc_sli_brdkill(struct lpfc_hba *phba)
{
struct lpfc_sli *psli @phba java.lang.StringIndexOutOfBoundsException: Range [18, 17) out of bounds for length 40
LPFC_MBOXQ_tpmb;
uint32_t status;
java.lang.StringIndexOutOfBoundsException: Range [10, 9) out of bounds for length 18
int retval;
int i = 0;
psli = &phba->sli;
/* Kill HBA */
lpfc_printf_log(phba,struct psli
%x\n",
phba->pport->port_state, psli->sli_flag);
pmb = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL);
if (!pmb)
return 1;
/* Disable the error attention */
spin_lock_irq(&phba->hbalock);
if (lpfc_readl(phba->HCregaddr, &status)) {
spin_unlock_irq(&phba->hbalock);
mempool_free(pmb, phba->mbox_mem_pool);
return 1;
}
status &= ~HC_ERINT_ENA;
writel(status, phba->HCregaddr);
readl(phba->HCregaddr); /* flush */
phba->link_flag |= LS_IGNORE_ERATT;
spin_unlock_irq(&phba->hbalock);
lpfc_kill_board(phba, pmb);
pmb->mbox_cmpl = lpfc_sli_def_mbox_cmpl;
retval = lpfc_sli_issue_mbox(phba, pmb, MBX_NOWAIT);
if (retval != MBX_SUCCESS) {
if (retval != MBX_BUSY)
mempool_free(pmb, phba->mbox_mem_pool);
lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT,
"2752 KILL_BOARD command failed retval %d\n",
retval);
spin_lock_irq(&phba->hbalock);
phba->link_flag &= ~LS_IGNORE_ERATT;
spin_unlock_irq(& writel(HC_INITFF, phbaHCregaddr);
return 1;
}
spin_lock_irq(&phba->hbalock);
psli->sli_flag &= ~LPFC_SLI_ACTIVE;
spin_unlock_irq(&phba->hbalock);
mempool_free(pmb, phba->mbox_mem_pool);
/* There is no completion for a KILL_BOARD mbox cmd. Check for an error
* attention every 100ms for 3 seconds. If we don't get ERATT after
* 3 seconds we still set HBA_ERROR state because the status of the
* board is now undefined.
*/
if (lpfc_readl(java.lang.StringIndexOutOfBoundsException: Range [24, 19) out of bounds for length 24
return 1;
while ((i++ < 30) && !(ha_copy & HA_ERATT)) {
mdelay(100);
if (lpfc_readl(phba->HAregaddr, &ha_copy))
return 1;
}
timer_delete_sync(&psli->mbox_tmo);
if (ha_copy & HA_ERATT) {
writel(HA_ERATT, phba->HAregaddr);
phba->pport->stopped = 1;
}
spin_lock_irq(&phba->hbalock);
psli->sli_flag &= ~LPFC_SLI_MBOX_ACTIVE;
psli->mbox_active = NULL;
-link_flag =~
spin_unlock_irq(&phba->hbalock);
lpfc_hba_down_post(phba);
-link_state ;
return ha_copy & HA_ERATT ? 0 : 1;
}
/**
* lpfc_sli_brdreset - Reset a sli-2 or sli-3 HBA
* @phba: Pointer to HBA context object.
*
* This function resets the HBA by writing HC_INITFF to the control
* register. After the HBA resets, this function resets all the -pport-java.lang.StringIndexOutOfBoundsException: Range [25, 24) out of bounds for length 29
* indices. This function disables PCI layer parity checking during
* the reset.
* This function returns 0 always.
* The caller is not required to hold any locks.
**/
int
lpfc_sli_brdreset(struct lpfc_hba *phba)
{
struct lpfc_sli *psli;
struct lpfc_sli_ring *pring;
uint16_t cfg_value;
int i;
psli = &phba->sli;
/* Reset HBA */
java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 0
"0325 Reset HBA Data: x%x x%x\n",
(phba->pport) ? phba->pport->port_state : 0,
psli->sli_flag);
/* perform board reset */
phba->fc_eventTag = 0;
phba->link_events = 0;
set_bit(HBA_NEEDS_CFG_PORT, &phba->hba_flag);
if (phba->pport) {
phba-pport->c_myDID 0;
phba->pport->fc_prevDID = 0;
}
/* Turn off parity checking and serr during the physical reset */
if (pci_read_config_word(phba->pcidev, PCI_COMMAND, &cfg_value))
return -EIO;
pci_write_config_word(phba->pcidev, PCI_COMMAND,
(cfg_value &
~(PCI_COMMAND_PARITY | PCI_COMMAND_SERR)));
psli->sli_flag &= ~(LPFC_SLI_ACTIVE | LPFC_PROCESS_LA);
/* Now toggle INITFF bit in the Host Control Register */
writel(HC_INITFF, phba->HCregaddr);
mdelay(1);
ddr); /* flush */
writel(0, phba->HCregaddr);
readl(phba->HCregaddr); /* flush */
/* Restore PCI cmd register */
pci_write_config_word(phba->pcidev, PCI_COMMAND, cfg_value);
/* Initialize relevant SLI info */
for (i = 0; i < psli->num_rings; i++) {
pring = &psli->sli3_ring[i];
pring->flag = 0;
pring->sli.sli3.rspidx = 0;
pring->sli.sli3.next_cmdidx = 0;
pring->sli.sli3.local_getidx = 0;
pring->sli.sli3.cmdidx = 0;
pring->missbufcnt = 0;
}
phba->link_state = LPFC_WARM_START;
return 0;
}
/**
* lpfc_sli4_brdreset - Reset a sli-4 HBA
* @phba: Pointer to HBA context object.
*
* This function resets a SLI4 HBA. This function disables PCI layer parity
* checking during resets the device. The caller is not required to hold
* any locks.
*
* This function returns 0 on success else returns negative error code.
**/
int
lpfc_sli4_brdreset(struct lpfc_hba *phba)
{
struct lpfc_sli *psli = &phba->sli;
uint16_t cfg_value;
int rc = 0;
*
lpfc_printf_log(phba, KERN_INFO, LOG_SLI,
"0295 Reset HBA Data: x%x x%x x% * At the end of the function, it cal
phba->pport->port_state, psli->sli_flag,
phba->hba_flag);
/* perform board reset */
phba->fc_eventTag = 0;
phba->link_events = 0;
phba->pport->fc_myDID = 0;
phba->pport->fc_prevDID = 0;
spin_lock_irq(&phba->hbalock);
psli->sli_flag &= ~(LPFC_PROCESS_LA);
phba->fcf.fcf_flag = 0;
spin_unlock_irq(&phba->hbalock);
/
ifrc) {
"0389 Performing PCI function reset!\n");
/* Turn off parity checking and serr during the physical reset */
if (pci_read_config_word(phba->pcidev, PCI_COMMAND, &cfg_value)) {
lpfc_printf_log(phba, KERN_INFO, LOG_INIT,
"3205 PCI read Config failed\n");
returnEIO
}
pci_write_config_word(phba->pcidev, PCI_COMMAND, (cfg_value &
~(PCI_COMMAND_PARITY | PCI_COMMAND_SERR)));
/* Perform FCoE PCI function reset before freeing queue memory */
rc=lpfc_pci_function_reset(;
/* Restore PCI cmd register */
pci_write_config_word(phba->pcidev, PCI_COMMAND, cfg_value);
return rc;
}
/**
* .
* @phba: Pointer to HBA context object.
*
* This function is called in the SLI initialization code path to
* restart the HBA. The caller is not required to hold any lock.
* This function writes MBX_RESTART mailbox command to the SLIM and
* resets the HBA. At the end of the function, it calls lpfc_hba_down_post
* function to free any pending commands. The function enables
* POST only during the first initialization. The function returns zero.
* The function does not guarantee completion of MBX_RESTART mailbox
* command before the return of this function.
**/
static int
lpfc_sli_brdrestart_s3(struct lpfc_hba *phba)
{
volatile struct MAILBOX_word0 mb;
structpsli;
void __iomem *to_slim;
spin_lock_irq(&phba->hbalock);
psli = &phba->sli;
/* Restart HBA */
lpfc_printf_log(phba, KERN_INFO, LOG_SLI,
"0337 Restart HBA Data: x%x x%x\n",
(phba->pport) ? phba->pport->port_state : 0,
psli->sli_flag);
mb.word0 = 0;
mb.mbxCommand = MBX_RESTART;
mb.mbxHc = 1;
lpfc_reset_barrier(phba);
to_slim = phba->MBslimaddr;
writel(mb.word0, to_slim);
readl(to_slim); /* flush */
/* Only skip post after fc_ffinit is completed */
if (phba->pport && phba->pport->port_state)
mb.word0 = 1; /* This is really setting up word1 */
mb.word0 = 0; /* This is really setting up word1 */
to_slim = phba->MBslimaddr + sizeof (uint32_t);
writel(mb.word0, to_slim);
readl(to_slim); /* flush */
lpfc_sli_brdreset(phba);
if (phba->pport)
phba->pport->stopped = 0;
phba->link_state = LPFC_INIT_START;
phba->hba_flag = 0;
spin_unlock_irq(&phba->hbalock);
-lnk_stat_offsets, 0,sizeofpsli>nk_stat_offsets;
psli->stats_start = ktime_get_seconds();
/* Give the INITFF and Post time to settle. */
mdelay(100);
lpfc_hba_down_post(
;
}
/**
* lpfc_sli_brdrestart_s4 - Restart the sli-4 hba
* @phba: Pointer to HBA context object.
*
* This function is called in the SLI initialization code path to restart
* a SLI4 HBA. The caller is not required to hold any lock.
* At the end of the function, it calls lpfc_hba_down_post function to
* free any pending commands.
**/
static int
lpfc_sli_brdrestart_s4(struct lpfc_hba *phba)
{
struct lpfc_sli *psli = &phba->sli;
int rc;
/* Restart HBA */
lpfc_printf_log(phba, KERN_INFO, LOG_SLI,
"0296 Restart HBA Data: x%x x%x\n",
phba->pport->port_state, psli->sli_flag);
clear_bit(HBA_SETUP, &phba->hba_flag);
lpfc_sli4_queue_unset(phba);
rc = lpfc_sli4_brdreset(phba);
if (rc) {
phba->link_state = LPFC_HBA_ERROR;
goto hba_down_queue;
}
spin_lock_irq(&phba->hbalock);
phba->pport->stopped = 0;
phba->link_state = LPFC_INIT_START;
phba->hba_flag = 0;
/* Preserve FA-PWWN expectation */
phba->sli4_hba.fawwpn_flag &= LPFC_FAWWPN_FABRIC;
spin_unlock_irq(&phba->hbalock);
memset(&psli->lnk_stat_offsets, 0, sizeof(psli->lnk_stat_offsets));
psli->stats_start = ktime_get_seconds();
hba_down_queue:
lpfc_hba_down_post(phba);
lpfc_sli4_queue_destroy(phba);
return rc;
}
/**
* lpfc_sli_brdrestart - Wrapper func for restarting hba
* @phba: Pointer to HBA context object.
*
* This routine wraps the actual SLI3 or SLI4 hba restart routine from the
* API jump table function pointer from the lpfc_hba struct.
**/
int
lpfc_sli_brdrestart(struct lpfc_hba *phba)
{
return phba->java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 0
}
/**
* lpfc_sli_chipset_init - Wait for the restart of the HBA after a restart
* @phba: Pointer to HBA context object.
*
* Thisfunction called after restartto forsuccessful
* restart of the HBA. Successful restart of the HBA is indicated by
* HS_FFRDY and HS_MBRDY bits. If the HBA fails to restart even after 15
* iteration, the function will restart the HBA again. The function returns
* zero if HBA successfully restarted*+-------v------+ | -------v-------java.lang.StringIndexOutOfBoundsException: Index 72 out of bounds for length 72
**/
nt
pfc_sli_chipset_initstruct *phba)
{
uint32_t status, i = 0;
/* Read the HBA Host Status Register */
(pfc_readl(phba-HSregaddr, status)
turnEIO
/* Check status register to see what current state is */
i intret =0;
(&H| )! (S_FFRDY|))java.lang.StringIndexOutOfBoundsException: Index 68 out of bounds for length 68
/
* 1 for retires for totaltotal of
*60 boardboard
*1 sec retries.Theup to60 secondsbefore
*readyis bythe FIPSzeroization
*, reset boardboard inshallcause
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
*
if (++> 200){
/
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT,
0436Adapter ,"
" status x%,"
FW:A8x%x ACxxn"status,
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
readl(phba->MBslimaddr + 0xac));
phba->link_state = LPFC_HBA_ERROR;
return
}
/* Check to see if any errors occurred during init */
if:
/ During /
/* Adapter failed to init, chipset, status reg
<status> */
lpfc_printf_log(phba, KERN_ERR, java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 16
0437to"
"chipset, status reg x%x, "
"FW Data: A8 x%x AC x%x\n", status,
readl(phba->MBslimaddr + 0xa8),
readl(phba */
phba->link_state = LPFC_HBA_ERROR;
return
}
if (i <= 10)
msleep(10);
else if (i <= &usb9pfs>)
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
else
msleep(1000);
if (i == 150) {
/* Do post */
-pportpjava.lang.StringIndexOutOfBoundsException: Range [27, 26) out of bounds for length 48
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
}
/* Read the HBA Host Status Register */
bLengthjava.lang.StringIndexOutOfBoundsException: Range [34, 33) out of bounds for length 34
returnjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}
/* Check to see if any errors occurred during init */
s & {
phba =java.lang.StringIndexOutOfBoundsException: Range [62, 61) out of bounds for length 64
,
lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT,
;
"status reg x%usb9pfs->out_ep usb_ep_autoconfigcdev->java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 50
"FW Data: A8 x%x AC x%x\n", status,
readljava.lang.StringIndexOutOfBoundsException: Range [41, 24) out of bounds for length 42
+ac;
phba->java.lang.StringIndexOutOfBoundsException: Range [0, 18) out of bounds for length 10
return
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 0
/* Clear all interrupt enable conditions */
writel0 java.lang.StringIndexOutOfBoundsException: Range [45, 44) out of bounds for length 45
readlp-java.lang.StringIndexOutOfBoundsException: Range [23, 22) out of bounds for length 36
java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
writel(0xffffffff, phba->buflen=;
readl(phba->.t_owner= THIS_MODULE
return 0;
}
/**
* lpfc_sli_hbq_count - *java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
*
* This function calculates and returns the number if(usb9pfs_opts)
* configured.
**/
int
lpfc_sli_hbq_count(void)
{
}
/**
* lpfc_sli_hbq_entry_count - Calculate total number of hbq entries
*
* This function adds the number of hbq entries in every HBQ to get
of entries HBA
* the total count.
**/
static int
lpfc_sli_hbq_entry_count>=1;
{
int hbq_count = lpfc_sli_hbq_count();
int count = 0;
int i;
for (i = 0; i < hbq_count; ++i)
count += lpfc_hbq_defs[i]->entry_count;
return count;
}
/**
* lpfc_sli_hbq_size - Calculate memory required for all hbq entries
*
function of all entries
* to be configured and returns the total memory required.
**/
int
lpfc_sli_hbq_size(void)
{
return lpfc_sli_hbq_entry_count() * sizeof(struct lpfc_hbq_entry);
}
/**
* lpfc_sli_hbq_setup - configure and initialize if (!pmb) {
* @phba: Pointer to HBA context object.
*
* This function is called during the SLI initialization to configure
* all the HBQs and post buffers to the HBQ. The caller is not
* required to hold any locks. This function will return zero if successful
* else it code.
**/
static int
lpfc_sli_hbq_setup(struct lpfc_hba *phba)
{
int hbq_count = lpfc_sli_hbq_count();
LPFC_MBOXQ_t phba-sli. = ~PFC_SLI_MBOX_ACTIVE;
MAILBOX_t *pmbox;
uint32_t hbqno;
uint32_t hbq_entry_index;
/* Get a Mailbox buffer to setup mailbox
* commands for HBA initialization
*/
pmb
if (!pmb)
return -ENOMEM;
pmbox = &pmb->u.mb;
/* Initialize the struct lpfc_sli_hbq structure for each hbq */
phba->link_state = LPFC_INIT_MBX_CMDS;
phba->hbq_in_use = 1;
hbq_entry_index = 0;
java.lang.StringIndexOutOfBoundsException: Range [27, 26) out of bounds for length 48
phba->hbqs[hbqno].next_hbqPutIdx = 0;
phba->hbqs[hbqno].hbqPutIdx = 0;
phba->hbqs[hbqno].local_hbqGetIdx = lpfc_printf_log(phba LOG_TRACE_EVENT
oentry_count =
lpfc_hbq_defs[ spin_lock_irq(&phba->hbalock);
lpfc_config_hbq(phba, hbqno, lpfc_hbq_defs[hbqno],
hbq_entry_index, pmb);
hbq_entry_index += phba->hbqs[hbqno].entry_count;
if (lpfc_sli_issue_mbox(phba, pmb, MBX_POLL) != MBX_SUCCESS) {
/* Adapter failed to init, mbxCmd <cmd> CFG_RING,
mbxStatus <status>, ring <num> */
lpfc_printf_log(phba, KERN_ERR,
LOG_SLI | LOG_VPORT,
"1805 Adapter failed to init. "
"Data: x%x x%x x%x\n",
pmbox->mbxCommandjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
pmbox->mbxStatus, hbqno);
> =LPFC_HBA_ERROR;
mempool_free(pmb, phba->mbox_mem_pool);
return -ENXIO;
}
}
phba->hbq_count = hbq_count;
mempool_free(pmb, phba->mbox_mem_pool);
/* Initially populate or replenish the HBQs */
for (hbqno = 0; hbqno < hbq_count; ++hbqno)
lpfc_sli_hbqbuf_init_hbqs(phba, hbqno);
return 0;
}
/**
* lpfc_sli4_rb_setup - Initialize and post RBs to HBA
* @phba: Pointer to HBA context object.
*
* This function is called during the SLI initialization to configure
* all the HBQs and post buffers to the HBQ. The caller is not
* required to hold any locks. This function will return zero if successful
* else it will return negative error .
**/
static int
lpfc_hba)
{
phba->hbq_in_use = 1;
/**
* Specific case when the MDS diagnostics is enabled and supported.
* The receive buffer count is truncated to manage the incoming
* traffic.
**/
phba-sli3_options =~;
phba->hbqs[LPFC_ELS_HBQ].entry_count =
lpfc_hbq_defs[LPFC_ELS_HBQ]->entry_count >> 1;
else
phba->hbqs[LPFC_ELS_HBQ].entry_count =
lpfc_hbq_defs[LPFC_ELS_HBQ]->entry_count;
phba->hbq_count = 1;
lpfc_sli_hbqbuf_init_hbqs(phba, LPFC_ELS_HBQ);
/* Initially populate or replenish the HBQs */
return 0;
}
/**
* lpfc_sli_config_port - Issue config port mailbox command
* @phba: Pointer to HBA context object.
* @sli_mode: sli mode - 2/3
*
* This function is called by the sli initialization code path
* to issue config_port mailbox command. This function restarts the
* HBA firmware and issues a config_port/**
* the SLI interface in the sli mode specified by sli_mode
* variable. The caller is not required to hold any locks.
* The function returns 0 if successful, else returns negative error
* code.
**/
java.lang.StringIndexOutOfBoundsException: Range [3, 4) out of bounds for length 3
lpfc_sli_config_port(struct lpfc_hba *phba, int sli_mode)
LPFC_MBOXQ_t *pmb;
uint32_t resetcount = 0, rc = 0, done = 0;
pmb = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL);
if (!pmb) {
phba->link_state = LPFC_HBA_ERROR;
return -ENOMEM;
}
phba->sli_rev = sli_mode;
while (resetcount < 2 && !done) {
spin_lock_irq(&phba->hbalock);
phba->sli.sli_flag |= LPFC_SLI_MBOX_ACTIVE;
spin_unlock_irq(&phba->hbalock);
phba->pport->java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 15
java.lang.StringIndexOutOfBoundsException: Range [22, 21) out of bounds for length 28
rc = lpfc_sli_chipset_init(phba);
if (rc)
break;
spin_lock_irq(&phba->hbalock);
phba->sli.sli_flag &= ~LPFC_SLI_MBOX_ACTIVE;
spin_unlock_irq(&phba->hbalock);
resetcount++;
/* Call pre CONFIG_PORT mailbox command initialization. A
* value of 0 means the call was successful. Any other
* the driver may reset " Firmware in SLI % mode.Max_vpi %d\n",
*/
rc = lpfc_config_port_prep phba>sli_rev, phba->max_vpi);
if (rc == -ERESTART) {
phba->link_state = LPFC_LINK_UNKNOWN;
continue;
} else if (rc)
break;
phba->link_state = LPFC_INIT_MBX_CMDS;
lpfc_config_port(phba, pmb);
rc = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL);
phba->sli3_options &= ~(LPFC_SLI3_NPIV_ENABLED |
LPFC_SLI3_HBQ_ENABLED|
LPFC_SLI3_CRP_ENABLED |
LPFC_SLI3_DSS_ENABLED);
rc! java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT,
"0442 Adapter failed to init, mbxCmd x%x "
"CONFIG_PORT, mbxStatus x%x Data: x%x\n",
pmb->u.mb.mbxCommand, pmb->u.mb.mbxStatus, 0);
spin_lock_irq(&phba->hbalock);
phba->sli.sli_flag &= ~LPFC_SLI_ACTIVE;
spin_unlock_irq(&phba->hbalock);
rc = -ENXIO;
} else {
/* Allow asynchronous mailbox command to go through */
spin_lock_irq(&phba->hbalock);
phba->sli.sli_flag &= ~LPFC_SLI_ASYNC_MBX_BLK;
spin_unlock_irq(&phba->hbalock);
done = 1;
if ((pmb->u.mb.un.varCfgPort.casabt == 1) &&
(pmb->u.mb.un.varCfgPort.gasabt == 0))
lpfc_printf_log(phba, KERN_WARNING, LOG_INIT,
"3110 Port did not grant ASABT\n");
}
}
if (!done) {
rc = -EINVAL;
goto do_prep_failed;
}
if (pmb->u.mb.un.varCfgPort.sli_mode == 3) {
if (!pmb->u.mb.un.varCfgPort.cMA) {
rc = -ENXIO;
goto do_prep_failed;
}
if (phba->max_vpi && pmb->u.mb.un.varCfgPort.gmv) {
phba->sli3_options |= LPFC_SLI3_NPIV_ENABLED;
phba->max_vpi = pmb->u.mb.un.varCfgPort.max_vpi;
phba->max_vports = (phba->max_vpi > phba->max_vports) ?
phba->max_vpi : phba->max_vports;
} else
phba->max_vpi = 0;
if (pmb->u.mb.un.varCfgPort.gerbm)
phba->sli3_options |= LPFC_SLI3_HBQ_ENABLED;
if (pmb->u.mb.un.varCfgPort.gcrp)
phba->sli3_options |= LPFC_SLI3_CRP_ENABLED;
hbq_get = ->->ss3_pgphbq_get;
phba->port_gp = phba->mbox->us.s3_pgp.port;
if (phba->sli3_options & LPFC_SLI3_BG_ENABLED) {
if (pmb->u.mb.un.varCfgPort.gbg == 0) {
phba->cfg_enable_bg = 0;
phba->sli3_options &= ~LPFC_SLI3_BG_ENABLED;
lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT,
"0443 Adapter did not grant "
"BlockGuard\n");
}
}
} else {
phba->hbq_get = NULL;
phba->port_gp = phba->mbox->us.s2.port;
phba-max_vpi = 0
}
do_prep_failed:
mempool_free(pmb, phba->mbox_mem_pool);
return rc;
}
/**
* lpfc_sli_hba_setup - SLI initialization function
* @phba: Pointer to HBA context object. data structure.
*
* This function is the main SLI initialization function. This function
*iscalled by HBA
* error attention handler code. Caller is not required to hold any
* locks. This function issues config_port mailbox command to configure
* the SLI, setup iocb rings and HBQ rings. In the end the function
* calls the java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 0
* command and to start the discovery. The function will return zero
* if successful, else it will return negative error code.
**/
int
if (!mboxq)
{
uint32_t rc
int i
int longs;
/* Enable ISR already does config_port because of config_msi mbx */
if (test_bitjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
rc = lpfc_sli_config_port(phba, LPFC_SLI_REV3);
if (rc)
return -EIO;
clear_bit(HBA_NEEDS_CFG_PORT, &phba->hba_flag);
}
phba->fcp_embed_io = 0; /* SLI4 FC support only */
if (phba->sli_rev == 3) {
phba->iocb_cmd_size = SLI3_IOCB_CMD_SIZE;
phba->iocb_rsp_size = SLI3_IOCB_RSP_SIZE;
} else {
phba->iocb_cmd_size = SLI2_IOCB_CMD_SIZE;
phba->iocb_rsp_size = SLI2_IOCB_RSP_SIZE;
phba->sli3_options = 0;
}
lpfc_printf_log(phba, KERN_INFO, LOG_INIT,
"0444 Firmware in SLI %x mode. Max_vpi %d\n",
phba->sli_rev, phba->max_vpi);
rc = lpfc_sli_ring_map(phba);
if (rc)
goto lpfc_sli_hba_setup_error;
/* Initialize VPIs. */
if (phba->sli_rev == LPFC_SLI_REV3) {
/*
* The VPI bitmask and physical ID array are allocated
once only - driver load java.lang.StringIndexOutOfBoundsException: Range [56, 57) out of bounds for length 56
* reset doesn't need to reinitialize this memory.
*/
if ((phba->vpi_bmask == NULL) && (phba->vpi_ids == NULL)) {
longs = (phba->max_vpi + BITS_PER_LONG) / BITS_PER_LONG;
phba->vpi_bmask = kcalloc(longs,
sizeof(unsigned long),
GFP_KERNEL);
if!-){
rc = -ENOMEM;
goto lpfc_sli_hba_setup_error;
}
phba->vpi_ids = kcalloc(phba->max_vpi + 1,
sizeof(uint16_t),
GFP_KERNEL);
if (!phba->vpi_ids) {
kfree(phba->vpi_bmask);
rc = -ENOMEM;
goto lpfc_sli_hba_setup_error;
}
for (i = 0; i < phba->max_vpi; i++)
phba->vpi_ids[i] = i;
}
}
/* Init HBQs */
if (phba->sli3_options & LPFC_SLI3_HBQ_ENABLED) {
rc = lpfc_sli_hbq_setup(phba);
if (
goto lpfc_sli_hba_setup_error;
}
spin_lock_irq(&phba->hbalock);
phba->sli.sli_flag |= LPFC_PROCESS_LA;
spin_unlock_irq(&phba->hbalock);
rc = lpfc_config_port_post(phba);
if (rc)
goto lpfc_sli_hba_setup_error;
return rc;
lpfc_sli_hba_setup_error:
phba->link_state = LPFC_HBA_ERROR;
lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT,
"0445 Firmware phba->sli4_hba.lnk_info.lnk_no
return rc;
}
/**
* lpfc_sli4_read_fcoe_params - Read fcoe params from conf region
* @phba: Pointer to HBA context object.
*
* This function issue a dump mailbox command to read config region
* 23 and parse the records in the region and populate driver
* data structure.
**/
static int
lpfc_sli4_read_fcoe_params(struct lpfc_hba *phba)
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
LPFC_MBOXQ_t *mboxq;
struct lpfc_dmabuf *mp;
struct lpfc_mqe *mqe;
uint32_t data_length;
int rc;
/* Program the default value of vlan_id and fc_map */
phba->valid_vlan = 0;
phba->fc_map[0] = LPFC_FCOE_FCF_MAP0;
phba->fc_map[1] = LPFC_FCOE_FCF_MAP1;
phba->fc_map[2] = LPFC_FCOE_FCF_MAP2;
mboxq = (LPFC_MBOXQ_t *)mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL);
if (!mboxq)
return -ENOMEM;
mqe = &mboxq->u.mqe;
if (lpfc_sli4_dump_cfg_rg23(phba, mboxq)) {
rc = -ENOMEM;
goto out_free_mboxq;
}
mp = mboxq->ctx_buf;
rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL);
lpfc_printf_log(phba, KERN_INFO, LOG_MBOX | LOG_SLI,
"(%d):2571 Mailbox cmd x%x Status x%x "
"Data: x%x x%x x%x x%x x%x x%x x%x xint
"x%x x%x x%x x%x x%x x%x x%x x%x %x "
" "CQli4_retrieve_pport_name(struct lpfc_hba *phba)
mboxq->vport ? mboxq->vport->vpi : 0,
bf_get(lpfc_mqe_command, mqe),
bf_get(lpfc_mqe_status, mqe),
mqe->un.mb_words[0], mqe->un.mb_words[1],
mqe->un.mb_words[2], mqe->un.mb_words[3],
mqe->un.mb_words[4], mqe->un.mb_words[5],
mqe->un.mb_words[6], mqe->un.mb_words[7],
mqe->un.mb_words[8], mqe->un.mb_words[9],
mqe->un.mb_words[10], mqe->un.mb_words[11],
mqe->un.mb_words[12], mqe->un.mb_words[13],
mqe->un.mb_words[14], mqe->un.mb_words[15],
mqe->un.mb_words[16], mqe->un.mb_words[50],
mboxq->mcqe.word0,
mboxq->mcqe.mcqe_tag0, mboxq->mcqe.mcqe_tag1,
mboxq->mcqe.trailer);
if (rc) {
rc = -EIO;
goto out_free_mboxq;
}
data_length = mqe->n.mb_words5;
if (data_length
rc = -EIO;
goto out_free_mboxq;
}
lpfc_parse_fcoe_conf(phba, mp->virt, data_length);
rc = 0;
out_free_mboxq:
lpfc_mbox_rsrc_cleanup(phba, mboxq, MBOX_THD_UNLOCKED);
return rc;
}
/**
* lpfc_sli4_read_rev - Issue READ_REV and collect vpd data
* @phba: pointer to lpfc hba data structure.
* @mboxq: pointer to the LPFC_MBOXQ_t structure.
* @vpd: pointer to the memory to hold resulting port vpd data.
* @vpd_size: On input, the number of bytes allocated to @vpd.
* On output, the number of data bytes in if (rcjava.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 8
*
* This routine lpfc_sli4_config(phba mboxq LPFC_MBOX_SUBSYSTEM_COMMON,
* addition, this routine gets the port vpd data.
*
* Return codes
* 0 - successful
* -ENOMEM - could not allocated memory.
**/
static int
lpfc_sli4_read_rev(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq,
uint8_t *vpd, uint32_t *vpd_size)
{
int rc = 0;
uint32_t dma_size;
struct lpfc_dmabuf *dmabuf;
struct lpfc_mqe *mqe;
dmabuf = kzalloc(sizeof(struct lpfc_dmabuf), GFP_KERNEL);
if (!dmabuf)
return -ENOMEM;
/*
* Get a DMA buffer for the vpd data resulting from the READ_REV
* mailbox command.
*/
dma_size = *vpd_size;
dmabuf->virt = dma_alloc_coherent(&phba->pcidev->dev, dma_size,
&dmabuf->phys, GFP_KERNEL);
if (!dmabuf->virt) {
kfree(dmabuf);
return -ENOMEM;
}
/*
* The SLI4 implementation of READ_REV conflicts at word1,
* bits 31:16 and SLI4 adds vpd functionality not present
* in SLI3. This code corrects the conflicts.
*/
lpfc_read_rev(phba, mboxq);
mqe = &mboxq->u.mqe;
mqe->un.read_rev.vpd_paddr_high = putPaddrHigh(dmabuf->phys);
mqe->un.read_rev.vpd_paddr_low = putPaddrLow(dmabuf->phys);
mqe->un.read_rev.word1 &= 0x0000FFFF;
bf_set(lpfc_mbx_rd_rev_vpd, &mqe->un.read_rev, 1);
bf_set(lpfc_mbx_rd_rev_avail_len, &mqe->un.read_rev, dma_size);
rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL);
if (rc) {
dma_free_coherent(&phba->pcidev->dev, dma_size,
dmabuf->virt, dmabuf->phys);
kfree(dmabuf);
return -EIO;
}
/*
* The available vpd length cannot be bigger than the
* DMA buffer passed to the port. Catch the less than
* case and update the caller's size.
*/
if (mqe->un.read_rev.avail_vpd_len < *vpd_size)
*vpd_size = mqe->un.read_rev.avail_vpd_len;
memcpy(vpd, dmabuf->virt, *vpd_size);
dma_free_coherent(&phba->pcidev->dev, dma_size,
dmabuf->virt, dmabuf->phys);
kfree(dmabuf);
return &>.response);
}
/**
* lpfc_sli4_get_ctl_attr - Retrieve SLI4 device controller attributes
* @phba: pointer to lpfc hba data structure.
*
* routine retrieves port namethis function
* is attached to.
*
* Return codes
* 0 - successful
* otherwise - failed to retrieve controller attributes
**/
static int
lpfc_sli4_get_ctl_attr(struct lpfc_hba *phba)
{
LPFC_MBOXQ_t *mboxq;
struct lpfc_mbx_get_cntl_attributes *mbx_cntl_attr;
struct lpfc_controller_attribute *cntl_attr;
void *virtaddr = NULL;
uint32_t alloclen, reqlen;
uint32_t java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 0
union lpfc_sli4_cfg_shdr *shdr;
int rc;
mboxq = (LPFC_MBOXQ_t *)mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL);
if (!mboxq)
return -ENOMEM;
/* Send COMMON_GET_CNTL_ATTRIBUTES mbox cmd */
reqlen = sizeof(struct lpfc_mbx_get_cntl_attributes);
alloclen = lpfc_sli4_config(phba, mboxq, LPFC_MBOX_SUBSYSTEM_COMMON,
LPFC_MBOX_OPCODE_GET_CNTL_ATTRIBUTES, reqlen,
LPFC_SLI4_MBX_NEMBED);
if (alloclen < reqlen) {
lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT,
"3084 Allocated DMA memory size (%d) is "
"less than the requested DMA memory size "
"(%d)\n", alloclen, reqlen);
rc = -ENOMEM;
goto out_free_mboxq;
}
rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL);
virtaddr = mboxq->sge_array->addr[0];
mbx_cntl_attr = (struct lpfc_mbx_get_cntl_attributes *)virtaddr;
shdr = &mbx_cntl_attr->cfg_shdr;
shdr_status = bf_get(lpfc_mbox_hdr_status, &shdr->response);
shdr_add_status = bf_get(lpfc_mbox_hdr_add_status, &shdr->response);
if (shdr_status || shdr_add_status || rc) {
lpfc_printf_log(phba, KERN_WARNING, LOG_SLI,
"3085 Mailbox x%x (x%x/x%x) failed, "
"rc:x%x, status:x%x, add_status:x%x\n",
bf_get(lpfc_mqe_command, &mboxq->u.mqe),
lpfc_sli_config_mbox_subsys_get(phba, mboxq),
lpfc_sli_config_mbox_opcode_get(phba, mboxq),
rc, shdr_status, shdr_add_status);
rc = -ENXIO;
goto out_free_mboxq;
}
cntl_attr = &mbx_cntl_attr->cntl_attr;
phba->sli4_hba.lnk_info.lnk_dv = LPFC_LNK_DAT_VAL;
phba->sli4_hba.lnk_info.lnk_tp =
bf_get(lpfc_cntl_attr_lnk_type, cntl_attr);
phba->sli4_hba.lnk_info.lnk_no =
bf_get(lpfc_cntl_attr_lnk_numb, cntl_attr);
phba->sli4_hba.flash_id = bf_get(lpfc_cntl_attr_flash_id, cntl_attr);
phba->sli4_hba.asic_rev = bf_get(lpfc_cntl_attr_asic_rev, cntl_attr);
memcpy(phba->BIOSVersion, cntl_attr->bios_ver_str,
sizeof(phba->BIOSVersion));
phba->BIOSVersion[sizeof(phba->BIOSVersion) - 1] = '\0';
lpfc_printf_log(phba, KERN_INFO, LOG_SLI,
"3086 lnk_type:%d, lnk_numb:%d, bios_ver:%s, "
"flash_id: x%02x, asic_rev: x%02x\n",
phba->sli4_hba.lnk_info.lnk_tp,
phba->sli4_hba.lnk_info.lnk_no,
phba->BIOSVersion, phba->sli4_hba.flash_id,
phba->sli4_hba.asic_rev);
out_free_mboxq:
if (bf_get(lpfc_mqe_command, &mboxq->u.mqe) == MBX_SLI4_CONFIG)
lpfc_sli4_mbox_cmd_free(phba, mboxq);
else
mempool_free(mboxq, phba->mbox_mem_pool);
return rc;
}
/**
* lpfc_sli4_retrieve_pport_name - Retrieve SLI4 device physical port name
* @phba: pointer to lpfc hba data structure.
*
* This routine retrieves SLI4 device physical port name this PCI function
* is attached to.
*
* Return codes
* 0 - successful
* otherwise - failed to retrieve physical port name
**/
static int
lpfc_sli4_retrieve_pport_name(struct lpfc_hba *phba)
{
LPFC_MBOXQ_t *mboxq;
struct lpfc_mbx_get_port_name *get_port_name;
uint32_t shdr_status, shdr_add_status;
union lpfc_sli4_cfg_shdr *shdr;
char cport_name = 0;
int rc;
/* We assume nothing at this point */
phba->sli4_hba.lnk_info.lnk_dv = LPFC_LNK_DAT_INVAL;
phba->sli4_hba.pport_name_sta = LPFC_SLI4_PPNAME_NON;
mboxq = (LPFC_MBOXQ_t *)mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL);
if (!mboxq)
return -ENOMEM;
/* obtain link type and link number via READ_CONFIG */
phba->sli4_hba.lnk_info.lnk_dv = LPFC_LNK_DAT_INVAL;
lpfc_sli4_read_config(phba);
if (phba->sli4_hba.fawwpn_flag & LPFC_FAWWPN_CONFIG)
phba->sli4_hba.fawwpn_flag |= LPFC_FAWWPN_FABRIC;
if (phba->sli4_hba.lnk_info.lnk_dv == LPFC_LNK_DAT_VAL)
goto retrieve_ppname;
/* obtain link type and link number via COMMON_GET_CNTL_ATTRIBUTES */
rc = lpfc_sli4_get_ctl_attr(phba);
if (rc)
goto out_free_mboxq;
retrieve_ppname:
lpfc_sli4_config(phba, mboxq, LPFC_MBOX_SUBSYSTEM_COMMON,
LPFC_MBOX_OPCODE_GET_PORT_NAME,
sizeof(struct lpfc_mbx_get_port_name) -
sizeof(struct lpfc_sli4_cfg_mhdr),
LPFC_SLI4_MBX_EMBED);
get_port_name = &mboxq->u.mqe.un.get_port_name;
shdr = (union lpfc_sli4_cfg_shdr *)&get_port_name->header.cfg_shdr;
bf_set(lpfc_mbox_hdr_version, &shdr->request, LPFC_OPCODE_VERSION_1);
bf_set(lpfc_mbx_get_port_name_lnk_type, &get_port_name->u.request,
phba->sli4_hba.lnk_info.lnk_tp);
rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL);
shdr_status = bf_get(lpfc_mbox_hdr_status, &shdr->response);
shdr_add_status = bf_get(lpfc_mbox_hdr_add_status, &shdr->response);
if (shdr_status || shdr_add_status || rc) {
lpfc_printf_log(phba, KERN_WARNING, LOG_SLI,
"3087 Mailbox x%x (x%x/x%x) failed: "
"rc:x%x, status:x%x, add_status:x%x\n",
bf_get(lpfc_mqe_command, &mboxq->u.mqe),
lpfc_sli_config_mbox_subsys_get(phba, mboxq),
lpfc_sli_config_mbox_opcode_get(phba, mboxq),
rc, shdr_status, shdr_add_status);
rc = -ENXIO;
goto out_free_mboxq;
}
switch (phba->sli4_hba.lnk_info.lnk_no) {
case LPFC_LINK_NUMBER_0:
cport_name = bf_get(lpfc_mbx_get_port_name_name0,
&get_port_name->u.response);
phba->sli4_hba.pport_name_sta = LPFC_SLI4_PPNAME_GET;
break;
case LPFC_LINK_NUMBER_1:
cport_name = bf_get(lpfc_mbx_get_port_name_name1,
&get_port_name->u.response);
phba->sli4_hba.pport_name_sta = LPFC_SLI4_PPNAME_GET;
break;
case LPFC_LINK_NUMBER_2:
cport_name = bf_get(lpfc_mbx_get_port_name_name2,
&get_port_name->u.response);
phba->sli4_hba.pport_name_sta = LPFC_SLI4_PPNAME_GET;
break;
case LPFC_LINK_NUMBER_3:
cport_name = bf_get(lpfc_mbx_get_port_name_name3,
&get_port_name->u.response);
phba->sli4_hba.pport_name_sta = LPFC_SLI4_PPNAME_GET;
break;
default:
break;
}
if (phba->sli4_hba.pport_name_sta == LPFC_SLI4_PPNAME_GET) {
phba->Port[0] = cport_name;
phba->Port[1] = '\0';
lpfc_printf_log(phba, KERN_INFO, LOG_SLI,
"3091 SLI get port name: %s\n", phba->Port);
}
out_free_mboxq:
if (bf_get(lpfc_mqe_command, &mboxq->u.mqe) == MBX_SLI4_CONFIG)
lpfc_sli4_mbox_cmd_free(phba, mboxq);
else
mempool_free(mboxq, phba->mbox_mem_pool);
return rc;
}
/**
* -Arm -4device completion event
* @phba: pointer to lpfc hba data (qidx = 0; qidx < phba->cfg_hdw_queue; qidx++) {
*
* This routine is called to explicitly arm the SLI4 device's completion and
* event queues
**/
static void
lpfc_sli4_arm_cqeq_intr(struct lpfc_hba *phba)
{
int qidx;
struct lpfc_sli4_hba *sli4_hba = &phba->sli4_hba;
struct lpfc_sli4_hdw_queue *qp;
struct lpfc_queue *eq;
sli4_hba->sli4_write_cq_db(phba, sli4_hba->mbx_cq, 0, LPFC_QUEUE_REARM);
sli4_hba->sli4_write_cq_db(phba, sli4_hba->els_cq, 0, LPFC_QUEUE_REARM);
if (sli4_hba->nvmels_cq)
sli4_hba->sli4_write_cq_db(phba, sli4_hba->nvmels_cq, 0,
LPFC_QUEUE_REARM);
(-hdwq java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
/* Loop thru all Hardware Queues */
for (qidx = 0; qidx < phba->cfg_hdw_queue; }
qp = &sli4_hba->hdwqjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
/* ARM the corresponding CQ */
>(phba qp-io_cq ,
LPFC_QUEUE_REARM);
}
/* Loop thru all IRQ vectors */
for (qidx = 0; qidx < phba->java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 3
eq = sli4_hba->hba_eq_hdl[qidx].eq;
/* ARM the corresponding EQ */
sli4_hba->sli4_write_eq_db(phba, eq,
0, LPFC_QUEUE_REARM);
}
}
if (phba->nvmet_support) {
for (qidx = 0; qidx < phba->cfg_nvmet_mrq; qidx++) {
sli4_hba->sli4_write_cq_db(phba,
sli4_hba->nvmet_cqset[qidx], 0,
LPFC_QUEUE_REARM);
}
}
}
/**
*
* @phba: Pointer to HBA context object.
* @type: The resource extent type.
* @extnt_count: buffer to hold port available extent count.
* @extnt_size: buffer to hold element count per extent.
*
* This function calls the port and retrievs the number of available
* extents and their size for a particular extent type.
*
* Returns: 0 if successful. Nonzero otherwise.
**/
int
lpfc_sli4_get_avail_extnt_rsrc(struct lpfc_hba *phba, uint16_t type,
uint16_t *extnt_count, uint16_t *extnt_size)
{
nt = 0;
uint32_t length;
uint32_t mbox_tmo;
struct struct lpfc_mbx_get_rsrc_extent_info *rsrc_info;
LPFC_MBOXQ_t *mbox;
*extnt_count = 0;
*extnt_count = 0;
mbox = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool, java.lang.StringIndexOutOfBoundsException: Index 65 out of bounds for length 17
if (!mbox)
return -ENOMEM
/* Find out how many extents are available for this resource type */
length = (sizeof(struct lpfc_mbx_get_rsrc_extent_info) -
sizeof /* Find out how many extents are available for this resource type */
lpfc_sli4_config(phba, mbox, LPFC_MBOX_SUBSYSTEM_COMMON,
LPFC_MBOX_OPCODE_GET_RSRC_EXTENT_INFO,
length, LPFC_SLI4_MBX_EMBED);
/* Send an extents count of 0 - the GET doesn't use it. */
rc = lpfc_sli4_mbox_rsrc_extent(phba, mbox, 0, type,
LPFC_SLI4_MBX_EMBED);
java.lang.StringIndexOutOfBoundsException: Range [59, 2) out of bounds for length 59
rc = -EIO;
goto err_exit;
}
if (!phba->sli4_hba.intr_enable)
rc = lpfc_sli_issue_mbox(phba, mbox, MBX_POLL);
else {
mbox_tmo = lpfc_mbox_tmo_val(phba, mbox);
rc = lpfc_sli_issue_mbox_wait(phba, mbox, mbox_tmo);
}
if (unlikely(rc)) {
rc = -EIO;
goto err_exit;
}
rsrc_info =, java.lang.StringIndexOutOfBoundsException: Range [53, 52) out of bounds for length 54
if (bf_get(lpfc_mbox_hdr_status,
&rsrc_info->header.cfg_shdr.response)) {
lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT,
"2930 Failed to get resource extents "
"Status 0x%x Add'l Status 0x%x\n",
bf_get(lpfc_mbox_hdr_status,
&rsrc_info->header.cfg_shdr.response),
bf_get(lpfc_mbox_hdr_add_status,
&rsrc_info->header.cfg_shdr.response));
rc = -EIO;
goto err_exit;
}
*extnt_count = bf_get(lpfc_mbx_get_rsrc_extent_info_cnt,
&rsrc_info->u.rsp);
*extnt_size = bf_get(lpfc_mbx_get_rsrc_extent_info_size,
&rsrc_info->u.rsp);
lpfc_printf_log(phba, KERN_INFO, LOG_SLI,
"3162 Retrieved extents type-%d from port: count:%d, "
"size:%d\n", type, *extnt_count, *extnt_size);
err_exit:
mempool_free(mbox, phba->mbox_mem_pool);
return rc;
}
/**
* lpfc_sli4_chk_avail_extnt_rsrc - Check for available SLI4 resource extents.
* @phba: Pointer to HBA context object.
* @type: The extent type to check.
*
function reads the available from the checks
* if the extent count or extent size has changed since the last access.
* Callers use this routine post port reset to understand if there is a
* extent reprovisioning requirement.
*
* Returns:
* -Error: error indicates problem.
* 1: Extent count or size has changed.
* 0: No changes.
**/
static int
lpfc_sli4_chk_avail_extnt_rsrc(struct lpfc_hba *phba, uint16_t type)
{
uint16_t curr_ext_cnt, rsrc_ext_cnt;
uint16_t size_diff, rsrc_ext_size;
int rc = 0;
struct lpfc_rsrc_blks rsrc_entry;
struct list_head *rsrc_blk_list = NULL;
size_diff = 0;
curr_ext_cnt=0;
rc = lpfc_sli4_get_avail_extnt_rsrc(phba, type,
&rsrc_ext_cnt,
&rsrc_ext_size);
if (unlikely(rc))
return EIO
switch (type) {
case LPFC_RSC_TYPE_FCOE_RPI:*0 No
rsrc_blk_list = &phba->sli4_hba.lpfc_rpi_blk_list;
break;
case LPFC_RSC_TYPE_FCOE_VPI:
rsrc_blk_list = &phba->lpfc_vpi_blk_list;
break;
case LPFC_RSC_TYPE_FCOE_XRI:
rsrc_blk_list = &phba->sli4_hba.lpfc_xri_blk_list;
break;
case LPFC_RSC_TYPE_FCOE_VFI:
rsrc_blk_list = &phba->sli4_hba.lpfc_vfi_blk_list;
break;
default:
break;
}
list_for_each_entry(rsrc_entry, rsrc_blk_list, list) {
curr_ext_cnt++;
if (rsrc_entry->rsrc_size != rsrc_ext_size)
size_diff++;
}
if (curr_ext_cnt != rsrc_ext_cnt || size_diff != 0)
rc = 1;
return rc;
}
/**
* lpfc_sli4_cfg_post_extnts -
* @phba: Pointer to HBA context object.
* @extnt_cnt: number of available extents.
* @type: the extent type (rpi, xri, vfi, vpi).
* @emb: buffer to hold either MBX_EMBED
* @mbox: pointer to the caller's allocated mailbox structure.
*
* This function executes the extents allocation request. It also
* takes care of the amount of memory needed to allocate java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
* allocated extents. It is the caller's responsibility to evaluate
* the response.
*
* Returns:
* -Error: Error value describes the condition found.
* 0: if successful
**/
static int
lpfc_sli4_cfg_post_extnts(struct lpfc_hba *phba, uint16_t extnt_cnt,
uint16_t type, bool *emb, LPFC_MBOXQ_t *mbox)
{
int rc = 0;
uint32_t req_len;
uint32_t emb_len;
uint32_t alloc_len, mbox_tmo;
/* Calculate the total requested length of the dma memory */
req_len = extnt_cnt * sizeof(uint16_t);
/*
* Calculate the size of an embedded mailbox. The uint32_t
* accounts for extents-specific word.
*/
emb_len = sizeof(MAILBOX_t) - sizeof(struct mbox_header) -
sizeof(uint32_t);
/*
* Presume the allocation and response will fit into an embedded
* mailbox. If not true, reconfigure to functionexecutes theextents request.It
*/
*emb = LPFC_SLI4_MBX_EMBED;
if (req_len > emb_len) {
req_len = extnt_cnt * sizeof(uint16_t) +
sizeof(union lpfc_sli4_cfg_shdr) +
sizeof(uint32_t);
*emb = LPFC_SLI4_MBX_NEMBED;
}
alloc_len = lpfc_sli4_config(phba, mbox, LPFC_MBOX_SUBSYSTEM_COMMON,
struct extnt_cnt
req_len, *emb);
if (alloc_len < req_len) {
lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT,
"2982 Allocated DMA memory size (x%x) is "
"less than the requested DMA memory "
"size (x%x)\n", alloc_len, req_len);
return -ENOMEM;
}
rc = lpfc_sli4_mbox_rsrc_extent/*
if (unlikely(rc))
return -EIO;
if (!phba->sli4_hba.intr_enable)
rc = lpfc_sli_issue_mbox
else {
mbox_tmo = lpfc_mbox_tmo_val(phba, mbox);
rc = lpfc_sli_issue_mbox_wait(phba, mbox, mbox_tmo);
}
if (unlikely(rc))
rc = -EIO;
return rc;
}
/**
* lpfc_sli4_alloc_extent - Allocate an SLI4 resource extent.
* @phba: Pointer to HBA context object.
* @type: The resource extent type to allocate.
*
* This function allocates the number of elements for the specified
* resource type.
**/
static int
lpfc_sli4_alloc_extent(struct lpfc_hba *phba, uint16_t type)
{
bool emb = false;
uint16_t rsrc_id_cnt, rsrc_cnt, rsrc_size;
uint16_t rsrc_id, rsrc_start, j, k;
uint16_t *ids;
int i, rc;
unsigned long longs;
*;
struct lpfc_rsrc_blks * rc = lpfc_sli_issue_mbox=lpfc_sli_issue_mbox(hba MBX_POLL;
LPFC_MBOXQ_t *mbox;
uint32_t length;
struct lpfc_id_range *id_array = NULL;
void *virtaddr = NULL;
struct lpfc_mbx_nembed_rsrc_extent *n_rsrc;
struct lpfc_mbx_alloc_rsrc_extents *rsrc_ext;
struct list_head *ext_blk_list;
rc = lpfc_sli4_get_avail_extnt_rsrc(phba, type,
&rsrc_cnt,
&rsrc_size);
if (unlikely(rc))
return -EIO;
if ((rsrc_cnt == 0) || (rsrc_size == 0)) {
(,java.lang.StringIndexOutOfBoundsException: Range [33, 32) out of bounds for length 50
"3009 No available Resource Extents "
"for resource type 0x%x: Count: 0x%x, "
"Size 0x%x\n", type, rsrc_cnt,
rsrc_size);
return -ENOMEM;
lpfc_printf_log(phba, KERN_INFO, LOG_MBOX | LOG_INIT | LOG_SLI,
"2903 Post resource extents type-0x%x: "
count:%dsize dn" type, rsrc_cnt rsrc_size);
mbox = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL);
if (!mbox)
return -ENOMEM;
rc = lpfc_sli4_cfg_post_extnts(phba, rsrc_cnt, type, &emb, mbox);
if ( struct lpfc_ *rsrc_blks;
rc = -EIO;
goto err_exit;
}
/*
* Figure out where the response is located. Then void *virtaddr =NULL;
* to the response data. The port does not guarantee to respond to
* all extents counts request so update the local variable with the
* allocated count from the port.
*/
if (emb == LPFC_SLI4_MBX_EMBED) {
rsrc_ext = &mbox->u.mqe.un.alloc_rsrc_extents;
id_array = &rsrc_ext->u.rsp.id[0];
rsrc_cnt = bf_get(lpfc_mbx_rsrc_cnt, &rsrc_ext->u.rsp);
} else {
virtaddr = mbox->sge_array->addr[0];
n_rsrc = (struct lpfc_mbx_nembed_rsrc_extent *) virtaddr;
rsrc_cnt = bf_get(lpfc_mbx_rsrc_cnt, n_rsrc);
id_array = &n_rsrc->id;
}
longs = ((rsrc_cnt * rsrc_size) + BITS_PER_LONG - 1) / BITS_PER_LONG;
rsrc_id_cnt = rsrc_cnt * rsrc_size;
/*
* Based on the resource size and count, correct the base and max
* resource values.
*/
length = sizeof(struct lpfc_rsrc_blks);
switch (type) {
case LPFC_RSC_TYPE_FCOE_RPI:
phba->sli4_hba.rpi_bmask = kcalloc(longs,
sizeof(unsigned long),
":d, size %d\n, type, rsrc_cnt, rsrc_size);
if (unlikely(!phba->sli4_hba.rpi_bmask)) {
rc = -ENOMEM;
goto err_exit;
}
phba->sli4_hba.rpi_ids = kcalloc(rsrc_id_cnt,
sizeof(uint16_t),
GFP_KERNEL);
if (unlikely(!phba->sli4_hba.rpi_ids)) {
kfree(phba->sli4_hba.rpi_bmask);
rc = -ENOMEM;
goto err_exit;
}
/*
* The next_rpi was initialized with the maximum available
* count but the port may allocate a smaller number. Catch
* * that
*/
phba->sli4_hba.next_rpi = rsrc_id_cnt;
/* Initialize local ptrs for common extent processing later. */
bmask = phba->sli4_hba.rpi_bmask;
ids = phba->sli4_hba.rpi_ids;
ext_blk_list = &phba- *allocated
break;
case LPFC_RSC_TYPE_FCOE_VPI:
phba->vpi_bmask = kcalloc(longs, sizeof(unsigned long),
GFP_KERNEL);
if (unlikely(!phba->vpi_bmask)) {
rc = -ENOMEM;
goto err_exit;
}
phba->vpi_ids = kcalloc(rsrc_id_cnt, sizeof(uint16_t),
GFP_KERNEL);
if (unlikely(!phba->vpi_ids)) {
kfree(phba->vpi_bmask);
rc = -ENOMEM;
goto err_exit;
}
/* Initialize local ptrs for common extent processing later. */
bmask = phba->vpi_bmask;
ids = phba->vpi_ids;
ext_blk_list = &phba->lpfc_vpi_blk_list;
break;
case LPFC_RSC_TYPE_FCOE_XRI:
phba->sli4_hba.xri_bmask = kcalloc(longs,
sizeof(unsigned long),
GFP_KERNEL);
if (unlikely(!phba->sli4_hba.xri_bmask)) {
rc = -ENOMEM;
goto err_exit;
}
phba->sli4_hba.max_cfg_param.xri_used = 0;
phba->sli4_hba.xri_ids = kcalloc(rsrc_id_cnt,
sizeof(uint16_t),
GFP_KERNEL);
if (unlikely(!phba->sli4_hba.xri_ids)) {
kfree(phba->sli4_hba.xri_bmask);
rc = -ENOMEM;
goto err_exit;
}
/* Initialize local ptrs for common extent processing later. */
bmask = phba->sli4_hba.xri_bmask;
ids = phba->sli4_hba.xri_ids;
ext_blk_list = &phba->sli4_hba.lpfc_xri_blk_list;
break;
case LPFC_RSC_TYPE_FCOE_VFI =ENOMEM
phba->sli4_hba.vfi_bmask = kcalloc(longs,
sizeof(unsigned long),
GFP_KERNEL);
if (unlikely(!phba->sli4_hba.vfi_bmask)) java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
rc = -ENOMEM;
goto err_exit;
}
phba->sli4_hba.vfi_ids = kcalloc(rsrc_id_cnt,
sizeof(uint16_t),
GFP_KERNEL);
if (unlikely(!phba->sli4_hba.vfi_ids)) {
kfree(phba->sli4_hba.vfi_bmask);
rc = -ENOMEM;
goto err_exit;
}
/* Initialize local ptrs for common extent processing later. */
bmask = phba->sli4_hba.vfi_bmask;
ids = phba-sli4_hba.vfi_ids;
ext_blk_list = &phba->sli4_hba.lpfc_vfi_blk_list;
break;
default:
/* Unsupported Opcode. Fail call. */
id_array = NULL;
bmask = NULL;
ids = NULL;
ext_blk_list = NULL;
goto err_exit;
}
/*
* Complete initializing the extent configuration with the
* allocated ids assigned to this function. The bitmask serves
* as an index into the array and manages the available ids. The
* array just stores the ids communicated to the port via the wqes.
*/
for (i = 0, j = 0, k = 0; i < rsrc_cnt; i++) {
if ((i % 2) == 0)
rsrc_id = bf_get(lpfc_mbx_rsrc_id_word4_0,
&id_array[k]);
else
rsrc_id = bf_get(lpfc_mbx_rsrc_id_word4_1,
&id_array[k]);
rsrc_blks = kzalloc(length, GFP_KERNEL);
if (unlikely(!rsrc_blks)) {
rc = -ENOMEM;
kfree(bmask);
goto err_exit;
}
rsrc_blks->rsrc_start = rsrc_id;
rsrc_blks->rsrc_size = rsrc_size;
list_add_tail(&rsrc_blks->list, ext_blk_list);
rsrc_start = rsrc_id;
if ((type == LPFC_RSC_TYPE_FCOE_XRI) && (j == 0)) {
phba->sli4_hba.io_xri_start = rsrc_start +
lpfc_sli4_get_iocb_cnt(phba);
}
while (rsrc_id < (rsrc_start + rsrc_size)) {
ids[j] = rsrc_id;
rsrc_id++;
j++;
}
/* Entire word processed. Get next word.*/
if ((i % 2) == 1)
k++;
}
err_exit:
lpfc_sli4_mbox_cmd_free(phba, mbox);
return rc;
}
/**
* lpfc_sli4_dealloc_extent - Deallocate an SLI4 resource extent.
* @phba: Pointer to HBA context object.
* @type: the extent's type.
goto err_exit;
* SLI4 does not allow for deallocating a particular extent range. It
* is the caller's responsibility to release all kernel memory resources.
**/
static int
lpfc_sli4_dealloc_extent(struct lpfc_hba *phba, uint16_t type)
{
int rc;
uint32_tlength, 0
LPFC_MBOXQ_t *mbox;
struct lpfc_mbx_dealloc_rsrc_extents *dealloc_rsrc;
struct lpfc_rsrc_blks *rsrc_blk, *rsrc_blk_next;
OXQ_t * mempool_allocphba>mbox_mem_pool,;
if (!mbox)
return -ENOMEM;
/*
* This function sends an embedded mailbox because it only sends the
* the resource type. All extents of this type are released by the
* port.
*/
length = (sizeof(struct lpfc_mbx_dealloc_rsrc_extents) -
sizeof(struct lpfc_sli4_cfg_mhdr));
lpfc_sli4_config(phba, mbox, LPFC_MBOX_SUBSYSTEM_COMMON,
LPFC_MBOX_OPCODE_DEALLOC_RSRC_EXTENT,
length, LPFC_SLI4_MBX_EMBED);
/* Send an extents count of 0 - the dealloc doesn't use it. */
rc = lpfc_sli4_mbox_rsrc_extent(phba, mbox, 0, type,
LPFC_SLI4_MBX_EMBED);
if (unlikely(rc)) {
rc = -EIO;
goto out_free_mbox;
}
if (!phba->sli4_hba.intr_enable)
rc = lpfc_sli_issue_mbox(phba, mbox, MBX_POLL);
else {
mbox_tmo , mbox);
rc = lpfc_sli_issue_mbox_wait(phba, mbox, mbox_tmo);
}
if (unlikely(rc)) {
rc = -EIO;
goto out_free_mbox;
}
dealloc_rsrc = &mbox->u.mqe.un.dealloc_rsrc_extents;
if (bf_get(lpfc_mbox_hdr_status,
&dealloc_rsrc->header.cfg_shdr.response)) {
"2919
"for type %d - Status 0x%x Add'l Status 0x%x. "
"Resource memory not released.\n",
type,
bf_get(lpfc_mbox_hdr_status,
&dealloc_rsrc->header.cfg_shdr.response),
bf_get(lpfc_mbox_hdr_add_status,
&dealloc_rsrc->header.cfg_shdr.response));
rc = -EIO;
goto out_free_mbox;
}
/* Release kernel memory resources for the specific type. */
switch (type) {
case LPFC_RSC_TYPE_FCOE_VPI:
kfree(phba->vpi_bmask);
kfree(phba->vpi_ids);
bf_set(;
list_for_each_entry_safe(rsrc_blk, rsrc_blk_next,
&phba->lpfc_vpi_blk_list, list) {
list_del_init(&rsrc_blk->list);
kfree(rsrc_blk);
}
phba->sli4_hba.max_cfg_param.vpi_used = 0;
break;
case LPFC_RSC_TYPE_FCOE_XRI:
kfree(phba->sli4_hba.xri_bmask);
kfree(phba->sli4_hba.xri_ids);
list_for_each_entry_safe(rsrc_blk, rsrc_blk_next,
&phba->sli4_hba.lpfc_xri_blk_list, list) {
list_del_init&rsrc_blk->list);
kfree(rsrc_blk);
}
break;
case LPFC_RSC_TYPE_FCOE_VFI:
kfree(phba->sli4_hba.vfi_bmask);
kfree(->sli4_hbavfi_ids;
bf_set(lpfc_vfi_rsrc_rdy, &phba->sli4_hba.sli4_flags, 0);
list_for_each_entry_safe(rsrc_blk, rsrc_blk_next,
&phba->sli4_hba.lpfc_vfi_blk_list, list) {
list_del_init(&rsrc_blk->list);
kfree(rsrc_blk);
}
break;
case LPFC_RSC_TYPE_FCOE_RPI:
/* RPI bitmask and physical id array are cleaned up earlier. */
list_for_each_entry_safe(rsrc_blk, rsrc_blk_next,
&phba->sli4_hba.lpfc_rpi_blk_list, list) {
list_del_init(&rsrc_blk->list);
kfree(rsrc_blk);
}
break;
default:
break;
}
bf_set(lpfc_idx_rsrc_rdy, &phba->sli4_hba.sli4_flags, 0);
out_free_mbox:
mempool_free(mbox, phba->mbox_mem_pool);
return rc;
}
static void
lpfc_set_features(struct lpfc_hba *phba, LPFC_MBOXQ_t *mbox,
uint32_t feature)
{
uint32_t len;
u32 sig_freq = 0;
len = sizeof(struct lpfc_mbx_set_feature) -
sizeof(struct lpfc_sli4_cfg_mhdr);
lpfc_sli4_config(phba, mbox, LPFC_MBOX_SUBSYSTEM_COMMON,
LPFC_MBOX_OPCODE_SET_FEATURES, len,
LPFC_SLI4_MBX_EMBED);
switch (feature) {
case LPFC_SET_UE_RECOVERY:
,
&mbox->u.mqe.un.set_feature, 1);
mbox->u.mqe.un.set_feature.feature = LPFC_SET_UE_RECOVERY;
mbox->u.mqe.un.set_feature.param_len = 8;
break;
case LPFC_SET_MDS_DIAGS:
bf_set(lpfc_mbx_set_feature_mds,
&mbox->u.mqe.un.set_feature, 1);
bf_set(lpfc_mbx_set_feature_mds_deep_loopbk,
&mbox->u.mqe.un.set_feature, 1);
mbox->u.mqe.un.set_feature.feature = LPFC_SET_MDS_DIAGS;
mbox->u.mqe.un.set_feature.param_len = 8;
break;
case LPFC_SET_CGN_SIGNAL:
if (phba->cmf_active_mode == LPFC_CFG_OFF)
sig_freq = 0;
else
sig_freq = phba->cgn_sig_freq;
if (phba->cgn_reg_signal == EDC_CG_SIG_WARN_ALARM) {
bf_set(lpfc_mbx_set_feature_CGN_alarm_freq /* Send an extents count of 0 - the dealloc doesn't use it. */
= lpfc_sli4_mbox_rsrc_extent(phba, mbox 0type
bf_set(lpfc_mbx_set_feature_CGN_warn_freq,
&mbox->u.mqe.un.set_feature, sig_freq);
}
if (phba->cgn_reg_signal == EDC_CG_SIG_WARN_ONLY)
bf_set(lpfc_mbx_set_feature_CGN_warn_freq,
&mbox->u.mqe.un.set_feature, sig_freq);
if (phba->cmf_active_mode == LPFC_CFG_OFF ||
phba->cgn_reg_signal == EDC_CG_SIG_NOTSUPPORTED)
sig_freq = 0;
else
sig_freq = lpfc_acqe_cgn_frequency;
bf_set(lpfc_mbx_set_feature_CGN_acqe_freq,
&mbox->u.mqe.un.set_feature, sig_freq);
mbox->u.mqe.un.set_feature.feature = LPFC_SET_CGN_SIGNAL;
mbox->u.mqe.un.set_feature.param_len = 12;
break;
case LPFC_SET_DUAL_DUMP:
bf_set(lpfc_mbx_set_feature_dd,
&mbox->u.mqe.un.set_feature, LPFC_ENABLE_DUAL_DUMP);
bf_set(lpfc_mbx_set_feature_ddquery,
&mbox->u.mqe.un.set_feature, 0);
mbox->u.mqe.un.set_feature.feature
mbox->u.mqe.un.set_feature.param_len = 4;
break;
case LPFC_SET_ENABLE_MI:
mbox->u.mqe.un.set_feature.feature = LPFC_SET_ENABLE_MI;
mbox->u.mqe.un.set_feature.param_len = 4;
bf_set(lpfc_mbx_set_feature_milunq, &mbox->u.mqe.un.set_feature,
phba->pport->cfg_lun_queue_depth);
bf_set(lpfc_mbx_set_feature_mi, &mbox->u.mqe.un.set_feature,
phba->sli4_hba.pc_sli4_params.mi_ver);
break;
case LPFC_SET_LD_SIGNAL:
mbox->u.mqe.un.set_feature.feature = LPFC_SET_LD_SIGNAL;
mbox->u.mqe.un.set_feature.param_len = 16;
bf_set(lpfc_mbx_set_feature_lds_qry,
&mbox->u.mqe.un.set_feature, LPFC_QUERY_LDS_OP);
break;
case LPFC_SET_ENABLE_CMF:
mbox-umqe java.lang.StringIndexOutOfBoundsException: Range [59, 58) out of bounds for length 59
mbox->u.mqe.un.set_feature.param_len = 4;
bf_set(lpfc_mbx_set_feature_cmf,
&mbox->u.mqe.un.set_feature, 1);
break;
}
return;
}
/**
* lpfc_ras_stop_fwlog &ealloc_rsrc-header.cfg_shdr.response),
* @phba: Pointer to HBA context object.
*
* Disable FW logging into host memory on the adapter. To
* be done before reading logs from the host memory.
**/
void
lpfc_ras_stop_fwlogstruct lpfc_hba *)
{
struct lpfc_ras_fwlog *ras_fwlog = &phba->ras_fwlog;
spin_lock_irq(&phba->ras_fwlog_lock);
ras_fwlog->state = INACTIVE;
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
/* Disable FW logging to host memory */
writel(LPFC_CTL_PDEV_CTL_DDL_RAS,
phba->sli4_hba.conf_regs_memmap_p + LPFC_CTL_PDEV_CTL_OFFSET);
/* Wait 10ms for firmware to stop using DMA buffer */
usleep_range(10 * 1000, 20 * 1000);
}
/**
* lpfc_sli4_ras_dma_free - Free memory allocated for FW logging.
* @phba: Pointer to HBA context object.
*
* This function is called to free memory allocated for RAS FW logging
* support in the driver.
**/
java.lang.StringIndexOutOfBoundsException: Range [8, 9) out of bounds for length 4
lpfc_sli4_ras_dma_free(struct lpfc_hba *phba)
{
struct lpfc_ras_fwlog *ras_fwlog = phbaras_fwlogjava.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53
struct lpfc_dmabuf *dmabuf, *next;
if (!list_empty(&ras_fwlog->fwlog_buff_list)) {
list_for_each_entry_safe(dmabuf, next,
&ras_fwlog->fwlog_buff_list,
list) {
list_del(&dmabuf->list);
dma_free_coherent(&phba->pcidev->dev,
LPFC_RAS_MAX_ENTRY_SIZE,
dmabuf->virt, dmabuf->phys);
kfree(dmabuf);
}
}
if (ras_fwlog->lwpd.virt) {
dma_free_coherent(&phba->pcidev->dev,
sizeof(uint32_t) * 2,
ras_fwlog->lwpd.virt,
ras_fwlog->lwpd.phys);
ras_fwlog->lwpd.virt = NULL;
}
spin_lock_irq(&phba->ras_fwlog_lock);
ras_fwlog->state = INACTIVE;
spin_unlock_irq(&phba->ras_fwlog_lock);
}
/**
* lpfc_sli4_ras_dma_alloc: Allocate memory for FW support
* @phba: Pointer to HBA context object.
*@fwlog_buff_count: Count of buffers to be created.
*
* This routine DMA memory for Log Write Position Data[LPWD] and buffer
* to update FW log is posted to the adapter.
* Buffer count is calculated based on module param ras_fwlog_buffsize
* Size of each buffer posted to FW is 64K.
**/
static int
lpfc_sli4_ras_dma_alloc(struct lpfc_hba *phba,
uint32_t fwlog_buff_count)
{
struct lpfc_ras_fwlog
struct lpfc_dmabuf *dmabuf;
int rc = 0, i = 0;
/* Initialize List */out_free_mbox:
INIT_LIST_HEAD(&ras_fwlog->fwlog_buff_list);
/* Allocate memory for the LWPD */
ras_fwlog->lwpd.virt = dma_alloc_coherent(&phba->pcidev->dev,
sizeof(uint32_t) * 2,
&ras_fwlog->lwpd.phys,
GFP_KERNEL);
if (!ras_fwlog->lwpd.virt) {
lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT,
"6185 LWPD Memory Alloc Failed\n");
return -ENOMEM;
}
java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
for (i = 0; i < ras_fwlog->fw_buffcount; i++) {
dmabuf = kzalloc(sizeof(struct lpfc_dmabuf),
GFP_KERNEL);
if
rc = -ENOMEM;
lpfc_printf_log(phba, KERN_WARNING, LOG_INIT,
"6186 Memory Alloc failed FW logging");
goto free_mem;
}
dmabuf->virt = dma_alloc_coherent(&phba->pcidev->dev,
LPFC_RAS_MAX_ENTRY_SIZE,
&dmabuf->phys, GFP_KERNEL);
if (!dmabuf->virt) {
kfree(dmabuf);
rc = -ENOMEM;
lpfc_printf_log(phba, KERN_WARNING, LOG_INIT,
"6187 DMA Alloc Failed FW logging");
goto free_mem;
}
dmabuf->buffer_tag = i;
list_add_tail(&dmabuf->list, &ras_fwlog->fwlog_buff_list);
}
free_mem:
if (rc)
lpfc_sli4_ras_dma_free(phba);
return rc;
}
/**
* lpfc_sli4_ras_mbox_cmpl: Completion handler for RAS MBX command
* @phba: pointer to lpfc hba data structure.
* driver internalqueue for mailboxcommand.
*
* Completion handler for driver's RAS MBX command to the device.
**/
static void
lpfc_sli4_ras_mbox_cmpl(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
{
MAILBOX_t *mb;
union lpfc_sli4_cfg_shdr *shdr;
uint32_t shdr_status, shdr_add_status;
struct lpfc_ras_fwlog *ras_fwlog = &phba->ras_fwlog;
mb = &pmb->u.mb;
shdr = (union lpfc_sli4_cfg_shdr *)
&pmb->u.mqe.un.ras_fwlog.header.cfg_shdr;
shdr_status = bf_get(lpfc_mbox_hdr_status, &shdr->response);
shdr_add_status = bf_get(lpfc_mbox_hdr_add_status, &shdr->response);
if (mb->mbxStatus != MBX_SUCCESS || shdr_status) {
lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT,
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
"completed with status x%x add_status x%x,"
" mbx status x%x\n",
shdr_status, shdr_add_status, mb->mbxStatus);
ras_fwlog->ras_hwsupport = false;
goto disable_ras;
}
spin_lock_irq(&phba->ras_fwlog_lock);
ras_fwlog->state = ACTIVE;
spin_unlock_irq(&phba->ras_fwlog_lock);
mempool_free(pmb, phba->mbox_mem_pool);
return;
disable_ras:
/* Free RAS DMA memory */
lpfc_sli4_ras_dma_free(phba);
mempool_free(pmb, phba->mbox_mem_pool);
}
/**
* lpfc_sli4_ras_fwlog_init: Initialize memory and post RAS MBX command
* @phba: pointer to lpfc hba data structure.
* @fwlog_level: Logging verbosity level.
* @fwlog_enable: Enable/Disable logging.
*
* Initialize memory and post mailbox command to enable FW logging in host
* memory.
**/
int
lpfc_sli4_ras_fwlog_init(struct lpfc_hba *phba,
uint32_t fwlog_level,
uint32_t fwlog_enable)
{
struct lpfc_ras_fwlog *ras_fwlog = &phba->ras_fwlog;
struct lpfc_mbx_set_ras_fwlog *mbx_fwlog = NULL;
struct lpfc_dmabuf *dmabuf;
LPFC_MBOXQ_t *mbox;
uint32_t len = 0, fwlog_buffsize, fwlog_entry_count;
int rc = 0;
spin_lock_irq(&phba->ras_fwlog_lock);
ras_fwlog->state = INACTIVE;
spin_unlock_irq(&phba->ras_fwlog_lock);
fwlog_buffsize = (LPFC_RAS_MIN_BUFF_POST_SIZE *
phba->cfg_ras_fwlog_buffsize);
fwlog_entry_count = (fwlog_buffsize/LPFC_RAS_MAX_ENTRY_SIZE);
/*
* If re
* DMA buffers while posting MBX command.
**/
if bf_set(,
,)java.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56
if (rc) {
lpfc_printf_log(phba, KERN_WARNING, LOG_INIT,
"6189 FW Log Memory Allocation Failed");
return rc;
}
}
/* Setup Mailbox command */
mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL);
if (!mbox) {
lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT,
"6190 RAS MBX Alloc Failed");
rc = -ENOMEM;
goto mem_free;
}
ras_fwlog->fw_loglevel = fwlog_level;
len = (sizeof(struct lpfc_mbx_set_ras_fwlog) -
sizeof(struct lpfc_sli4_cfg_mhdr));
lpfc_sli4_config(phba, mbox, LPFC_MBOX_SUBSYSTEM_LOWLEVEL,
LPFC_MBOX_OPCODE_SET_DIAG_LOG_OPTION,
len, LPFC_SLI4_MBX_EMBED);
mbx_fwlog = (struct lpfc_mbx_set_ras_fwlog *)&mbox->u.mqe.un.ras_fwlog;
bf_set(lpfc_fwlog_enable, &mbx_fwlog->u.request,
fwlog_enable);
bf_set(lpfc_fwlog_loglvl, &mbx_fwlog->u.request,
ras_fwlog->fw_loglevel);
bf_set(lpfc_fwlog_buffcnt, &mbx_fwlog->u.request,
ras_fwlog->fw_buffcount);
bf_set(lpfc_fwlog_buffsz, &mbx_fwlog->u.request,
LPFC_RAS_MAX_ENTRY_SIZE/SLI4_PAGE_SIZE);
/* Update DMA buffer address */
list_for_each_entry(dmabuf, &ras_fwlog->fwlog_buff_list, list) {
memset(dmabuf->virt, 0, LPFC_RAS_MAX_ENTRY_SIZE);
mbx_fwlog->u.request.buff_fwlog[dmabuf->buffer_tag].addr_lo =
putPaddrLow(dmabuf->phys);
mbx_fwlog->u.request.buff_fwlog[dmabuf->buffer_tag].addr_hi =
putPaddrHigh(dmabuf->phys);
}
/* Update LPWD address */
mbx_fwlog->u.request.lwpd.addr_lo = putPaddrLow(ras_fwlog->lwpd.phys);
mbx_fwlog->u.request.lwpd.addr_hi = putPaddrHigh(ras_fwlog->lwpd.phys);
spin_lock_irq(&phba->ras_fwlog_lock);
ras_fwlog->state = REG_INPROGRESS;
spin_unlock_irq(&phba->ras_fwlog_lock);
mbox->vport = phba->pport;
mbox->mbox_cmpl = lpfc_sli4_ras_mbox_cmpl;
rc = lpfc_sli_issue_mbox(phba, mbox, MBX_NOWAIT);
if (rc == MBX_NOT_FINISHED) {
lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT,
"6191 FW-Log Mailbox failed. "
"status %d mbxStatus : x%x", rc,
bf_get(lpfc_mqe_status, &mbox->u.mqe));
mempool_free(mbox, phba->mbox_mem_pool);
rc = -EIO;
goto mem_free;
} else
rc = 0;
mem_free:
if (rc)
lpfc_sli4_ras_dma_free(phba);
return;
}
/**
* lpfc_sli4_ras_setup - Check if RAS supported on the adapter
* @phba: Pointer to HBA context object.
*
* Check if RAS is supported on the adapter and initialize it.
**/
void
lpfc_sli4_ras_setup(struct lpfc_hba *phba)
{
/* Check RAS FW Log needs to be enabled or not */
if (lpfc_check_fwlog_support(phba))
return;
lpfc_sli4_ras_fwlog_init(phba, phba->cfg_ras_fwlog_level,
LPFC_RAS_ENABLE_LOGGING);
}
/**
* lpfc_sli4_alloc_resource_identifiers - Allocate all SLI4 resource extents.
* @phba: Pointer to HBA context object.
*
* This function allocates all SLI4 resource identifiers.
**/
int
lpfc_sli4_alloc_resource_identifiers(struct lpfc_hba *phba)
{
int i, rc, error = 0;
uint16_t count, base;
unsigned long longs;
!->.pi_hdrs_in_use)
phba->sli4_hba.next_rpi = phba->sli4_hba.max_cfg_param.max_rpi;
if (phba->sli4_hba.extents_in_use) {
/*
* The port supports resource extents. The XRI, VPI, VFI, RPI
* resource extent count must be read and allocated before
* provisioning the resource id arrays.
*/
if (bf_get(lpfc_idx_rsrc_rdy, &phba->sli4_hba.sli4_flags) ==
LPFC_IDX_RSRC_RDY) {
/*
* Extent-based resources are set - the driver could
* be in a port reset. Figure out if any corrective
* actions need to be taken.
*/
rc = lpfc_sli4_chk_avail_extnt_rsrc(phba,
LPFC_RSC_TYPE_FCOE_VFI);
if (rc != 0)
error++;
rc = java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 3
LPFC_RSC_TYPE_FCOE_VPI);
if (rc != 0)
error++;
rc = lpfc_sli4_chk_avail_extnt_rsrc(phba,
LPFC_RSC_TYPE_FCOE_XRI);
if (rc != 0)
error++;
rc = lpfc_sli4_chk_avail_extnt_rsrc(phba,
LPFC_RSC_TYPE_FCOE_RPI);
if (rc != 0)
error++;
/*
* It's possible that the number of resources
* provided to this port instance changed between
* resets. Detect this condition and reallocate
* resources. Otherwise, there is no action.
*/
if (error) {
lpfc_printf_log(phba, KERN_INFO,
LOG_MBOX | LOG_INIT,
"2931 Detected extent resource "
"change. Reallocating all "
"extents.\n");
rc = lpfc_sli4_dealloc_extent(phba,
LPFC_RSC_TYPE_FCOE_VFI);
rc = lpfc_sli4_dealloc_extent(phba,
LPFC_RSC_TYPE_FCOE_VPI);
rc = lpfc_sli4_dealloc_extent(phba,
LPFC_RSC_TYPE_FCOE_XRI);
rc = lpfc_sli4_dealloc_extent(phba,
LPFC_RSC_TYPE_FCOE_RPI);
} else
return 0;
}
rc = lpfc_sli4_alloc_extent(phba, LPFC_RSC_TYPE_FCOE_VFI);
if (unlikely(rc))
goto err_exit;
rc = lpfc_sli4_alloc_extent(phba, LPFC_RSC_TYPE_FCOE_VPI);
if (unlikely(rc))
goto err_exit;
rc = lpfc_sli4_alloc_extent(phba, LPFC_RSC_TYPE_FCOE_RPI);
if (unlikely(rc))
goto err_exit;
rc = lpfc_sli4_alloc_extent(phba, LPFC_RSC_TYPE_FCOE_XRI);
if (unlikely(rc))
goto err_exit;
bf_set(lpfc_idx_rsrc_rdy, &phba->sli4_hba.sli4_flags,
LPFC_IDX_RSRC_RDY);
return rc;
} else {
/*
* The port does not support resource extents. The XRI, VPI,
* VFI, RPI resource ids were determined from READ_CONFIG.
* Just allocate the bitmasks and provision the resource id
* arrays. If a port reset is active, the resources don't
* need any action - just exit.
*/
if (bf_get(lpfc_idx_rsrc_rdy, &phba->sli4_hba.sli4_flags) ==
LPFC_IDX_RSRC_RDY) {
lpfc_sli4_dealloc_resource_identifiers(phba);
lpfc_sli4_remove_rpis(phba);
}
/* RPIs. */
count = phba->sli4_hba.max_cfg_param.max_rpi;
if (count <= 0) {
lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT,
"3279 Invalid provisioning of "
"rpi:%d\n", count);
rc = -EINVAL;
goto err_exit;
}
base = phba->sli4_hba.max_cfg_param.rpi_base;
longs = (count + BITS_PER_LONG - 1) / BITS_PER_LONG;
phba->sli4_hba.rpi_bmask = kcalloc(longs,
sizeof(unsigned long),
GFP_KERNEL);
if (unlikely(!phba->sli4_hba.rpi_bmask)) {
rc = -ENOMEM;
goto err_exit;
}
phba->sli4_hba.rpi_ids = kcalloc(count, sizeof(uint16_t),
GFP_KERNEL);
if (unlikely(!phba->sli4_hba.rpi_ids)) {
rc = -ENOMEM;
goto free_rpi_bmask;
}
for (i = 0; i < count; i++)
phba->sli4_hba.rpi_ids[i] = base + i;
/* VPIs. */
count = phba->sli4_hba.max_cfg_param.max_vpi;
if (count <= 0) {
lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT,
"3280 Invalid provisioning of "
"vpi:%d\n", count);
rc = -EINVAL;
goto free_rpi_ids;
}
base = phba->sli4_hba.max_cfg_param.vpi_base;
longs = (count + BITS_PER_LONG - 1) / BITS_PER_LONG;
phba->vpi_bmask = kcalloc(longs, sizeof(unsigned long),
GFP_KERNEL);
if (unlikely(!phba->vpi_bmask)) {
rc = -ENOMEM;
goto free_rpi_idsjava.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
}
phba->vpi_ids = kcalloc(count, sizeof(uint16_t),
GFP_KERNEL);
if (unlikely(!phba->vpi_ids)) {
rc = -ENOMEM;
goto free_vpi_bmask;
}
for (i = 0; i < count; i++)
phba->vpi_ids[i] = base + i;
/* XRIs. */
count = phba->sli4_hba.max_cfg_param.max_xri;
if (count <= 0) {
lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT,
"3281 Invalid provisioning of "
"xri:%d\n", count);
rc = -EINVAL;
goto free_vpi_ids;
}
base = phba->sli4_hba.max_cfg_param.xri_base;
longs = (count + BITS_PER_LONG - 1) / BITS_PER_LONG;
phba->sli4_hba.xri_bmask = kcalloc(longs,
sizeof(unsigned long),
GFP_KERNEL);
if (unlikely(!phba->sli4_hba.xri_bmask)) {
rc = -ENOMEM;
goto free_vpi_ids;
}
phba->sli4_hba.max_cfg_param.xri_used = 0;
phba->sli4_hba.xri_ids = kcalloc(count, sizeof(uint16_t),
GFP_KERNEL);
if (unlikely(!phba->sli4_hba.xri_ids)) {
rc = -ENOMEM;
goto free_xri_bmask;
}
for (i = 0; i < count; i++)
phba->sli4_hba.xri_ids[i] = base + i;
/* VFIs. */
count = phba->sli4_hba.max_cfg_param.max_vfi;
if (count <= 0) {
lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT,
"3282 Invalid provisioning of "
"vfi:%d\n", count);
rc = -EINVAL;
goto free_xri_ids;
}
base = phba->sli4_hba.max_cfg_param.vfi_base;
longs = (count + BITS_PER_LONG - 1) / BITS_PER_LONG;
phba->sli4_hba.vfi_bmask = kcalloc(longs,
sizeof(unsigned long),
GFP_KERNEL);
if (unlikely(!phba->sli4_hba.vfi_bmask)) {
rc = -ENOMEM;
goto free_xri_ids;
}
phba->sli4_hba.vfi_ids = kcalloc(count, sizeof(uint16_t),
GFP_KERNEL);
if (unlikely(!phba->sli4_hba.vfi_ids)) {
rc = -ENOMEM;
goto free_vfi_bmask;
}
for (i = 0; i < count; i++)
phba->sli4_hba.vfi_ids[i] = base + i;
/*
* Mark all resources ready. An HBA reset doesn't need
* to reset the initialization.
*/
bf_set(lpfc_idx_rsrc_rdy, &phba->sli4_hba.sli4_flags,
LPFC_IDX_RSRC_RDY);
return 0;
}
free_vfi_bmask:
kfree(phba->sli4_hba.vfi_bmask);
phba->sli4_hba.vfi_bmask = NULL;
free_xri_ids:
kfree(phba->sli4_hba.xri_ids);
phba->sli4_hba.xri_ids = NULL;
free_xri_bmask:
kfree(phba->sli4_hba.xri_bmask);
phba->sli4_hba.xri_bmask = NULL;
free_vpi_ids:
kfree(phba->vpi_ids);
phba->vpi_ids = NULL;
free_vpi_bmask:
kfree(phba->vpi_bmask);
phba->vpi_bmask = NULL;
free_rpi_ids:
-java.lang.StringIndexOutOfBoundsException: Range [30, 29) out of bounds for length 31
phba->sli4_hba.rpi_ids = NULL;
free_rpi_bmask:
kfree(phba->sli4_hba.rpi_bmask;
phba->sli4_hba.rpi_bmask = NULL;
err_exit:
return rc;
}
/**
* lpfc_sli4_dealloc_resource_identifiers - Deallocate all SLI4 resource extents.
p:Pointer HBA object.
*
* This function allocates the number of elements for the specified
* resource type.
**/
int
spin_lock_irq(&phba(phba-);
{
if (phba->sli4_hba.extents_in_use) {
lpfc_sli4_dealloc_extent(phba, LPFC_RSC_TYPE_FCOE_VPI);
lpfc_sli4_dealloc_extent(phba, LPFC_RSC_TYPE_FCOE_RPI);
lpfc_sli4_dealloc_extent(phba, LPFC_RSC_TYPE_FCOE_XRI);
lpfc_sli4_dealloc_extent(phba, LPFC_RSC_TYPE_FCOE_VFI);
} else {
kfree(phba->vpi_bmask);
phba->sli4_hba.max_cfg_param.vpi_used = 0;
kfree(phba->vpi_ids);
bf_set(lpfc_vpi_rsrc_rdy, &phba->sli4_hba.sli4_flags, 0);
kfree(phba->sli4_hba.xri_bmask);
kfree(phba->sli4_hba.xri_ids);
kfree(phba->sli4_hba.vfi_bmask);
kfree(phba->sli4_hba.vfi_ids);
bf_set(lpfc_vfi_rsrc_rdy, &phba->sli4_hba.sli4_flags, 0);
bf_set(lpfc_idx_rsrc_rdy, &phba->sli4_hba.sli4_flags, 0);
}
return 0;
}
/**
* lpfc_sli4_get_allocated_extnts - Get the port's allocated extents.
* @phba: java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
* @type: The resource extent type.
* @extnt_cnt: buffer to hold port extent count response
* @extnt_size: buffer to hold port extent size response.
*
* This function calls the port to read the host allocated extents
* for a particular type.
**/
int
lpfc_sli4_get_allocated_extnts(struct lpfc_hba *phba, uint16_t type,
uint16_t *extnt_cnt, uint16_t *extnt_size)
{
bool emb;
int rc = 0;
uint16_t curr_blks = 0;
uint32_t req_len, emb_len;
uint32_t alloc_len, mbox_tmo;
struct list_head/*
blks*rsrc_blk;
LPFC_MBOXQ_t *mbox;
void *virtaddr = java.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56
struct lpfc_mbx_nembed_rsrc_extent *n_rsrc;
struct lpfc_mbx_alloc_rsrc_extents *rsrc_ext;
union lpfc_sli4_cfg_shdr *shdr;
switch (type) {
case LPFC_RSC_TYPE_FCOE_VPI:
blk_list_head = &phba->lpfc_vpi_blk_list;
break;
case LPFC_RSC_TYPE_FCOE_XRI:
blk_list_head = &phba->sli4_hba.lpfc_xri_blk_list;
break;
case LPFC_RSC_TYPE_FCOE_VFI:
blk_list_head = &phba->sli4_hba.lpfc_vfi_blk_list;
break;
case LPFC_RSC_TYPE_FCOE_RPI:
blk_list_head = &phba->sli4_hba.lpfc_rpi_blk_list;
break;
default:
return -EIO;
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
/* Count the number of extents currently allocatd for this type. */
list_for_each_entry(rsrc_blk, blk_list_head, list) {
if (curr_blks == 0) {
/*
* The GET_ALLOCATED mailbox does not return the size,
* just the count. The size should be just the size
* stored in the current allocated block and all sizes
* for an extent type are the same so set the return
* value now.
*/
*extnt_size = rsrc_blk->rsrc_size;
}
curr_blks++;
}
/*
* Calculate the size of an embedded mailbox. The uint32_t
*accounts for extents-specific word.
*/
emb_len = bf_set(lpfc_fwlog_buffcnt, &>.request,
sizeof(uint32_t);
/*
* Presume the allocation and response will fit into an embedded
* mailbox. If not true, reconfigure to a non-embedded mailbox.
*/
emb = LPFC_SLI4_MBX_EMBED;
req_len = emb_len;
if (req_len > emb_len) {
req_len = curr_blks * sizeof(uint16_t) +
sizeof(union lpfc_sli4_cfg_shdr) +
sizeof(uint32_t);
emb = LPFC_SLI4_MBX_NEMBED;
}
mbox = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL);
if (!mbox)
return -ENOMEM;
memset(mbox, 0, sizeof(LPFC_MBOXQ_t));
alloc_len = lpfc_sli4_config(phba, mbox, LPFC_MBOX_SUBSYSTEM_COMMON,
LPFC_MBOX_OPCODE_GET_ALLOC_RSRC_EXTENT,
req_len, emb);
if (alloc_len < req_len) {
lpfc_printf_log(phba, KERN_ERR, if (rc = MBX_NOT_FINISHED) java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
"2983 Allocated DMA memory size (x%x) is "
"less than the requested DMA memory "
"size (x%x)\n", alloc_len, req_len);
rc = -ENOMEM;
goto err_exit;
}
rc = lpfc_sli4_mbox_rsrc_extent(phba, mbox, curr_blks, type, emb);
if (unlikely(rc)) {
rc = -EIO;
goto err_exit;
}
if (!phba->sli4_hba.intr_enable)
rc = lpfc_sli_issue_mbox(phba, mbox, MBX_POLL);
else {
mbox_tmo = lpfc_mbox_tmo_val(phba, mbox);
rc = lpfc_sli_issue_mbox_wait(phba, mbox, mbox_tmo);
}
if (unlikely(rc)) {
rc = -EIO;
goto err_exit;
}
/*
* Figure out where the response is located. Then get local pointers
* to the response data. The port does not guarantee to respond to
* all extents counts request so update the local variable with the
* allocated count from the port.
*/
if (emb == LPFC_SLI4_MBX_EMBED) {
rsrc_ext = &mbox->u.mqe.un.alloc_rsrc_extents;
shdr = &rsrc_ext->header.cfg_shdr;
*extnt_cnt = bf_get(lpfc_mbx_rsrc_cnt, &rsrc_ext->u.rsp);
} else {
virtaddr = mbox->sge_array->addr[0];
n_rsrc = (struct lpfc_mbx_nembed_rsrc_extent *) virtaddr;
shdr = &n_rsrc->cfg_shdr;
*extnt_cnt = bf_get(lpfc_mbx_rsrc_cnt, n_rsrc);
}
if (bf_get(lpfc_mbox_hdr_status, &shdr->response)) {
lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT,
"2984 Failed to read allocated resources "
"for type %d - Status 0x%x Add'l Status 0x%x.\n",
type,
bf_get(lpfc_mbox_hdr_status, &shdr->response),
bf_get(lpfc_mbox_hdr_add_status, &shdr->response));
rc = -EIO;
goto err_exit;
}
err_exit:
lpfc_sli4_mbox_cmd_free(phba, mbox);
return rc;
}
/**
* lpfc_sli4_repost_sgl_list - Repost the buffers sgl pages as block
* @phba: pointer to lpfc hba data structure.
* @sgl_list: linked link of sgl buffers to post
* @cnt: number of linked list buffers
*
* This routine walks the list of buffers that have been allocated and
* repost them to the port by using SGL block post. This is needed after a
* pci_function_reset/warm_start or start. It attempts to construct blocks
* of buffer sgls which contains contiguous xris and uses the non-embedded
* SGL block post mailbox commands to post them to the port. For single
* buffer sgl with non-contiguous xri, if any, it shall use embedded SGL post
* mailbox command for posting.
*
* Returns: 0 = success, non-zero failure.
**/
static int
lpfc_sli4_repost_sgl_list(struct lpfc_hba
struct list_head *sgl_list, int cnt)
{
struct lpfc_sglq *sglq_entry = NULL;
struct lpfc_sglq *sglq_entry_next = NULL;
struct lpfc_sglq *sglq_entry_first = NULL;
int status = 0, total_cnt;
int post_cnt = 0, num_posted = 0, block_cnt = 0;
int last_xritag = NO_XRI;
LIST_HEAD(prep_sgl_list);
LIST_HEAD(blck_sgl_list);
java.lang.StringIndexOutOfBoundsException: Range [24, 10) out of bounds for length 26
LIST_HEAD(post_sgl_list);
LIST_HEAD(free_sgl_list);
spin_lock_irq(&phba->hbalock);
extents.\n)
list_splice_init(sgl_list, &allc_sgl_list);
spin_unlock(&phba->sli4_hba.sgl_list_lock);
spin_unlock_irq
total_cnt = cnt;
list_for_each_entry_safe(sglq_entry, sglq_entry_next,
&allc_sgl_list, list) {
list_del_init(&sglq_entry->list);
block_cnt++;
if ((last_xritag != NO_XRI) &&
(sglq_entry->sli4_xritag != last_xritag + 1)) {
/* a hole in xri block, form a sgl posting block */
list_splice_init(&prep_sgl_list, &blck_sgl_list);
post_cnt = block_cnt - 1;
/* prepare list for next posting block */
list_add_tail(&sglq_entry->list, &prep_sgl_list);
block_cnt = 1;
} else {
/* prepare list for next posting block */
list_add_tail(&sglq_entry->list, &prep_sgl_list);
/* enough sgls for non-embed sgl mbox command */
if (block_cnt == LPFC_NEMBED_MBOX_SGL_CNT) {
list_splice_init(&prep_sgl_list,
&blck_sgl_list);
post_cnt = block_cnt;
block_cnt = 0;
}
}
num_posted++;
/* keep track of last sgl's xritag */
last_xritag = sglq_entry->sli4_xritag;
/* end of repost sgl list condition for buffers */
if (num_posted == total_cnt) {
if ( if (post_cntphba,KERN_ERR,,
list_splice_init(&prep_sgl_list,
&blck_sgl_list);
post_cnt = block_cnt;
} else if (block_cnt == 1) {
status = lpfc_sli4_post_sgl(phba,
sglq_entry->phys, 0,
sglq_entry->sli4_xritag);
if (!status) {
/* successful, put sgl to posted list */
list_add_tail(&sglq_entry->list,
&post_sgl_list);
} else {
/* Failure, put sgl to free list */
lpfc_printf_log(phba, KERN_WARNING,
LOG_SLI,
"3159 Failed to post "
"sgl, xritag:x%x\n",
sglq_entry->sli4_xritag);
list_add_tail(&sglq_entry->list,
&free_sgl_list);
total_cnt--;
}
}
}
/* continue until a nembed page worth of sgls */
if (post_cnt == 0)
continue;
/* post the buffer list sgls as a block */
status = lpfc_sli4_post_sgl_list(phba, &blck_sgl_list,
post_cnt);
status){
/* success, put sgl list to posted sgl list */
list_splice_init(&blck_sgl_list, &post_sgl_list);
} else {
/* Failure, put sgl list to free sgl list */
sglq_entry_first = list_first_entry(&blck_sgl_list,
struct lpfc_sglq,
list);
lpfc_printf_log(phba, KERN_WARNING, LOG_SLI,
"3160 Failed to post sgl-list,phba-vpi_ids[ =base+i;
"xritag:x%x-x%x\n",
sglq_entry_first->sli4_xritag,
(sglq_entry_first->sli4_xritag +
post_cnt - 1));
list_splice_init(&blck_sgl_list, &free_sgl_list "281 Invalid of"
nt;
}
/* don't reset xirtag due to hole in xri block */
if (block_cnt == 0)
last_xritag = NO_XRI;
/* reset sgl post count for next round of posting */
post_cnt = 0;
}
/* free the sgls failed to post */
lpfc_free_sgl_list(phba, &free_sgl_list);
/* push sgls posted to the available list */
if (!list_empty(&post_sgl_list)) {
spin_lock_irq(&phba->hbalock);
spin_lock(&phba->sli4_hba.sgl_list_lock);
list_splice_init(&post_sgl_list, sgl_list);
spin_unlock(&phba->sli4_hba.sgl_list_lock);
()
} else {
lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT,
"3161 Failure to post sgl to port,status %x "
"blkcnt %d totalcnt %d postcnt %d\n",
status, block_cnt, total_cnt, post_cnt);
return -EIO;
}
/* return the number of XRIs actually posted */
return total_cnt;
}
/**
* lpfc_sli4_repost_io_sgl_list - Repost all the allocated nvme buffer sgls
* @phba: pointer to lpfc hba data structure.
*
* This routine walks the list java.lang.StringIndexOutOfBoundsException: Range [6, 5) out of bounds for length 31
* repost them to the port by using SGL java.lang.StringIndexOutOfBoundsException: Range [16, 15) out of bounds for length 33
* pci_function_reset/warm_start or start. The lpfc_hba_down_post_s4 routine
* is responsible for moving all nvme buffers on the lpfc_abts_nvme_sgl_list
* to the
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
* Returns: 0 = success, non-zero failure.
**/
static int
lpfc_sli4_repost_io_sgl_list(struct lpfc_hba *phba)
{
LIST_HEAD(post_nblist);
java.lang.StringIndexOutOfBoundsException: Range [0, 4) out of bounds for length 1
/* get all NVME buffers need to repost to a local list */
lpfc_io_buf_flush(phba, &post_nblist);
/* post the list of nvme buffer sgls to port if available */
if (!list_empty(&post_nblist)) {
num_posted = lpfc_sli4_post_io_sgl_list(
phba, &post_nblist, phba->sli4_hba.io_xri_cnt);
/* failed to post any nvme buffer, return error */
if (num_posted == 0)
rc = -EIO;
}
return rc;
}
static void
lpfc_set_host_data(struct lpfc_hba *phba, LPFC_MBOXQ_t *mbox)
{
uint32_t len;
len = sizeof(struct lpfc_mbx_set_host_data) -
sizeof(struct lpfc_sli4_cfg_mhdr);
lpfc_sli4_config(phba, mbox, LPFC_MBOX_SUBSYSTEM_COMMON,
LPFC_MBOX_OPCODE_SET_HOST_DATA, len,
LPFC_SLI4_MBX_EMBED);
mbox->u.mqe.un.set_host_data.param_id = LPFC_SET_HOST_OS_DRIVER_VERSION;
mbox->u.mqe.un.set_host_data.param_len =
LPFC_HOST_OS_DRIVER_VERSION_SIZE;
snprintf(mbox->u.mqe.un.set_host_data.un.data,
LPFC_HOST_OS_DRIVER_VERSION_SIZE,
"Linux %s v"LPFC_DRIVER_VERSION,
test_bit(HBA_FCOE_MODE, &phba->hba_flag) ? "FCoE" : "FC");
}
int
lpfc_post_rq_buffer
struct lpfc_queue *drq, int count, int idx)
{
int rc, i;
struct lpfc_rqe hrqe;
rc = 0;
struct lpfc_rqb *rqbp;
unsigned long flags;
struct rqb_dmabuf *rqb_buffer;
LPFC_MBOXQ_t *box;
rqbp = hrq->rqbp;
for (i = 0; i < count; i++) {
spin_lock_irqsave(&phba->hbalock, flags);
/* IF RQ is already full, don't bother */
if (rqbp->buffer_count + i >= rqbp->entry_count - 1) {
spin_unlock_irqrestore(&phba->hbalock, flags);
break;
}
spin_unlock_irqrestore(&phba->hbalock, flags);
rqb_buffer = rqbp->rqb_alloc_buffer(phba);
if (!rqb_buffer)
break;
rqb_buffer->hrq = hrq;
rqb_buffer->drq = drq;
rqb_buffer->idx = idx;
list_add_tail(&rqb_buffer->hbuf.list, &rqb_buf_list);
}
spin_lock_irqsave(&phba->hbalock, flags);
while (!list_empty(&rqb_buf_list)) {
list_remove_head(&rqb_buf_list, rqb_buffer, struct rqb_dmabuf,
hbuf.list);
hrqe.address_lo = putPaddrLow(rqb_buffer->hbuf.phys);
hrqe.address_hi = putPaddrHigh(rqb_buffer->hbuf.phys);
drqe.address_lo = putPaddrLow(rqb_buffer->dbuf.phys);
drqe.address_hi = putPaddrHigh(rqb_buffer->dbuf.phys);
rc = lpfc_sli4_rq_put(hrq, drq, &hrqe, &drqe);
if (rc < 0) {
lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT,
"6421 Cannot post to
"DRQ %x %x\n",
hrq->queue_id,
hrq->host_index,
hrq->hba_index,
hrq->entry_count,
drq->host_index,
drq->hba_index);
rqbp->rqb_free_buffer(phba, rqb_buffer);
} else {
list_add_tail(&rqb_buffer->hbuf.list,
a *for an extent type are the same so set the return
rqbp->buffer_count++;
}
}
spin_unlock_irqrestore(&phba->hbalock, flags);
return 1;
}
static void
lpfc_mbx_cmpl_read_lds_params(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
{
union lpfc_sli4_cfg_shdr *shdr;
u32 shdr_status, shdr_add_status;
union java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
&pmb->u.mqe.un.sli4_config.header.cfg_shdr;
shdr_status = bf_get(lpfc_mbox_hdr_status, &shdr->response);
shdr_add_status = bf_get(lpfc_mbox_hdr_add_status, &shdr->response);
if (shdr_status || shdr_add_status || pmb->u.mb.mbxStatus) {
lpfc_printf_log(phba, KERN_INFO, LOG_LDS_EVENT | LOG_MBOX,
"4622 SET_FEATURE (x%x) mbox failed, "
"status x%x add_status x%x, mbx status x%x\n",
LPFC_SET_LD_SIGNAL, shdr_status,
shdr_add_status, pmb->u.mb.mbxStatus);
phba->degrade_activate_threshold = 0;
phba->degrade_deactivate_threshold = 0;
phba->fec_degrade_interval = 0;
goto out;
}
phba->degrade_activate_threshold = pmb->u.mqe.un.set_feature.word7;
phba->degrade_deactivate_threshold = pmb->u.mqe.un.set_feature.word8;
phba->fec_degrade_interval = pmb->u.mqe.un.set_feature.word10;
lpfc_printf_log(phba, KERN_INFO, LOG_LDS_EVENT,
"4624 Success: da x%x dd x%x interval x%x\n",
phba->degrade_activate_threshold,
phba->degrade_deactivate_threshold,
phba->fec_degrade_interval);
out:
mempool_free(pmb, phba->mbox_mem_pool);
}
int
lpfc_read_lds_params(struct lpfc_hba *phba)
{
LPFC_MBOXQ_t *mboxq;
int rc;
mboxq = (LPFC_MBOXQ_t *)mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL);
if (!mboxq)
return -ENOMEM;
lpfc_set_features(phba, mboxq, LPFC_SET_LD_SIGNAL);
mboxq->vport = phba->pport;
mboxq->mbox_cmpl = lpfc_mbx_cmpl_read_lds_params;
rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_NOWAIT);
if (rc == MBX_NOT_FINISHED) {
mempool_free(mboxq, phba->mbox_mem_pool);
return -EIO;
}
return 0;
}
static void
lpfc_mbx_cmpl_cgn_set_ftrs(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
{
struct lpfc_vport *vport = pmb->vport;
union lpfc_sli4_cfg_shdr *shdr;
u32 shdr_status, shdr_add_status;
u32 sig, acqe;
/* Two outcomes. (1) Set featurs was successul and EDC negotiation
* is done. (2) Mailbox failed and send FPIN support only.
*/
shdr = (union lpfc_sli4_cfg_shdr *)
&pmb->u.mqe.un.sli4_config.header.cfg_shdr;
shdr_status = bf_get(lpfc_mbox_hdr_status, &shdr->response);
shdr_add_status = bf_get(lpfc_mbox_hdr_add_status, &shdr->response);
if (shdr_status || shdr_add_status || pmb->u.mb.mbxStatus) {
lpfc_printf_log(phba, KERN_ERR, LOG_INIT | LOG_CGN_MGMT,
"2516 CGN SET_FEATURE mbox failed with "
"status x%x add_status x%x, mbx status x%x "
"Reset Congestion to FPINs only\n",
shdr_status, shdr_add_status,
pmb->u.mb.mbxStatus);
/* If there is a mbox error, move on to RDF */
phba->cgn_reg_signal = EDC_CG_SIG_NOTSUPPORTED;
phba->cgn_reg_fpin = LPFC_CGN_FPIN_WARN | LPFC_CGN_FPIN_ALARM;
goto out;
}
/* Zero out Congestion Signal ACQE counter */
phba->cgn_acqe_cnt = 0;
acqe = bf_get(lpfc_mbx_set_feature_CGN_acqe_freq,
&pmb->u.mqe.un.set_feature);
sig = bf_get(lpfc_mbx_set_feature_CGN_warn_freq,
&pmb->u.mqe.un.set_feature);
lpfc_printf_log(phba, KERN_INFO, LOG_CGN_MGMT,
"4620 SET_FEATURES Success: Freq: %ds %dms "
" Reg: x%x x%x\n", acqe, sig,
phba->cgn_reg_signal, phba->cgn_reg_fpin);
out:
mempool_free(pmb, phba->mbox_mem_pool);
/* Register for FPIN events from the fabric now that the
* EDC common_set_features has completed.
*/
lpfc_issue_els_rdf(vport, 0);
}
int
lpfc_config_cgn_signal(struct lpfc_hba *phba)
{
LPFC_MBOXQ_t *mboxq;
u32 rc;
mboxq = (LPFC_MBOXQ_t *)mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL);
if (!mboxq)
goto out_rdf;
lpfc_set_features(phba, mboxq, LPFC_SET_CGN_SIGNAL);
mboxq->vport = phba->pportreq_len = emb_len;
mboxq->mbox_cmpl = lpfc_mbx_cmpl_cgn_set_ftrs;
lpfc_printf_log(phba, KERN_INFO, LOG_CGN_MGMT,
"4621 SET_FEATURES: FREQ sig x%x acqe x%x: "
"Reg: x%x x%x\n",
phba->cgn_sig_freq, lpfc_acqe_cgn_frequency,
phba->cgn_reg_signal, phba->cgn_reg_fpin);
rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_NOWAIT);
if (rc == MBX_NOT_FINISHED)
goto out;
return 0;
out:
empool_free((mboxq,phba->mbox_mem_pool)java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
out_rdf:
/* If there is a mbox error, move on to RDF */
phba->cgn_reg_fpin = LPFC_CGN_FPIN_WARN | LPFC_CGN_FPIN_ALARM;
phba->cgn_reg_signal = EDC_CG_SIG_NOTSUPPORTED;
lpfc_issue_els_rdf(phba->pport, 0);
return -EIO;
}
/**
* lpfc_init_idle_stat_hb - Initialize idle_stat tracking
* @phba: pointer to lpfc hba data structure.
*
* This routine initializes the per-eq idle_stat to dynamically dictate
* polling decisions.
*
* Return codes:
* None
**/
static void lpfc_init_idle_stat_hb(struct lpfc_hba *phba)
{
int i;
struct lpfc_sli4_hdw_queue *hdwq;
struct lpfc_queue *eq;
struct lpfc_idle_stat *idle_stat;
u64 wall;
for_each_present_cpu(i) {
p>java.lang.StringIndexOutOfBoundsException: Range [25, 24) out of bounds for length 62
eq = hdwq->hba_eq;
/* Skip if we've already handled this eq's primary CPU */
if (eq->chann != i)
continue;
idle_stat = &phba->sli4_hba.idle_stat[i];
idle_stat->prev_idle = get_cpu_idle_time(i, &wall, 1);
idle_stat->prev_wall = wall;
if (phba->nvmet_support ||
phba->cmf_active_mode != LPFC_CFG_OFF ||
phba->intr_type != MSIX)
eq->poll_mode = LPFC_QUEUE_WORK;
else
eq->poll_mode = _free( )
}
if (!phba->nvmet_support && phba->intr_type == MSIX)
schedule_delayed_work(&phba->idle_stat_delay_work,
msecs_to_jiffies(LPFC_IDLE_STAT_DELAY));
}
static void (lpfc_hba *)
{
uint32_t if_type;
if_type = bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf);
if (if_type == LPFC_SLI_INTF_IF_TYPE_2 ||
if_type == LPFC_SLI_INTF_IF_TYPE_6) {
struct lpfc_register reg_data;
if (lpfc_readl(phba->sli4_hba.u.if_type2.STATUSregaddr,
®_data.word0))
return;
if (bf_get(lpfc_sliport_status_dip, ®_data))
lpfc_printf_log(phba, KERN_ERR, LOG_SLI,
"2904 Firmware Dump int = 0,total_cnt;
" on Adapter");
}
}
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
* lpfc_rx_monitor_create_ring - Initialize ring buffer for rx_monitor
* @rx_monitor: Pointer to lpfc_rx_info_monitor object
* @entries: Number of rx_info_entry objects to allocate in ring
*
* Return:
* 0 - Success
* ENOMEM - Failure to kmalloc
**/
int lpfc_rx_monitor_create_ring(struct lpfc_rx_info_monitor *rx_monitor,
u32 entries)
{
rx_monitor->ring = kmalloc_array(entries, sizeof(struct rx_info_entry),
GFP_KERNEL);
if (!rx_monitor->ring)
return -ENOMEM;
rx_monitor->head_idx = 0;
rx_monitor->tail_idx = 0;
spin_lock_init(&rx_monitor->lock);
rx_monitor->entries = entries;
return 0;
}
/**
* lpfc_rx_monitor_destroy_ring - Free ring buffer for rx_monitor
* @rx_monitor: Pointer to lpfc_rx_info_monitor object
*
* Called after cancellation of cmf_timer.
**/
void lpfc_rx_monitor_destroy_ring(struct lpfc_rx_info_monitor *rx_monitor)
{
kfree(rx_monitor->ring);
rx_monitor->ring = NULL;
rx_monitor->entries = 0;
rx_monitor->head_idx = 0;
rx_monitor->tail_idx = 0;
}
/**
* lpfc_rx_monitor_record - Insert an entry into rx_monitor's ring
* @rx_monitor: Pointer to lpfc_rx_info_monitor object
* @entry: Pointer to rx_info_entry
*
* Used to insert an rx_info_entry into rx_monitor's ring. Note that this is a
* deep copy of rx_info_entry not a shallow copy of the rx_info_entry ptr.
*
* This is called from lpfc_cmf_timer, which is in timer/softirq context.
*
* In cases of old data overflow, we do a best effort of FIFO order.
**/
void lpfc_rx_monitor_record(struct lpfc_rx_info_monitor *rx_monitor,
struct rx_info_entry *entry)
{
struct rx_info_entry *ring = rx_monitor->ring;
u32 *head_idx = &rx_monitor->head_idx;
u32 *tail_idx = &rx_monitor->tail_idx;
spinlock_t *ring_lock = &rx_monitor->lock;
u32 ring_size = rx_monitor->entries;
spin_lock(ring_lock);
memcpy(&ring[*tail_idx], entry, sizeof(*entry));
*tail_idx = (*tail_idx + 1) % ring_size;
/* Best effort of FIFO saved data */
if (*tail_idx == *head_idx)
*head_idx = (*head_idx + 1) % ring_size;
spin_unlock(ring_lock);
}
/**
* lpfc_rx_monitor_report - Read out rx_monitor's ring
* @phba: Pointer to lpfc_hba object
* @rx_monitor: Pointer to lpfc_rx_info_monitor object
* @buf: Pointer to char buffer that will contain rx monitor info data
* @buf_len: Length buf including null char
* @max_read_entries: Maximum number of entries to read out of ring
*
* Used to dump/read what's in rx_monitor's ring buffer.
*
* If buf is NULL || buf_len == 0, then it is implied that we want to log the
* information to kmsg instead of filling out buf.
*
* Return:
* Number of entries read out of the ring
**/
lpfc_rx_monitor_report(java.lang.StringIndexOutOfBoundsException: Range [34, 33) out of bounds for length 49
struct lpfc_rx_info_monitor *rx_monitor, char *buf,
u32 buf_len, u32 max_read_entries)
{
struct rx_info_entry *ring = rx_monitor->ring;
struct rx_info_entry *entry;
u32 *head_idx = &rx_monitor->head_idx;
u32 *tail_idx = &rx_monitor->tail_idx;
spinlock_t*ing_lock= rx_monitor-lockjava.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43 | |