1f21fb3edSRaghu Vatsavayi /********************************************************************** 2f21fb3edSRaghu Vatsavayi * Author: Cavium, Inc. 3f21fb3edSRaghu Vatsavayi * 4f21fb3edSRaghu Vatsavayi * Contact: support@cavium.com 5f21fb3edSRaghu Vatsavayi * Please include "LiquidIO" in the subject. 6f21fb3edSRaghu Vatsavayi * 750579d3dSRaghu Vatsavayi * Copyright (c) 2003-2016 Cavium, Inc. 8f21fb3edSRaghu Vatsavayi * 9f21fb3edSRaghu Vatsavayi * This file is free software; you can redistribute it and/or modify 10f21fb3edSRaghu Vatsavayi * it under the terms of the GNU General Public License, Version 2, as 11f21fb3edSRaghu Vatsavayi * published by the Free Software Foundation. 12f21fb3edSRaghu Vatsavayi * 13f21fb3edSRaghu Vatsavayi * This file is distributed in the hope that it will be useful, but 14f21fb3edSRaghu Vatsavayi * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty 15f21fb3edSRaghu Vatsavayi * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or 1650579d3dSRaghu Vatsavayi * NONINFRINGEMENT. See the GNU General Public License for more details. 1750579d3dSRaghu Vatsavayi ***********************************************************************/ 18f21fb3edSRaghu Vatsavayi /*! \file octeon_iq.h 19f21fb3edSRaghu Vatsavayi * \brief Host Driver: Implementation of Octeon input queues. "Input" is 20f21fb3edSRaghu Vatsavayi * with respect to the Octeon device on the NIC. From this driver's 21f21fb3edSRaghu Vatsavayi * point of view they are egress queues. 22f21fb3edSRaghu Vatsavayi */ 23f21fb3edSRaghu Vatsavayi 24f21fb3edSRaghu Vatsavayi #ifndef __OCTEON_IQ_H__ 25f21fb3edSRaghu Vatsavayi #define __OCTEON_IQ_H__ 26f21fb3edSRaghu Vatsavayi 27f21fb3edSRaghu Vatsavayi #define IQ_STATUS_RUNNING 1 28f21fb3edSRaghu Vatsavayi 29f21fb3edSRaghu Vatsavayi #define IQ_SEND_OK 0 30f21fb3edSRaghu Vatsavayi #define IQ_SEND_STOP 1 31f21fb3edSRaghu Vatsavayi #define IQ_SEND_FAILED -1 32f21fb3edSRaghu Vatsavayi 33f21fb3edSRaghu Vatsavayi /*------------------------- INSTRUCTION QUEUE --------------------------*/ 34f21fb3edSRaghu Vatsavayi 35f21fb3edSRaghu Vatsavayi /* \cond */ 36f21fb3edSRaghu Vatsavayi 37f21fb3edSRaghu Vatsavayi #define REQTYPE_NONE 0 38f21fb3edSRaghu Vatsavayi #define REQTYPE_NORESP_NET 1 39f21fb3edSRaghu Vatsavayi #define REQTYPE_NORESP_NET_SG 2 40f21fb3edSRaghu Vatsavayi #define REQTYPE_RESP_NET 3 41f21fb3edSRaghu Vatsavayi #define REQTYPE_RESP_NET_SG 4 42f21fb3edSRaghu Vatsavayi #define REQTYPE_SOFT_COMMAND 5 43f21fb3edSRaghu Vatsavayi #define REQTYPE_LAST 5 44f21fb3edSRaghu Vatsavayi 45f21fb3edSRaghu Vatsavayi struct octeon_request_list { 46f21fb3edSRaghu Vatsavayi u32 reqtype; 47f21fb3edSRaghu Vatsavayi void *buf; 48f21fb3edSRaghu Vatsavayi }; 49f21fb3edSRaghu Vatsavayi 50f21fb3edSRaghu Vatsavayi /* \endcond */ 51f21fb3edSRaghu Vatsavayi 52f21fb3edSRaghu Vatsavayi /** Input Queue statistics. Each input queue has four stats fields. */ 53f21fb3edSRaghu Vatsavayi struct oct_iq_stats { 54f21fb3edSRaghu Vatsavayi u64 instr_posted; /**< Instructions posted to this queue. */ 55f21fb3edSRaghu Vatsavayi u64 instr_processed; /**< Instructions processed in this queue. */ 56f21fb3edSRaghu Vatsavayi u64 instr_dropped; /**< Instructions that could not be processed */ 57f21fb3edSRaghu Vatsavayi u64 bytes_sent; /**< Bytes sent through this queue. */ 58f21fb3edSRaghu Vatsavayi u64 sgentry_sent;/**< Gather entries sent through this queue. */ 59f21fb3edSRaghu Vatsavayi u64 tx_done;/**< Num of packets sent to network. */ 60f21fb3edSRaghu Vatsavayi u64 tx_iq_busy;/**< Numof times this iq was found to be full. */ 61f21fb3edSRaghu Vatsavayi u64 tx_dropped;/**< Numof pkts dropped dueto xmitpath errors. */ 62f21fb3edSRaghu Vatsavayi u64 tx_tot_bytes;/**< Total count of bytes sento to network. */ 631f164717SRaghu Vatsavayi u64 tx_gso; /* count of tso */ 6401fb237aSRaghu Vatsavayi u64 tx_vxlan; /* tunnel */ 65897ddc24SIntiyaz Basha u64 tx_dmamap_fail; /* Number of times dma mapping failed */ 66897ddc24SIntiyaz Basha u64 tx_restart; /* Number of times this queue restarted */ 67f21fb3edSRaghu Vatsavayi }; 68f21fb3edSRaghu Vatsavayi 69f21fb3edSRaghu Vatsavayi #define OCT_IQ_STATS_SIZE (sizeof(struct oct_iq_stats)) 70f21fb3edSRaghu Vatsavayi 71f21fb3edSRaghu Vatsavayi /** The instruction (input) queue. 72f21fb3edSRaghu Vatsavayi * The input queue is used to post raw (instruction) mode data or packet 73f21fb3edSRaghu Vatsavayi * data to Octeon device from the host. Each input queue (upto 4) for 74f21fb3edSRaghu Vatsavayi * a Octeon device has one such structure to represent it. 75f21fb3edSRaghu Vatsavayi */ 76f21fb3edSRaghu Vatsavayi struct octeon_instr_queue { 776a885b60SRaghu Vatsavayi struct octeon_device *oct_dev; 786a885b60SRaghu Vatsavayi 79f21fb3edSRaghu Vatsavayi /** A spinlock to protect access to the input ring. */ 80f21fb3edSRaghu Vatsavayi spinlock_t lock; 81f21fb3edSRaghu Vatsavayi 829a96bde4SRaghu Vatsavayi /** A spinlock to protect while posting on the ring. */ 839a96bde4SRaghu Vatsavayi spinlock_t post_lock; 849a96bde4SRaghu Vatsavayi 857395a884SIntiyaz Basha /** This flag indicates if the queue can be used for soft commands. 867395a884SIntiyaz Basha * If this flag is set, post_lock must be acquired before posting 877395a884SIntiyaz Basha * a command to the queue. 887395a884SIntiyaz Basha * If this flag is clear, post_lock is invalid for the queue. 897395a884SIntiyaz Basha * All control commands (soft commands) will go through only Queue 0 907395a884SIntiyaz Basha * (control and data queue). So only queue-0 needs post_lock, 917395a884SIntiyaz Basha * other queues are only data queues and does not need post_lock 927395a884SIntiyaz Basha */ 937395a884SIntiyaz Basha bool allow_soft_cmds; 947395a884SIntiyaz Basha 95cd8b1eb4SRaghu Vatsavayi u32 pkt_in_done; 96cd8b1eb4SRaghu Vatsavayi 97b943f17eSRick Farrington u32 pkts_processed; 98b943f17eSRick Farrington 999a96bde4SRaghu Vatsavayi /** A spinlock to protect access to the input ring.*/ 1009a96bde4SRaghu Vatsavayi spinlock_t iq_flush_running_lock; 1019a96bde4SRaghu Vatsavayi 102f21fb3edSRaghu Vatsavayi /** Flag that indicates if the queue uses 64 byte commands. */ 103f21fb3edSRaghu Vatsavayi u32 iqcmd_64B:1; 104f21fb3edSRaghu Vatsavayi 10526236fa9SRaghu Vatsavayi /** Queue info. */ 10626236fa9SRaghu Vatsavayi union oct_txpciq txpciq; 107f21fb3edSRaghu Vatsavayi 108f21fb3edSRaghu Vatsavayi u32 rsvd:17; 109f21fb3edSRaghu Vatsavayi 110a2c64b67SRaghu Vatsavayi /* Controls whether extra flushing of IQ is done on Tx */ 111f21fb3edSRaghu Vatsavayi u32 do_auto_flush:1; 112f21fb3edSRaghu Vatsavayi 113f21fb3edSRaghu Vatsavayi u32 status:8; 114f21fb3edSRaghu Vatsavayi 115f21fb3edSRaghu Vatsavayi /** Maximum no. of instructions in this queue. */ 116f21fb3edSRaghu Vatsavayi u32 max_count; 117f21fb3edSRaghu Vatsavayi 118f21fb3edSRaghu Vatsavayi /** Index in input ring where the driver should write the next packet */ 119f21fb3edSRaghu Vatsavayi u32 host_write_index; 120f21fb3edSRaghu Vatsavayi 121f21fb3edSRaghu Vatsavayi /** Index in input ring where Octeon is expected to read the next 122f21fb3edSRaghu Vatsavayi * packet. 123f21fb3edSRaghu Vatsavayi */ 124f21fb3edSRaghu Vatsavayi u32 octeon_read_index; 125f21fb3edSRaghu Vatsavayi 126f21fb3edSRaghu Vatsavayi /** This index aids in finding the window in the queue where Octeon 127f21fb3edSRaghu Vatsavayi * has read the commands. 128f21fb3edSRaghu Vatsavayi */ 129f21fb3edSRaghu Vatsavayi u32 flush_index; 130f21fb3edSRaghu Vatsavayi 131f21fb3edSRaghu Vatsavayi /** This field keeps track of the instructions pending in this queue. */ 132f21fb3edSRaghu Vatsavayi atomic_t instr_pending; 133f21fb3edSRaghu Vatsavayi 134f21fb3edSRaghu Vatsavayi u32 reset_instr_cnt; 135f21fb3edSRaghu Vatsavayi 136f21fb3edSRaghu Vatsavayi /** Pointer to the Virtual Base addr of the input ring. */ 137f21fb3edSRaghu Vatsavayi u8 *base_addr; 138f21fb3edSRaghu Vatsavayi 139f21fb3edSRaghu Vatsavayi struct octeon_request_list *request_list; 140f21fb3edSRaghu Vatsavayi 141f21fb3edSRaghu Vatsavayi /** Octeon doorbell register for the ring. */ 142f21fb3edSRaghu Vatsavayi void __iomem *doorbell_reg; 143f21fb3edSRaghu Vatsavayi 144f21fb3edSRaghu Vatsavayi /** Octeon instruction count register for this ring. */ 145f21fb3edSRaghu Vatsavayi void __iomem *inst_cnt_reg; 146f21fb3edSRaghu Vatsavayi 147f21fb3edSRaghu Vatsavayi /** Number of instructions pending to be posted to Octeon. */ 148f21fb3edSRaghu Vatsavayi u32 fill_cnt; 149f21fb3edSRaghu Vatsavayi 150f21fb3edSRaghu Vatsavayi /** The max. number of instructions that can be held pending by the 151f21fb3edSRaghu Vatsavayi * driver. 152f21fb3edSRaghu Vatsavayi */ 153f21fb3edSRaghu Vatsavayi u32 fill_threshold; 154f21fb3edSRaghu Vatsavayi 155f21fb3edSRaghu Vatsavayi /** The last time that the doorbell was rung. */ 156f21fb3edSRaghu Vatsavayi u64 last_db_time; 157f21fb3edSRaghu Vatsavayi 158f21fb3edSRaghu Vatsavayi /** The doorbell timeout. If the doorbell was not rung for this time and 159f21fb3edSRaghu Vatsavayi * fill_cnt is non-zero, ring the doorbell again. 160f21fb3edSRaghu Vatsavayi */ 161f21fb3edSRaghu Vatsavayi u32 db_timeout; 162f21fb3edSRaghu Vatsavayi 163f21fb3edSRaghu Vatsavayi /** Statistics for this input queue. */ 164f21fb3edSRaghu Vatsavayi struct oct_iq_stats stats; 165f21fb3edSRaghu Vatsavayi 166f21fb3edSRaghu Vatsavayi /** DMA mapped base address of the input descriptor ring. */ 167b3ca9af0SVSR Burru dma_addr_t base_addr_dma; 168f21fb3edSRaghu Vatsavayi 169f21fb3edSRaghu Vatsavayi /** Application context */ 170f21fb3edSRaghu Vatsavayi void *app_ctx; 1710cece6c5SRaghu Vatsavayi 1720cece6c5SRaghu Vatsavayi /* network stack queue index */ 1730cece6c5SRaghu Vatsavayi int q_index; 1740cece6c5SRaghu Vatsavayi 1750cece6c5SRaghu Vatsavayi /*os ifidx associated with this queue */ 1760cece6c5SRaghu Vatsavayi int ifidx; 1770cece6c5SRaghu Vatsavayi 178f21fb3edSRaghu Vatsavayi }; 179f21fb3edSRaghu Vatsavayi 180f21fb3edSRaghu Vatsavayi /*---------------------- INSTRUCTION FORMAT ----------------------------*/ 181f21fb3edSRaghu Vatsavayi 182f21fb3edSRaghu Vatsavayi /** 32-byte instruction format. 183f21fb3edSRaghu Vatsavayi * Format of instruction for a 32-byte mode input queue. 184f21fb3edSRaghu Vatsavayi */ 185f21fb3edSRaghu Vatsavayi struct octeon_instr_32B { 186f21fb3edSRaghu Vatsavayi /** Pointer where the input data is available. */ 187f21fb3edSRaghu Vatsavayi u64 dptr; 188f21fb3edSRaghu Vatsavayi 189f21fb3edSRaghu Vatsavayi /** Instruction Header. */ 190f21fb3edSRaghu Vatsavayi u64 ih; 191f21fb3edSRaghu Vatsavayi 192f21fb3edSRaghu Vatsavayi /** Pointer where the response for a RAW mode packet will be written 193f21fb3edSRaghu Vatsavayi * by Octeon. 194f21fb3edSRaghu Vatsavayi */ 195f21fb3edSRaghu Vatsavayi u64 rptr; 196f21fb3edSRaghu Vatsavayi 197f21fb3edSRaghu Vatsavayi /** Input Request Header. Additional info about the input. */ 198f21fb3edSRaghu Vatsavayi u64 irh; 199f21fb3edSRaghu Vatsavayi 200f21fb3edSRaghu Vatsavayi }; 201f21fb3edSRaghu Vatsavayi 202f21fb3edSRaghu Vatsavayi #define OCT_32B_INSTR_SIZE (sizeof(struct octeon_instr_32B)) 203f21fb3edSRaghu Vatsavayi 204f21fb3edSRaghu Vatsavayi /** 64-byte instruction format. 205f21fb3edSRaghu Vatsavayi * Format of instruction for a 64-byte mode input queue. 206f21fb3edSRaghu Vatsavayi */ 2076a885b60SRaghu Vatsavayi struct octeon_instr2_64B { 208f21fb3edSRaghu Vatsavayi /** Pointer where the input data is available. */ 209f21fb3edSRaghu Vatsavayi u64 dptr; 210f21fb3edSRaghu Vatsavayi 211f21fb3edSRaghu Vatsavayi /** Instruction Header. */ 2126a885b60SRaghu Vatsavayi u64 ih2; 213f21fb3edSRaghu Vatsavayi 214f21fb3edSRaghu Vatsavayi /** Input Request Header. */ 215f21fb3edSRaghu Vatsavayi u64 irh; 216f21fb3edSRaghu Vatsavayi 217f21fb3edSRaghu Vatsavayi /** opcode/subcode specific parameters */ 218f21fb3edSRaghu Vatsavayi u64 ossp[2]; 219f21fb3edSRaghu Vatsavayi 220f21fb3edSRaghu Vatsavayi /** Return Data Parameters */ 221f21fb3edSRaghu Vatsavayi u64 rdp; 222f21fb3edSRaghu Vatsavayi 223f21fb3edSRaghu Vatsavayi /** Pointer where the response for a RAW mode packet will be written 224f21fb3edSRaghu Vatsavayi * by Octeon. 225f21fb3edSRaghu Vatsavayi */ 226f21fb3edSRaghu Vatsavayi u64 rptr; 227f21fb3edSRaghu Vatsavayi 228f21fb3edSRaghu Vatsavayi u64 reserved; 2296a885b60SRaghu Vatsavayi }; 2306a885b60SRaghu Vatsavayi 2316a885b60SRaghu Vatsavayi struct octeon_instr3_64B { 2326a885b60SRaghu Vatsavayi /** Pointer where the input data is available. */ 2336a885b60SRaghu Vatsavayi u64 dptr; 2346a885b60SRaghu Vatsavayi 2356a885b60SRaghu Vatsavayi /** Instruction Header. */ 2366a885b60SRaghu Vatsavayi u64 ih3; 2376a885b60SRaghu Vatsavayi 2386a885b60SRaghu Vatsavayi /** Instruction Header. */ 2396a885b60SRaghu Vatsavayi u64 pki_ih3; 2406a885b60SRaghu Vatsavayi 2416a885b60SRaghu Vatsavayi /** Input Request Header. */ 2426a885b60SRaghu Vatsavayi u64 irh; 2436a885b60SRaghu Vatsavayi 2446a885b60SRaghu Vatsavayi /** opcode/subcode specific parameters */ 2456a885b60SRaghu Vatsavayi u64 ossp[2]; 2466a885b60SRaghu Vatsavayi 2476a885b60SRaghu Vatsavayi /** Return Data Parameters */ 2486a885b60SRaghu Vatsavayi u64 rdp; 2496a885b60SRaghu Vatsavayi 2506a885b60SRaghu Vatsavayi /** Pointer where the response for a RAW mode packet will be written 2516a885b60SRaghu Vatsavayi * by Octeon. 2526a885b60SRaghu Vatsavayi */ 2536a885b60SRaghu Vatsavayi u64 rptr; 254f21fb3edSRaghu Vatsavayi 255f21fb3edSRaghu Vatsavayi }; 256f21fb3edSRaghu Vatsavayi 2576a885b60SRaghu Vatsavayi union octeon_instr_64B { 2586a885b60SRaghu Vatsavayi struct octeon_instr2_64B cmd2; 2596a885b60SRaghu Vatsavayi struct octeon_instr3_64B cmd3; 2606a885b60SRaghu Vatsavayi }; 2616a885b60SRaghu Vatsavayi 2626a885b60SRaghu Vatsavayi #define OCT_64B_INSTR_SIZE (sizeof(union octeon_instr_64B)) 263f21fb3edSRaghu Vatsavayi 264f21fb3edSRaghu Vatsavayi /** The size of each buffer in soft command buffer pool 265f21fb3edSRaghu Vatsavayi */ 266a55667e6SPrasad Kanneganti #define SOFT_COMMAND_BUFFER_SIZE 2048 267f21fb3edSRaghu Vatsavayi 268f21fb3edSRaghu Vatsavayi struct octeon_soft_command { 269f21fb3edSRaghu Vatsavayi /** Soft command buffer info. */ 270f21fb3edSRaghu Vatsavayi struct list_head node; 271f21fb3edSRaghu Vatsavayi u64 dma_addr; 272f21fb3edSRaghu Vatsavayi u32 size; 273f21fb3edSRaghu Vatsavayi 274f21fb3edSRaghu Vatsavayi /** Command and return status */ 2756a885b60SRaghu Vatsavayi union octeon_instr_64B cmd; 2766a885b60SRaghu Vatsavayi 277f21fb3edSRaghu Vatsavayi #define COMPLETION_WORD_INIT 0xffffffffffffffffULL 278f21fb3edSRaghu Vatsavayi u64 *status_word; 279f21fb3edSRaghu Vatsavayi 280f21fb3edSRaghu Vatsavayi /** Data buffer info */ 281f21fb3edSRaghu Vatsavayi void *virtdptr; 282f21fb3edSRaghu Vatsavayi u64 dmadptr; 283f21fb3edSRaghu Vatsavayi u32 datasize; 284f21fb3edSRaghu Vatsavayi 285f21fb3edSRaghu Vatsavayi /** Return buffer info */ 286f21fb3edSRaghu Vatsavayi void *virtrptr; 287f21fb3edSRaghu Vatsavayi u64 dmarptr; 288f21fb3edSRaghu Vatsavayi u32 rdatasize; 289f21fb3edSRaghu Vatsavayi 290f21fb3edSRaghu Vatsavayi /** Context buffer info */ 291f21fb3edSRaghu Vatsavayi void *ctxptr; 292f21fb3edSRaghu Vatsavayi u32 ctxsize; 293f21fb3edSRaghu Vatsavayi 294f21fb3edSRaghu Vatsavayi /** Time out and callback */ 295c9aec052SFelix Manlunas size_t expiry_time; 296f21fb3edSRaghu Vatsavayi u32 iq_no; 297f21fb3edSRaghu Vatsavayi void (*callback)(struct octeon_device *, u32, void *); 298f21fb3edSRaghu Vatsavayi void *callback_arg; 299c9aec052SFelix Manlunas 300c9aec052SFelix Manlunas int caller_is_done; 301c9aec052SFelix Manlunas u32 sc_status; 302c9aec052SFelix Manlunas struct completion complete; 303f21fb3edSRaghu Vatsavayi }; 304f21fb3edSRaghu Vatsavayi 305c9aec052SFelix Manlunas /* max timeout (in milli sec) for soft request */ 306c9aec052SFelix Manlunas #define LIO_SC_MAX_TMO_MS 60000 307c9aec052SFelix Manlunas 308f21fb3edSRaghu Vatsavayi /** Maximum number of buffers to allocate into soft command buffer pool 309f21fb3edSRaghu Vatsavayi */ 31063da8404SRaghu Vatsavayi #define MAX_SOFT_COMMAND_BUFFERS 256 311f21fb3edSRaghu Vatsavayi 312f21fb3edSRaghu Vatsavayi /** Head of a soft command buffer pool. 313f21fb3edSRaghu Vatsavayi */ 314f21fb3edSRaghu Vatsavayi struct octeon_sc_buffer_pool { 315f21fb3edSRaghu Vatsavayi /** List structure to add delete pending entries to */ 316f21fb3edSRaghu Vatsavayi struct list_head head; 317f21fb3edSRaghu Vatsavayi 318f21fb3edSRaghu Vatsavayi /** A lock for this response list */ 319f21fb3edSRaghu Vatsavayi spinlock_t lock; 320f21fb3edSRaghu Vatsavayi 321f21fb3edSRaghu Vatsavayi atomic_t alloc_buf_count; 322f21fb3edSRaghu Vatsavayi }; 323f21fb3edSRaghu Vatsavayi 32497a25326SRaghu Vatsavayi #define INCR_INSTRQUEUE_PKT_COUNT(octeon_dev_ptr, iq_no, field, count) \ 32597a25326SRaghu Vatsavayi (((octeon_dev_ptr)->instr_queue[iq_no]->stats.field) += count) 32697a25326SRaghu Vatsavayi 327f21fb3edSRaghu Vatsavayi int octeon_setup_sc_buffer_pool(struct octeon_device *oct); 328c9aec052SFelix Manlunas int octeon_free_sc_done_list(struct octeon_device *oct); 329c9aec052SFelix Manlunas int octeon_free_sc_zombie_list(struct octeon_device *oct); 330f21fb3edSRaghu Vatsavayi int octeon_free_sc_buffer_pool(struct octeon_device *oct); 331f21fb3edSRaghu Vatsavayi struct octeon_soft_command * 332f21fb3edSRaghu Vatsavayi octeon_alloc_soft_command(struct octeon_device *oct, 333f21fb3edSRaghu Vatsavayi u32 datasize, u32 rdatasize, 334f21fb3edSRaghu Vatsavayi u32 ctxsize); 335f21fb3edSRaghu Vatsavayi void octeon_free_soft_command(struct octeon_device *oct, 336f21fb3edSRaghu Vatsavayi struct octeon_soft_command *sc); 337f21fb3edSRaghu Vatsavayi 338f21fb3edSRaghu Vatsavayi /** 339f21fb3edSRaghu Vatsavayi * octeon_init_instr_queue() 340f21fb3edSRaghu Vatsavayi * @param octeon_dev - pointer to the octeon device structure. 34126236fa9SRaghu Vatsavayi * @param txpciq - queue to be initialized (0 <= q_no <= 3). 342f21fb3edSRaghu Vatsavayi * 343f21fb3edSRaghu Vatsavayi * Called at driver init time for each input queue. iq_conf has the 344f21fb3edSRaghu Vatsavayi * configuration parameters for the queue. 345f21fb3edSRaghu Vatsavayi * 346f21fb3edSRaghu Vatsavayi * @return Success: 0 Failure: 1 347f21fb3edSRaghu Vatsavayi */ 34826236fa9SRaghu Vatsavayi int octeon_init_instr_queue(struct octeon_device *octeon_dev, 34926236fa9SRaghu Vatsavayi union oct_txpciq txpciq, 350f21fb3edSRaghu Vatsavayi u32 num_descs); 351f21fb3edSRaghu Vatsavayi 352f21fb3edSRaghu Vatsavayi /** 353f21fb3edSRaghu Vatsavayi * octeon_delete_instr_queue() 354f21fb3edSRaghu Vatsavayi * @param octeon_dev - pointer to the octeon device structure. 355f21fb3edSRaghu Vatsavayi * @param iq_no - queue to be deleted (0 <= q_no <= 3). 356f21fb3edSRaghu Vatsavayi * 357f21fb3edSRaghu Vatsavayi * Called at driver unload time for each input queue. Deletes all 358f21fb3edSRaghu Vatsavayi * allocated resources for the input queue. 359f21fb3edSRaghu Vatsavayi * 360f21fb3edSRaghu Vatsavayi * @return Success: 0 Failure: 1 361f21fb3edSRaghu Vatsavayi */ 362f21fb3edSRaghu Vatsavayi int octeon_delete_instr_queue(struct octeon_device *octeon_dev, u32 iq_no); 363f21fb3edSRaghu Vatsavayi 364f21fb3edSRaghu Vatsavayi int lio_wait_for_instr_fetch(struct octeon_device *oct); 365f21fb3edSRaghu Vatsavayi 366c859e21aSIntiyaz Basha void 367c859e21aSIntiyaz Basha octeon_ring_doorbell_locked(struct octeon_device *oct, u32 iq_no); 368c859e21aSIntiyaz Basha 369f21fb3edSRaghu Vatsavayi int 370f21fb3edSRaghu Vatsavayi octeon_register_reqtype_free_fn(struct octeon_device *oct, int reqtype, 371f21fb3edSRaghu Vatsavayi void (*fn)(void *)); 372f21fb3edSRaghu Vatsavayi 373f21fb3edSRaghu Vatsavayi int 374f21fb3edSRaghu Vatsavayi lio_process_iq_request_list(struct octeon_device *oct, 3759a96bde4SRaghu Vatsavayi struct octeon_instr_queue *iq, u32 napi_budget); 376f21fb3edSRaghu Vatsavayi 377f21fb3edSRaghu Vatsavayi int octeon_send_command(struct octeon_device *oct, u32 iq_no, 378f21fb3edSRaghu Vatsavayi u32 force_db, void *cmd, void *buf, 379f21fb3edSRaghu Vatsavayi u32 datasize, u32 reqtype); 380f21fb3edSRaghu Vatsavayi 381*35878618SPradeep Nalla void octeon_dump_soft_command(struct octeon_device *oct, 382*35878618SPradeep Nalla struct octeon_soft_command *sc); 383*35878618SPradeep Nalla 384f21fb3edSRaghu Vatsavayi void octeon_prepare_soft_command(struct octeon_device *oct, 385f21fb3edSRaghu Vatsavayi struct octeon_soft_command *sc, 386f21fb3edSRaghu Vatsavayi u8 opcode, u8 subcode, 387f21fb3edSRaghu Vatsavayi u32 irh_ossp, u64 ossp0, 388f21fb3edSRaghu Vatsavayi u64 ossp1); 389f21fb3edSRaghu Vatsavayi 390f21fb3edSRaghu Vatsavayi int octeon_send_soft_command(struct octeon_device *oct, 391f21fb3edSRaghu Vatsavayi struct octeon_soft_command *sc); 392f21fb3edSRaghu Vatsavayi 3930cece6c5SRaghu Vatsavayi int octeon_setup_iq(struct octeon_device *oct, int ifidx, 3940cece6c5SRaghu Vatsavayi int q_index, union oct_txpciq iq_no, u32 num_descs, 3950cece6c5SRaghu Vatsavayi void *app_ctx); 3969a96bde4SRaghu Vatsavayi int 3979a96bde4SRaghu Vatsavayi octeon_flush_iq(struct octeon_device *oct, struct octeon_instr_queue *iq, 39860889869SDerek Chickles u32 napi_budget); 399f21fb3edSRaghu Vatsavayi #endif /* __OCTEON_IQ_H__ */ 400