/********************************************************************** * Author: Cavium, Inc. * * Contact: [email protected] * Please include "LiquidIO" in the subject. * * Copyright (c) 2003-2016 Cavium, Inc. * * This file is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, Version 2, as * published by the Free Software Foundation. * * This file is distributed in the hope that it will be useful, but * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or * NONINFRINGEMENT. See the GNU General Public License for more details. ***********************************************************************/ /*! \file octeon_iq.h * \brief Host Driver: Implementation of Octeon input queues. "Input" is * with respect to the Octeon device on the NIC. From this driver's * point of view they are egress queues. */ #ifndef __OCTEON_IQ_H__ #define __OCTEON_IQ_H__ #define IQ_STATUS_RUNNING … #define IQ_SEND_OK … #define IQ_SEND_STOP … #define IQ_SEND_FAILED … /*------------------------- INSTRUCTION QUEUE --------------------------*/ /* \cond */ #define REQTYPE_NONE … #define REQTYPE_NORESP_NET … #define REQTYPE_NORESP_NET_SG … #define REQTYPE_RESP_NET … #define REQTYPE_RESP_NET_SG … #define REQTYPE_SOFT_COMMAND … #define REQTYPE_LAST … struct octeon_request_list { … }; /* \endcond */ /** Input Queue statistics. Each input queue has four stats fields. */ struct oct_iq_stats { … }; #define OCT_IQ_STATS_SIZE … /** The instruction (input) queue. * The input queue is used to post raw (instruction) mode data or packet * data to Octeon device from the host. Each input queue (upto 4) for * a Octeon device has one such structure to represent it. */ struct octeon_instr_queue { … }; /*---------------------- INSTRUCTION FORMAT ----------------------------*/ /** 32-byte instruction format. * Format of instruction for a 32-byte mode input queue. */ struct octeon_instr_32B { … }; #define OCT_32B_INSTR_SIZE … /** 64-byte instruction format. * Format of instruction for a 64-byte mode input queue. */ struct octeon_instr2_64B { … }; struct octeon_instr3_64B { … }; octeon_instr_64B; #define OCT_64B_INSTR_SIZE … /** The size of each buffer in soft command buffer pool */ #define SOFT_COMMAND_BUFFER_SIZE … struct octeon_soft_command { … }; /* max timeout (in milli sec) for soft request */ #define LIO_SC_MAX_TMO_MS … /** Maximum number of buffers to allocate into soft command buffer pool */ #define MAX_SOFT_COMMAND_BUFFERS … /** Head of a soft command buffer pool. */ struct octeon_sc_buffer_pool { … }; #define INCR_INSTRQUEUE_PKT_COUNT(octeon_dev_ptr, iq_no, field, count) … int octeon_setup_sc_buffer_pool(struct octeon_device *oct); int octeon_free_sc_done_list(struct octeon_device *oct); int octeon_free_sc_zombie_list(struct octeon_device *oct); int octeon_free_sc_buffer_pool(struct octeon_device *oct); struct octeon_soft_command * octeon_alloc_soft_command(struct octeon_device *oct, u32 datasize, u32 rdatasize, u32 ctxsize); void octeon_free_soft_command(struct octeon_device *oct, struct octeon_soft_command *sc); /** * octeon_init_instr_queue() * @param octeon_dev - pointer to the octeon device structure. * @param txpciq - queue to be initialized (0 <= q_no <= 3). * * Called at driver init time for each input queue. iq_conf has the * configuration parameters for the queue. * * @return Success: 0 Failure: 1 */ int octeon_init_instr_queue(struct octeon_device *octeon_dev, union oct_txpciq txpciq, u32 num_descs); /** * octeon_delete_instr_queue() * @param octeon_dev - pointer to the octeon device structure. * @param iq_no - queue to be deleted (0 <= q_no <= 3). * * Called at driver unload time for each input queue. Deletes all * allocated resources for the input queue. * * @return Success: 0 Failure: 1 */ int octeon_delete_instr_queue(struct octeon_device *octeon_dev, u32 iq_no); int lio_wait_for_instr_fetch(struct octeon_device *oct); void octeon_ring_doorbell_locked(struct octeon_device *oct, u32 iq_no); int octeon_register_reqtype_free_fn(struct octeon_device *oct, int reqtype, void (*fn)(void *)); int lio_process_iq_request_list(struct octeon_device *oct, struct octeon_instr_queue *iq, u32 napi_budget); int octeon_send_command(struct octeon_device *oct, u32 iq_no, u32 force_db, void *cmd, void *buf, u32 datasize, u32 reqtype); void octeon_prepare_soft_command(struct octeon_device *oct, struct octeon_soft_command *sc, u8 opcode, u8 subcode, u32 irh_ossp, u64 ossp0, u64 ossp1); int octeon_send_soft_command(struct octeon_device *oct, struct octeon_soft_command *sc); int octeon_setup_iq(struct octeon_device *oct, int ifidx, int q_index, union oct_txpciq iq_no, u32 num_descs, void *app_ctx); int octeon_flush_iq(struct octeon_device *oct, struct octeon_instr_queue *iq, u32 napi_budget); #endif /* __OCTEON_IQ_H__ */