X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;ds=sidebyside;f=lib%2Flibrte_pmd_i40e%2Fi40e%2Fi40e_adminq.c;h=e76e0aff8f3e50e34a50daeec96a85804d2de72f;hb=089159d25f6f534cd29c5e5e0d1893193e49bb5a;hp=d078cea130c1fa856260c2bc10dc66e4518232a5;hpb=8db9e2a1b2327ca0b9178e47f92e81b729cf0702;p=dpdk.git diff --git a/lib/librte_pmd_i40e/i40e/i40e_adminq.c b/lib/librte_pmd_i40e/i40e/i40e_adminq.c index d078cea130..e76e0aff8f 100644 --- a/lib/librte_pmd_i40e/i40e/i40e_adminq.c +++ b/lib/librte_pmd_i40e/i40e/i40e_adminq.c @@ -1,6 +1,6 @@ /******************************************************************************* -Copyright (c) 2013 - 2014, Intel Corporation +Copyright (c) 2013 - 2015, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without @@ -37,7 +37,7 @@ POSSIBILITY OF SUCH DAMAGE. #include "i40e_adminq.h" #include "i40e_prototype.h" -#ifndef VF_DRIVER +#ifdef PF_DRIVER /** * i40e_is_nvm_update_op - return true if this is an NVM update operation * @desc: API request descriptor @@ -48,7 +48,7 @@ STATIC INLINE bool i40e_is_nvm_update_op(struct i40e_aq_desc *desc) desc->opcode == CPU_TO_LE16(i40e_aqc_opc_nvm_update)); } -#endif /* VF_DRIVER */ +#endif /* PF_DRIVER */ /** * i40e_adminq_init_regs - Initialize AdminQ registers * @hw: pointer to the hardware structure @@ -58,7 +58,7 @@ STATIC INLINE bool i40e_is_nvm_update_op(struct i40e_aq_desc *desc) STATIC void i40e_adminq_init_regs(struct i40e_hw *hw) { /* set head and tail registers in our local struct */ - if (hw->mac.type == I40E_MAC_VF) { + if (i40e_is_vf(hw)) { hw->aq.asq.tail = I40E_VF_ATQT1; hw->aq.asq.head = I40E_VF_ATQH1; hw->aq.asq.len = I40E_VF_ATQLEN1; @@ -559,7 +559,7 @@ enum i40e_status_code i40e_shutdown_arq(struct i40e_hw *hw) enum i40e_status_code i40e_init_adminq(struct i40e_hw *hw) { enum i40e_status_code ret_code; -#ifndef VF_DRIVER +#ifdef PF_DRIVER u16 eetrack_lo, eetrack_hi; int retry = 0; #endif @@ -593,7 +593,12 @@ enum i40e_status_code i40e_init_adminq(struct i40e_hw *hw) if (ret_code != I40E_SUCCESS) goto init_adminq_free_asq; -#ifndef VF_DRIVER +#ifdef PF_DRIVER +#ifdef INTEGRATED_VF + /* VF has no need of firmware */ + if (i40e_is_vf(hw)) + goto init_adminq_exit; +#endif /* There are some cases where the firmware may not be quite ready * for AdminQ operations, so we retry the AdminQ setup a few times * if we see timeouts in this first AQ call. @@ -633,13 +638,13 @@ enum i40e_status_code i40e_init_adminq(struct i40e_hw *hw) I40E_HMC_PROFILE_DEFAULT, 0, NULL); +#endif /* PF_DRIVER */ ret_code = I40E_SUCCESS; -#endif /* VF_DRIVER */ /* success! */ goto init_adminq_exit; -#ifndef VF_DRIVER +#ifdef PF_DRIVER init_adminq_free_arq: i40e_shutdown_arq(hw); #endif @@ -690,9 +695,6 @@ u16 i40e_clean_asq(struct i40e_hw *hw) desc = I40E_ADMINQ_DESC(*asq, ntc); details = I40E_ADMINQ_DETAILS(*asq, ntc); -#ifdef DMA_SYNC_SUPPORT - I40E_DMA_SYNC(&hw->aq.asq.desc_buf, I40E_SYNC_FORKERNEL); -#endif /* DMA_SYNC_SUPPORT */ while (rd32(hw, hw->aq.asq.head) != ntc) { i40e_debug(hw, I40E_DEBUG_AQ_MESSAGE, "%s: ntc %d head %d.\n", __FUNCTION__, ntc, @@ -775,7 +777,7 @@ enum i40e_status_code i40e_asq_send_command(struct i40e_hw *hw, goto asq_send_command_exit; } -#ifndef VF_DRIVER +#ifdef PF_DRIVER if (i40e_is_nvm_update_op(desc) && hw->aq.nvm_busy) { i40e_debug(hw, I40E_DEBUG_AQ_MESSAGE, "AQTX: NVM busy.\n"); status = I40E_ERR_NVM; @@ -866,17 +868,12 @@ enum i40e_status_code i40e_asq_send_command(struct i40e_hw *hw, CPU_TO_LE32(I40E_HI_DWORD(dma_buff->pa)); desc_on_ring->params.external.addr_low = CPU_TO_LE32(I40E_LO_DWORD(dma_buff->pa)); -#ifdef DMA_SYNC_SUPPORT - I40E_DMA_SYNC(dma_buff, I40E_SYNC_FORDEVICE); -#endif /* DMA_SYNC_SUPPORT */ } -#ifdef DMA_SYNC_SUPPORT - I40E_DMA_SYNC(&hw->aq.asq.desc_buf, I40E_SYNC_FORDEVICE); -#endif /* DMA_SYNC_SUPPORT */ /* bump the tail */ i40e_debug(hw, I40E_DEBUG_AQ_MESSAGE, "AQTX: desc and buffer:\n"); - i40e_debug_aq(hw, I40E_DEBUG_AQ_COMMAND, (void *)desc_on_ring, buff); + i40e_debug_aq(hw, I40E_DEBUG_AQ_COMMAND, (void *)desc_on_ring, + buff, buff_size); (hw->aq.asq.next_to_use)++; if (hw->aq.asq.next_to_use == hw->aq.asq.count) hw->aq.asq.next_to_use = 0; @@ -888,7 +885,6 @@ enum i40e_status_code i40e_asq_send_command(struct i40e_hw *hw, */ if (!details->async && !details->postpone) { u32 total_delay = 0; - u32 delay_len = 1; do { /* AQ designers suggest use of head for better @@ -897,16 +893,13 @@ enum i40e_status_code i40e_asq_send_command(struct i40e_hw *hw, if (i40e_asq_done(hw)) break; /* ugh! delay while spin_lock */ - i40e_msec_delay(delay_len); - total_delay += delay_len; + i40e_msec_delay(1); + total_delay++; } while (total_delay < hw->aq.asq_cmd_timeout); } /* if ready, copy the desc back to temp */ if (i40e_asq_done(hw)) { -#ifdef DMA_SYNC_SUPPORT - I40E_DMA_SYNC(&hw->aq.asq.desc_buf, I40E_SYNC_FORKERNEL); -#endif /* DMA_SYNC_SUPPORT */ i40e_memcpy(desc, desc_on_ring, sizeof(struct i40e_aq_desc), I40E_DMA_TO_NONDMA); if (buff != NULL) @@ -930,11 +923,9 @@ enum i40e_status_code i40e_asq_send_command(struct i40e_hw *hw, hw->aq.asq_last_status = (enum i40e_admin_queue_err)retval; } - if (LE16_TO_CPU(desc->datalen) == buff_size) { - i40e_debug(hw, I40E_DEBUG_AQ_MESSAGE, - "AQTX: desc and buffer writeback:\n"); - i40e_debug_aq(hw, I40E_DEBUG_AQ_COMMAND, (void *)desc, buff); - } + i40e_debug(hw, I40E_DEBUG_AQ_MESSAGE, + "AQTX: desc and buffer writeback:\n"); + i40e_debug_aq(hw, I40E_DEBUG_AQ_COMMAND, (void *)desc, buff, buff_size); /* update the error if time out occurred */ if ((!cmd_completed) && @@ -945,11 +936,11 @@ enum i40e_status_code i40e_asq_send_command(struct i40e_hw *hw, status = I40E_ERR_ADMIN_QUEUE_TIMEOUT; } -#ifndef VF_DRIVER +#ifdef PF_DRIVER if (!status && i40e_is_nvm_update_op(desc)) hw->aq.nvm_busy = true; -#endif /* VF_DRIVER */ +#endif /* PF_DRIVER */ asq_send_command_error: i40e_release_spinlock(&hw->aq.asq_spinlock); asq_send_command_exit: @@ -995,9 +986,6 @@ enum i40e_status_code i40e_clean_arq_element(struct i40e_hw *hw, u16 datalen; u16 flags; u16 ntu; -#ifdef DMA_SYNC_SUPPORT - I40E_DMA_SYNC(&hw->aq.arq.desc_buf, I40E_SYNC_FORKERNEL); -#endif /* DMA_SYNC_SUPPORT */ /* take the lock before we start messing with the ring */ i40e_acquire_spinlock(&hw->aq.arq_spinlock); @@ -1016,9 +1004,6 @@ enum i40e_status_code i40e_clean_arq_element(struct i40e_hw *hw, /* now clean the next descriptor */ desc = I40E_ADMINQ_DESC(hw->aq.arq, ntc); desc_idx = ntc; -#ifdef DMA_SYNC_SUPPORT - I40E_DMA_SYNC(&hw->aq.arq.r.arq_bi[desc_idx], I40E_SYNC_FORKERNEL); -#endif /* DMA_SYNC_SUPPORT */ flags = LE16_TO_CPU(desc->flags); if (flags & I40E_AQ_FLAG_ERR) { @@ -1029,19 +1014,20 @@ enum i40e_status_code i40e_clean_arq_element(struct i40e_hw *hw, I40E_DEBUG_AQ_MESSAGE, "AQRX: Event received with error 0x%X.\n", hw->aq.arq_last_status); - } else { - i40e_memcpy(&e->desc, desc, sizeof(struct i40e_aq_desc), - I40E_DMA_TO_NONDMA); - datalen = LE16_TO_CPU(desc->datalen); - e->msg_size = min(datalen, e->msg_size); - if (e->msg_buf != NULL && (e->msg_size != 0)) - i40e_memcpy(e->msg_buf, - hw->aq.arq.r.arq_bi[desc_idx].va, - e->msg_size, I40E_DMA_TO_NONDMA); } + i40e_memcpy(&e->desc, desc, sizeof(struct i40e_aq_desc), + I40E_DMA_TO_NONDMA); + datalen = LE16_TO_CPU(desc->datalen); + e->msg_len = min(datalen, e->buf_len); + if (e->msg_buf != NULL && (e->msg_len != 0)) + i40e_memcpy(e->msg_buf, + hw->aq.arq.r.arq_bi[desc_idx].va, + e->msg_len, I40E_DMA_TO_NONDMA); + i40e_debug(hw, I40E_DEBUG_AQ_MESSAGE, "AQRX: desc and buffer:\n"); - i40e_debug_aq(hw, I40E_DEBUG_AQ_COMMAND, (void *)desc, e->msg_buf); + i40e_debug_aq(hw, I40E_DEBUG_AQ_COMMAND, (void *)desc, e->msg_buf, + hw->aq.arq_buf_size); /* Restore the original datalen and buffer address in the desc, * FW updates datalen to indicate the event message @@ -1072,7 +1058,7 @@ clean_arq_element_out: *pending = (ntc > ntu ? hw->aq.arq.count : 0) + (ntu - ntc); i40e_release_spinlock(&hw->aq.arq_spinlock); -#ifndef VF_DRIVER +#ifdef PF_DRIVER if (i40e_is_nvm_update_op(&e->desc)) { hw->aq.nvm_busy = false; if (hw->aq.nvm_release_on_done) {