X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;ds=sidebyside;f=drivers%2Fnet%2Fliquidio%2Flio_rxtx.h;h=d2a45104f04c1b2e8804180689fcec01fe2483d7;hb=dc111b5e068172c48f9a19987700cc44cadb6d6b;hp=964a884ef580be279e460ac7e2cdaa704ca7901f;hpb=cf6bfcbea178e795008a85b9106eda0b122ddd27;p=dpdk.git diff --git a/drivers/net/liquidio/lio_rxtx.h b/drivers/net/liquidio/lio_rxtx.h index 964a884ef5..d2a45104f0 100644 --- a/drivers/net/liquidio/lio_rxtx.h +++ b/drivers/net/liquidio/lio_rxtx.h @@ -1,34 +1,5 @@ -/* - * BSD LICENSE - * - * Copyright(c) 2017 Cavium, Inc.. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Cavium, Inc. nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER(S) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2017 Cavium, Inc */ #ifndef _LIO_RXTX_H_ @@ -249,6 +220,40 @@ union octeon_cmd { #define OCTEON_CMD_SIZE (sizeof(union octeon_cmd)) +/* Maximum number of 8-byte words can be + * sent in a NIC control message. + */ +#define LIO_MAX_NCTRL_UDD 32 + +/* Structure of control information passed by driver to the BASE + * layer when sending control commands to Octeon device software. + */ +struct lio_ctrl_pkt { + /** Command to be passed to the Octeon device software. */ + union octeon_cmd ncmd; + + /** Send buffer */ + void *data; + uint64_t dmadata; + + /** Response buffer */ + void *rdata; + uint64_t dmardata; + + /** Additional data that may be needed by some commands. */ + uint64_t udd[LIO_MAX_NCTRL_UDD]; + + /** Input queue to use to send this command. */ + uint64_t iq_no; + + /** Time to wait for Octeon software to respond to this control command. + * If wait_time is 0, BASE assumes no response is expected. + */ + size_t wait_time; + + struct lio_dev_ctrl_cmd *ctrl_cmd; +}; + /** Structure of data information passed by driver to the BASE * layer when forwarding data to Octeon device software. */ @@ -549,6 +554,7 @@ lio_prepare_pci_cmd(struct lio_device *lio_dev, packet_params.pkt_params32 = 0; packet_params.s.ip_csum = setup->s.ip_csum; packet_params.s.transport_csum = setup->s.transport_csum; + packet_params.s.tnl_csum = setup->s.tnl_csum; packet_params.s.tsflag = setup->s.timestamp; irh->ossp = packet_params.pkt_params32; @@ -570,6 +576,16 @@ int lio_send_soft_command(struct lio_device *lio_dev, struct lio_soft_command *sc); void lio_free_soft_command(struct lio_soft_command *sc); +/** Send control packet to the device + * @param lio_dev - lio device pointer + * @param nctrl - control structure with command, timeout, and callback info + * + * @returns IQ_FAILED if it failed to add to the input queue. IQ_STOP if it the + * queue should be stopped, and LIO_IQ_SEND_OK if it sent okay. + */ +int lio_send_ctrl_pkt(struct lio_device *lio_dev, + struct lio_ctrl_pkt *ctrl_pkt); + /** Maximum ordered requests to process in every invocation of * lio_process_ordered_list(). The function will continue to process requests * as long as it can find one that has finished processing. If it keeps @@ -625,6 +641,9 @@ void lio_setup_response_list(struct lio_device *lio_dev); */ int lio_process_ordered_list(struct lio_device *lio_dev); +#define LIO_INCR_INSTRQUEUE_PKT_COUNT(lio_dev, iq_no, field, count) \ + (((lio_dev)->instr_queue[iq_no]->stats.field) += count) + static inline void lio_swap_8B_data(uint64_t *data, uint32_t blocks) { @@ -638,9 +657,9 @@ lio_swap_8B_data(uint64_t *data, uint32_t blocks) static inline uint64_t lio_map_ring(void *buf) { - phys_addr_t dma_addr; + rte_iova_t dma_addr; - dma_addr = rte_mbuf_data_dma_addr_default(((struct rte_mbuf *)buf)); + dma_addr = rte_mbuf_data_iova_default(((struct rte_mbuf *)buf)); return (uint64_t)dma_addr; } @@ -648,7 +667,7 @@ lio_map_ring(void *buf) static inline uint64_t lio_map_ring_info(struct lio_droq *droq, uint32_t i) { - phys_addr_t dma_addr; + rte_iova_t dma_addr; dma_addr = droq->info_list_dma + (i * LIO_DROQ_INFO_SIZE); @@ -704,6 +723,7 @@ int lio_setup_sglists(struct lio_device *lio_dev, int iq_no, int fw_mapped_iq, int num_descs, unsigned int socket_id); uint16_t lio_dev_xmit_pkts(void *tx_queue, struct rte_mbuf **pkts, uint16_t nb_pkts); +int lio_wait_for_instr_fetch(struct lio_device *lio_dev); int lio_setup_iq(struct lio_device *lio_dev, int q_index, union octeon_txpciq iq_no, uint32_t num_descs, void *app_ctx, unsigned int socket_id); @@ -716,4 +736,5 @@ void lio_delete_instruction_queue(struct lio_device *lio_dev, int iq_no); */ int lio_setup_instr_queue0(struct lio_device *lio_dev); void lio_free_instr_queue0(struct lio_device *lio_dev); +void lio_dev_clear_queues(struct rte_eth_dev *eth_dev); #endif /* _LIO_RXTX_H_ */