18c2ecf20Sopenharmony_ci/********************************************************************** 28c2ecf20Sopenharmony_ci * Author: Cavium, Inc. 38c2ecf20Sopenharmony_ci * 48c2ecf20Sopenharmony_ci * Contact: support@cavium.com 58c2ecf20Sopenharmony_ci * Please include "LiquidIO" in the subject. 68c2ecf20Sopenharmony_ci * 78c2ecf20Sopenharmony_ci * Copyright (c) 2003-2016 Cavium, Inc. 88c2ecf20Sopenharmony_ci * 98c2ecf20Sopenharmony_ci * This file is free software; you can redistribute it and/or modify 108c2ecf20Sopenharmony_ci * it under the terms of the GNU General Public License, Version 2, as 118c2ecf20Sopenharmony_ci * published by the Free Software Foundation. 128c2ecf20Sopenharmony_ci * 138c2ecf20Sopenharmony_ci * This file is distributed in the hope that it will be useful, but 148c2ecf20Sopenharmony_ci * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty 158c2ecf20Sopenharmony_ci * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or 168c2ecf20Sopenharmony_ci * NONINFRINGEMENT. See the GNU General Public License for more details. 178c2ecf20Sopenharmony_ci ***********************************************************************/ 188c2ecf20Sopenharmony_ci/*! \file octeon_iq.h 198c2ecf20Sopenharmony_ci * \brief Host Driver: Implementation of Octeon input queues. "Input" is 208c2ecf20Sopenharmony_ci * with respect to the Octeon device on the NIC. From this driver's 218c2ecf20Sopenharmony_ci * point of view they are egress queues. 228c2ecf20Sopenharmony_ci */ 238c2ecf20Sopenharmony_ci 248c2ecf20Sopenharmony_ci#ifndef __OCTEON_IQ_H__ 258c2ecf20Sopenharmony_ci#define __OCTEON_IQ_H__ 268c2ecf20Sopenharmony_ci 278c2ecf20Sopenharmony_ci#define IQ_STATUS_RUNNING 1 288c2ecf20Sopenharmony_ci 298c2ecf20Sopenharmony_ci#define IQ_SEND_OK 0 308c2ecf20Sopenharmony_ci#define IQ_SEND_STOP 1 318c2ecf20Sopenharmony_ci#define IQ_SEND_FAILED -1 328c2ecf20Sopenharmony_ci 338c2ecf20Sopenharmony_ci/*------------------------- INSTRUCTION QUEUE --------------------------*/ 348c2ecf20Sopenharmony_ci 358c2ecf20Sopenharmony_ci/* \cond */ 368c2ecf20Sopenharmony_ci 378c2ecf20Sopenharmony_ci#define REQTYPE_NONE 0 388c2ecf20Sopenharmony_ci#define REQTYPE_NORESP_NET 1 398c2ecf20Sopenharmony_ci#define REQTYPE_NORESP_NET_SG 2 408c2ecf20Sopenharmony_ci#define REQTYPE_RESP_NET 3 418c2ecf20Sopenharmony_ci#define REQTYPE_RESP_NET_SG 4 428c2ecf20Sopenharmony_ci#define REQTYPE_SOFT_COMMAND 5 438c2ecf20Sopenharmony_ci#define REQTYPE_LAST 5 448c2ecf20Sopenharmony_ci 458c2ecf20Sopenharmony_cistruct octeon_request_list { 468c2ecf20Sopenharmony_ci u32 reqtype; 478c2ecf20Sopenharmony_ci void *buf; 488c2ecf20Sopenharmony_ci}; 498c2ecf20Sopenharmony_ci 508c2ecf20Sopenharmony_ci/* \endcond */ 518c2ecf20Sopenharmony_ci 528c2ecf20Sopenharmony_ci/** Input Queue statistics. Each input queue has four stats fields. */ 538c2ecf20Sopenharmony_cistruct oct_iq_stats { 548c2ecf20Sopenharmony_ci u64 instr_posted; /**< Instructions posted to this queue. */ 558c2ecf20Sopenharmony_ci u64 instr_processed; /**< Instructions processed in this queue. */ 568c2ecf20Sopenharmony_ci u64 instr_dropped; /**< Instructions that could not be processed */ 578c2ecf20Sopenharmony_ci u64 bytes_sent; /**< Bytes sent through this queue. */ 588c2ecf20Sopenharmony_ci u64 sgentry_sent;/**< Gather entries sent through this queue. */ 598c2ecf20Sopenharmony_ci u64 tx_done;/**< Num of packets sent to network. */ 608c2ecf20Sopenharmony_ci u64 tx_iq_busy;/**< Numof times this iq was found to be full. */ 618c2ecf20Sopenharmony_ci u64 tx_dropped;/**< Numof pkts dropped dueto xmitpath errors. */ 628c2ecf20Sopenharmony_ci u64 tx_tot_bytes;/**< Total count of bytes sento to network. */ 638c2ecf20Sopenharmony_ci u64 tx_gso; /* count of tso */ 648c2ecf20Sopenharmony_ci u64 tx_vxlan; /* tunnel */ 658c2ecf20Sopenharmony_ci u64 tx_dmamap_fail; /* Number of times dma mapping failed */ 668c2ecf20Sopenharmony_ci u64 tx_restart; /* Number of times this queue restarted */ 678c2ecf20Sopenharmony_ci}; 688c2ecf20Sopenharmony_ci 698c2ecf20Sopenharmony_ci#define OCT_IQ_STATS_SIZE (sizeof(struct oct_iq_stats)) 708c2ecf20Sopenharmony_ci 718c2ecf20Sopenharmony_ci/** The instruction (input) queue. 728c2ecf20Sopenharmony_ci * The input queue is used to post raw (instruction) mode data or packet 738c2ecf20Sopenharmony_ci * data to Octeon device from the host. Each input queue (upto 4) for 748c2ecf20Sopenharmony_ci * a Octeon device has one such structure to represent it. 758c2ecf20Sopenharmony_ci */ 768c2ecf20Sopenharmony_cistruct octeon_instr_queue { 778c2ecf20Sopenharmony_ci struct octeon_device *oct_dev; 788c2ecf20Sopenharmony_ci 798c2ecf20Sopenharmony_ci /** A spinlock to protect access to the input ring. */ 808c2ecf20Sopenharmony_ci spinlock_t lock; 818c2ecf20Sopenharmony_ci 828c2ecf20Sopenharmony_ci /** A spinlock to protect while posting on the ring. */ 838c2ecf20Sopenharmony_ci spinlock_t post_lock; 848c2ecf20Sopenharmony_ci 858c2ecf20Sopenharmony_ci /** This flag indicates if the queue can be used for soft commands. 868c2ecf20Sopenharmony_ci * If this flag is set, post_lock must be acquired before posting 878c2ecf20Sopenharmony_ci * a command to the queue. 888c2ecf20Sopenharmony_ci * If this flag is clear, post_lock is invalid for the queue. 898c2ecf20Sopenharmony_ci * All control commands (soft commands) will go through only Queue 0 908c2ecf20Sopenharmony_ci * (control and data queue). So only queue-0 needs post_lock, 918c2ecf20Sopenharmony_ci * other queues are only data queues and does not need post_lock 928c2ecf20Sopenharmony_ci */ 938c2ecf20Sopenharmony_ci bool allow_soft_cmds; 948c2ecf20Sopenharmony_ci 958c2ecf20Sopenharmony_ci u32 pkt_in_done; 968c2ecf20Sopenharmony_ci 978c2ecf20Sopenharmony_ci u32 pkts_processed; 988c2ecf20Sopenharmony_ci 998c2ecf20Sopenharmony_ci /** A spinlock to protect access to the input ring.*/ 1008c2ecf20Sopenharmony_ci spinlock_t iq_flush_running_lock; 1018c2ecf20Sopenharmony_ci 1028c2ecf20Sopenharmony_ci /** Flag that indicates if the queue uses 64 byte commands. */ 1038c2ecf20Sopenharmony_ci u32 iqcmd_64B:1; 1048c2ecf20Sopenharmony_ci 1058c2ecf20Sopenharmony_ci /** Queue info. */ 1068c2ecf20Sopenharmony_ci union oct_txpciq txpciq; 1078c2ecf20Sopenharmony_ci 1088c2ecf20Sopenharmony_ci u32 rsvd:17; 1098c2ecf20Sopenharmony_ci 1108c2ecf20Sopenharmony_ci /* Controls whether extra flushing of IQ is done on Tx */ 1118c2ecf20Sopenharmony_ci u32 do_auto_flush:1; 1128c2ecf20Sopenharmony_ci 1138c2ecf20Sopenharmony_ci u32 status:8; 1148c2ecf20Sopenharmony_ci 1158c2ecf20Sopenharmony_ci /** Maximum no. of instructions in this queue. */ 1168c2ecf20Sopenharmony_ci u32 max_count; 1178c2ecf20Sopenharmony_ci 1188c2ecf20Sopenharmony_ci /** Index in input ring where the driver should write the next packet */ 1198c2ecf20Sopenharmony_ci u32 host_write_index; 1208c2ecf20Sopenharmony_ci 1218c2ecf20Sopenharmony_ci /** Index in input ring where Octeon is expected to read the next 1228c2ecf20Sopenharmony_ci * packet. 1238c2ecf20Sopenharmony_ci */ 1248c2ecf20Sopenharmony_ci u32 octeon_read_index; 1258c2ecf20Sopenharmony_ci 1268c2ecf20Sopenharmony_ci /** This index aids in finding the window in the queue where Octeon 1278c2ecf20Sopenharmony_ci * has read the commands. 1288c2ecf20Sopenharmony_ci */ 1298c2ecf20Sopenharmony_ci u32 flush_index; 1308c2ecf20Sopenharmony_ci 1318c2ecf20Sopenharmony_ci /** This field keeps track of the instructions pending in this queue. */ 1328c2ecf20Sopenharmony_ci atomic_t instr_pending; 1338c2ecf20Sopenharmony_ci 1348c2ecf20Sopenharmony_ci u32 reset_instr_cnt; 1358c2ecf20Sopenharmony_ci 1368c2ecf20Sopenharmony_ci /** Pointer to the Virtual Base addr of the input ring. */ 1378c2ecf20Sopenharmony_ci u8 *base_addr; 1388c2ecf20Sopenharmony_ci 1398c2ecf20Sopenharmony_ci struct octeon_request_list *request_list; 1408c2ecf20Sopenharmony_ci 1418c2ecf20Sopenharmony_ci /** Octeon doorbell register for the ring. */ 1428c2ecf20Sopenharmony_ci void __iomem *doorbell_reg; 1438c2ecf20Sopenharmony_ci 1448c2ecf20Sopenharmony_ci /** Octeon instruction count register for this ring. */ 1458c2ecf20Sopenharmony_ci void __iomem *inst_cnt_reg; 1468c2ecf20Sopenharmony_ci 1478c2ecf20Sopenharmony_ci /** Number of instructions pending to be posted to Octeon. */ 1488c2ecf20Sopenharmony_ci u32 fill_cnt; 1498c2ecf20Sopenharmony_ci 1508c2ecf20Sopenharmony_ci /** The max. number of instructions that can be held pending by the 1518c2ecf20Sopenharmony_ci * driver. 1528c2ecf20Sopenharmony_ci */ 1538c2ecf20Sopenharmony_ci u32 fill_threshold; 1548c2ecf20Sopenharmony_ci 1558c2ecf20Sopenharmony_ci /** The last time that the doorbell was rung. */ 1568c2ecf20Sopenharmony_ci u64 last_db_time; 1578c2ecf20Sopenharmony_ci 1588c2ecf20Sopenharmony_ci /** The doorbell timeout. If the doorbell was not rung for this time and 1598c2ecf20Sopenharmony_ci * fill_cnt is non-zero, ring the doorbell again. 1608c2ecf20Sopenharmony_ci */ 1618c2ecf20Sopenharmony_ci u32 db_timeout; 1628c2ecf20Sopenharmony_ci 1638c2ecf20Sopenharmony_ci /** Statistics for this input queue. */ 1648c2ecf20Sopenharmony_ci struct oct_iq_stats stats; 1658c2ecf20Sopenharmony_ci 1668c2ecf20Sopenharmony_ci /** DMA mapped base address of the input descriptor ring. */ 1678c2ecf20Sopenharmony_ci dma_addr_t base_addr_dma; 1688c2ecf20Sopenharmony_ci 1698c2ecf20Sopenharmony_ci /** Application context */ 1708c2ecf20Sopenharmony_ci void *app_ctx; 1718c2ecf20Sopenharmony_ci 1728c2ecf20Sopenharmony_ci /* network stack queue index */ 1738c2ecf20Sopenharmony_ci int q_index; 1748c2ecf20Sopenharmony_ci 1758c2ecf20Sopenharmony_ci /*os ifidx associated with this queue */ 1768c2ecf20Sopenharmony_ci int ifidx; 1778c2ecf20Sopenharmony_ci 1788c2ecf20Sopenharmony_ci}; 1798c2ecf20Sopenharmony_ci 1808c2ecf20Sopenharmony_ci/*---------------------- INSTRUCTION FORMAT ----------------------------*/ 1818c2ecf20Sopenharmony_ci 1828c2ecf20Sopenharmony_ci/** 32-byte instruction format. 1838c2ecf20Sopenharmony_ci * Format of instruction for a 32-byte mode input queue. 1848c2ecf20Sopenharmony_ci */ 1858c2ecf20Sopenharmony_cistruct octeon_instr_32B { 1868c2ecf20Sopenharmony_ci /** Pointer where the input data is available. */ 1878c2ecf20Sopenharmony_ci u64 dptr; 1888c2ecf20Sopenharmony_ci 1898c2ecf20Sopenharmony_ci /** Instruction Header. */ 1908c2ecf20Sopenharmony_ci u64 ih; 1918c2ecf20Sopenharmony_ci 1928c2ecf20Sopenharmony_ci /** Pointer where the response for a RAW mode packet will be written 1938c2ecf20Sopenharmony_ci * by Octeon. 1948c2ecf20Sopenharmony_ci */ 1958c2ecf20Sopenharmony_ci u64 rptr; 1968c2ecf20Sopenharmony_ci 1978c2ecf20Sopenharmony_ci /** Input Request Header. Additional info about the input. */ 1988c2ecf20Sopenharmony_ci u64 irh; 1998c2ecf20Sopenharmony_ci 2008c2ecf20Sopenharmony_ci}; 2018c2ecf20Sopenharmony_ci 2028c2ecf20Sopenharmony_ci#define OCT_32B_INSTR_SIZE (sizeof(struct octeon_instr_32B)) 2038c2ecf20Sopenharmony_ci 2048c2ecf20Sopenharmony_ci/** 64-byte instruction format. 2058c2ecf20Sopenharmony_ci * Format of instruction for a 64-byte mode input queue. 2068c2ecf20Sopenharmony_ci */ 2078c2ecf20Sopenharmony_cistruct octeon_instr2_64B { 2088c2ecf20Sopenharmony_ci /** Pointer where the input data is available. */ 2098c2ecf20Sopenharmony_ci u64 dptr; 2108c2ecf20Sopenharmony_ci 2118c2ecf20Sopenharmony_ci /** Instruction Header. */ 2128c2ecf20Sopenharmony_ci u64 ih2; 2138c2ecf20Sopenharmony_ci 2148c2ecf20Sopenharmony_ci /** Input Request Header. */ 2158c2ecf20Sopenharmony_ci u64 irh; 2168c2ecf20Sopenharmony_ci 2178c2ecf20Sopenharmony_ci /** opcode/subcode specific parameters */ 2188c2ecf20Sopenharmony_ci u64 ossp[2]; 2198c2ecf20Sopenharmony_ci 2208c2ecf20Sopenharmony_ci /** Return Data Parameters */ 2218c2ecf20Sopenharmony_ci u64 rdp; 2228c2ecf20Sopenharmony_ci 2238c2ecf20Sopenharmony_ci /** Pointer where the response for a RAW mode packet will be written 2248c2ecf20Sopenharmony_ci * by Octeon. 2258c2ecf20Sopenharmony_ci */ 2268c2ecf20Sopenharmony_ci u64 rptr; 2278c2ecf20Sopenharmony_ci 2288c2ecf20Sopenharmony_ci u64 reserved; 2298c2ecf20Sopenharmony_ci}; 2308c2ecf20Sopenharmony_ci 2318c2ecf20Sopenharmony_cistruct octeon_instr3_64B { 2328c2ecf20Sopenharmony_ci /** Pointer where the input data is available. */ 2338c2ecf20Sopenharmony_ci u64 dptr; 2348c2ecf20Sopenharmony_ci 2358c2ecf20Sopenharmony_ci /** Instruction Header. */ 2368c2ecf20Sopenharmony_ci u64 ih3; 2378c2ecf20Sopenharmony_ci 2388c2ecf20Sopenharmony_ci /** Instruction Header. */ 2398c2ecf20Sopenharmony_ci u64 pki_ih3; 2408c2ecf20Sopenharmony_ci 2418c2ecf20Sopenharmony_ci /** Input Request Header. */ 2428c2ecf20Sopenharmony_ci u64 irh; 2438c2ecf20Sopenharmony_ci 2448c2ecf20Sopenharmony_ci /** opcode/subcode specific parameters */ 2458c2ecf20Sopenharmony_ci u64 ossp[2]; 2468c2ecf20Sopenharmony_ci 2478c2ecf20Sopenharmony_ci /** Return Data Parameters */ 2488c2ecf20Sopenharmony_ci u64 rdp; 2498c2ecf20Sopenharmony_ci 2508c2ecf20Sopenharmony_ci /** Pointer where the response for a RAW mode packet will be written 2518c2ecf20Sopenharmony_ci * by Octeon. 2528c2ecf20Sopenharmony_ci */ 2538c2ecf20Sopenharmony_ci u64 rptr; 2548c2ecf20Sopenharmony_ci 2558c2ecf20Sopenharmony_ci}; 2568c2ecf20Sopenharmony_ci 2578c2ecf20Sopenharmony_ciunion octeon_instr_64B { 2588c2ecf20Sopenharmony_ci struct octeon_instr2_64B cmd2; 2598c2ecf20Sopenharmony_ci struct octeon_instr3_64B cmd3; 2608c2ecf20Sopenharmony_ci}; 2618c2ecf20Sopenharmony_ci 2628c2ecf20Sopenharmony_ci#define OCT_64B_INSTR_SIZE (sizeof(union octeon_instr_64B)) 2638c2ecf20Sopenharmony_ci 2648c2ecf20Sopenharmony_ci/** The size of each buffer in soft command buffer pool 2658c2ecf20Sopenharmony_ci */ 2668c2ecf20Sopenharmony_ci#define SOFT_COMMAND_BUFFER_SIZE 2048 2678c2ecf20Sopenharmony_ci 2688c2ecf20Sopenharmony_cistruct octeon_soft_command { 2698c2ecf20Sopenharmony_ci /** Soft command buffer info. */ 2708c2ecf20Sopenharmony_ci struct list_head node; 2718c2ecf20Sopenharmony_ci u64 dma_addr; 2728c2ecf20Sopenharmony_ci u32 size; 2738c2ecf20Sopenharmony_ci 2748c2ecf20Sopenharmony_ci /** Command and return status */ 2758c2ecf20Sopenharmony_ci union octeon_instr_64B cmd; 2768c2ecf20Sopenharmony_ci 2778c2ecf20Sopenharmony_ci#define COMPLETION_WORD_INIT 0xffffffffffffffffULL 2788c2ecf20Sopenharmony_ci u64 *status_word; 2798c2ecf20Sopenharmony_ci 2808c2ecf20Sopenharmony_ci /** Data buffer info */ 2818c2ecf20Sopenharmony_ci void *virtdptr; 2828c2ecf20Sopenharmony_ci u64 dmadptr; 2838c2ecf20Sopenharmony_ci u32 datasize; 2848c2ecf20Sopenharmony_ci 2858c2ecf20Sopenharmony_ci /** Return buffer info */ 2868c2ecf20Sopenharmony_ci void *virtrptr; 2878c2ecf20Sopenharmony_ci u64 dmarptr; 2888c2ecf20Sopenharmony_ci u32 rdatasize; 2898c2ecf20Sopenharmony_ci 2908c2ecf20Sopenharmony_ci /** Context buffer info */ 2918c2ecf20Sopenharmony_ci void *ctxptr; 2928c2ecf20Sopenharmony_ci u32 ctxsize; 2938c2ecf20Sopenharmony_ci 2948c2ecf20Sopenharmony_ci /** Time out and callback */ 2958c2ecf20Sopenharmony_ci size_t expiry_time; 2968c2ecf20Sopenharmony_ci u32 iq_no; 2978c2ecf20Sopenharmony_ci void (*callback)(struct octeon_device *, u32, void *); 2988c2ecf20Sopenharmony_ci void *callback_arg; 2998c2ecf20Sopenharmony_ci 3008c2ecf20Sopenharmony_ci int caller_is_done; 3018c2ecf20Sopenharmony_ci u32 sc_status; 3028c2ecf20Sopenharmony_ci struct completion complete; 3038c2ecf20Sopenharmony_ci}; 3048c2ecf20Sopenharmony_ci 3058c2ecf20Sopenharmony_ci/* max timeout (in milli sec) for soft request */ 3068c2ecf20Sopenharmony_ci#define LIO_SC_MAX_TMO_MS 60000 3078c2ecf20Sopenharmony_ci 3088c2ecf20Sopenharmony_ci/** Maximum number of buffers to allocate into soft command buffer pool 3098c2ecf20Sopenharmony_ci */ 3108c2ecf20Sopenharmony_ci#define MAX_SOFT_COMMAND_BUFFERS 256 3118c2ecf20Sopenharmony_ci 3128c2ecf20Sopenharmony_ci/** Head of a soft command buffer pool. 3138c2ecf20Sopenharmony_ci */ 3148c2ecf20Sopenharmony_cistruct octeon_sc_buffer_pool { 3158c2ecf20Sopenharmony_ci /** List structure to add delete pending entries to */ 3168c2ecf20Sopenharmony_ci struct list_head head; 3178c2ecf20Sopenharmony_ci 3188c2ecf20Sopenharmony_ci /** A lock for this response list */ 3198c2ecf20Sopenharmony_ci spinlock_t lock; 3208c2ecf20Sopenharmony_ci 3218c2ecf20Sopenharmony_ci atomic_t alloc_buf_count; 3228c2ecf20Sopenharmony_ci}; 3238c2ecf20Sopenharmony_ci 3248c2ecf20Sopenharmony_ci#define INCR_INSTRQUEUE_PKT_COUNT(octeon_dev_ptr, iq_no, field, count) \ 3258c2ecf20Sopenharmony_ci (((octeon_dev_ptr)->instr_queue[iq_no]->stats.field) += count) 3268c2ecf20Sopenharmony_ci 3278c2ecf20Sopenharmony_ciint octeon_setup_sc_buffer_pool(struct octeon_device *oct); 3288c2ecf20Sopenharmony_ciint octeon_free_sc_done_list(struct octeon_device *oct); 3298c2ecf20Sopenharmony_ciint octeon_free_sc_zombie_list(struct octeon_device *oct); 3308c2ecf20Sopenharmony_ciint octeon_free_sc_buffer_pool(struct octeon_device *oct); 3318c2ecf20Sopenharmony_cistruct octeon_soft_command * 3328c2ecf20Sopenharmony_ci octeon_alloc_soft_command(struct octeon_device *oct, 3338c2ecf20Sopenharmony_ci u32 datasize, u32 rdatasize, 3348c2ecf20Sopenharmony_ci u32 ctxsize); 3358c2ecf20Sopenharmony_civoid octeon_free_soft_command(struct octeon_device *oct, 3368c2ecf20Sopenharmony_ci struct octeon_soft_command *sc); 3378c2ecf20Sopenharmony_ci 3388c2ecf20Sopenharmony_ci/** 3398c2ecf20Sopenharmony_ci * octeon_init_instr_queue() 3408c2ecf20Sopenharmony_ci * @param octeon_dev - pointer to the octeon device structure. 3418c2ecf20Sopenharmony_ci * @param txpciq - queue to be initialized (0 <= q_no <= 3). 3428c2ecf20Sopenharmony_ci * 3438c2ecf20Sopenharmony_ci * Called at driver init time for each input queue. iq_conf has the 3448c2ecf20Sopenharmony_ci * configuration parameters for the queue. 3458c2ecf20Sopenharmony_ci * 3468c2ecf20Sopenharmony_ci * @return Success: 0 Failure: 1 3478c2ecf20Sopenharmony_ci */ 3488c2ecf20Sopenharmony_ciint octeon_init_instr_queue(struct octeon_device *octeon_dev, 3498c2ecf20Sopenharmony_ci union oct_txpciq txpciq, 3508c2ecf20Sopenharmony_ci u32 num_descs); 3518c2ecf20Sopenharmony_ci 3528c2ecf20Sopenharmony_ci/** 3538c2ecf20Sopenharmony_ci * octeon_delete_instr_queue() 3548c2ecf20Sopenharmony_ci * @param octeon_dev - pointer to the octeon device structure. 3558c2ecf20Sopenharmony_ci * @param iq_no - queue to be deleted (0 <= q_no <= 3). 3568c2ecf20Sopenharmony_ci * 3578c2ecf20Sopenharmony_ci * Called at driver unload time for each input queue. Deletes all 3588c2ecf20Sopenharmony_ci * allocated resources for the input queue. 3598c2ecf20Sopenharmony_ci * 3608c2ecf20Sopenharmony_ci * @return Success: 0 Failure: 1 3618c2ecf20Sopenharmony_ci */ 3628c2ecf20Sopenharmony_ciint octeon_delete_instr_queue(struct octeon_device *octeon_dev, u32 iq_no); 3638c2ecf20Sopenharmony_ci 3648c2ecf20Sopenharmony_ciint lio_wait_for_instr_fetch(struct octeon_device *oct); 3658c2ecf20Sopenharmony_ci 3668c2ecf20Sopenharmony_civoid 3678c2ecf20Sopenharmony_ciocteon_ring_doorbell_locked(struct octeon_device *oct, u32 iq_no); 3688c2ecf20Sopenharmony_ci 3698c2ecf20Sopenharmony_ciint 3708c2ecf20Sopenharmony_ciocteon_register_reqtype_free_fn(struct octeon_device *oct, int reqtype, 3718c2ecf20Sopenharmony_ci void (*fn)(void *)); 3728c2ecf20Sopenharmony_ci 3738c2ecf20Sopenharmony_ciint 3748c2ecf20Sopenharmony_cilio_process_iq_request_list(struct octeon_device *oct, 3758c2ecf20Sopenharmony_ci struct octeon_instr_queue *iq, u32 napi_budget); 3768c2ecf20Sopenharmony_ci 3778c2ecf20Sopenharmony_ciint octeon_send_command(struct octeon_device *oct, u32 iq_no, 3788c2ecf20Sopenharmony_ci u32 force_db, void *cmd, void *buf, 3798c2ecf20Sopenharmony_ci u32 datasize, u32 reqtype); 3808c2ecf20Sopenharmony_ci 3818c2ecf20Sopenharmony_civoid octeon_dump_soft_command(struct octeon_device *oct, 3828c2ecf20Sopenharmony_ci struct octeon_soft_command *sc); 3838c2ecf20Sopenharmony_ci 3848c2ecf20Sopenharmony_civoid octeon_prepare_soft_command(struct octeon_device *oct, 3858c2ecf20Sopenharmony_ci struct octeon_soft_command *sc, 3868c2ecf20Sopenharmony_ci u8 opcode, u8 subcode, 3878c2ecf20Sopenharmony_ci u32 irh_ossp, u64 ossp0, 3888c2ecf20Sopenharmony_ci u64 ossp1); 3898c2ecf20Sopenharmony_ci 3908c2ecf20Sopenharmony_ciint octeon_send_soft_command(struct octeon_device *oct, 3918c2ecf20Sopenharmony_ci struct octeon_soft_command *sc); 3928c2ecf20Sopenharmony_ci 3938c2ecf20Sopenharmony_ciint octeon_setup_iq(struct octeon_device *oct, int ifidx, 3948c2ecf20Sopenharmony_ci int q_index, union oct_txpciq iq_no, u32 num_descs, 3958c2ecf20Sopenharmony_ci void *app_ctx); 3968c2ecf20Sopenharmony_ciint 3978c2ecf20Sopenharmony_ciocteon_flush_iq(struct octeon_device *oct, struct octeon_instr_queue *iq, 3988c2ecf20Sopenharmony_ci u32 napi_budget); 3998c2ecf20Sopenharmony_ci#endif /* __OCTEON_IQ_H__ */ 400