1 /* SPDX-License-Identifier: BSD-3-Clause 2 * 3 * Copyright(c) 2019-2021 Xilinx, Inc. 4 * Copyright(c) 2018-2019 Solarflare Communications Inc. 5 */ 6 7 #include "efx.h" 8 #include "efx_impl.h" 9 10 11 #if EFSYS_OPT_RIVERHEAD 12 13 __checkReturn efx_rc_t 14 rhead_tx_init( 15 __in efx_nic_t *enp) 16 { 17 _NOTE(ARGUNUSED(enp)) 18 /* Nothing to do here */ 19 return (0); 20 } 21 22 void 23 rhead_tx_fini( 24 __in efx_nic_t *enp) 25 { 26 _NOTE(ARGUNUSED(enp)) 27 /* Nothing to do here */ 28 } 29 30 __checkReturn efx_rc_t 31 rhead_tx_qcreate( 32 __in efx_nic_t *enp, 33 __in unsigned int index, 34 __in unsigned int label, 35 __in efsys_mem_t *esmp, 36 __in size_t ndescs, 37 __in uint32_t id, 38 __in uint16_t flags, 39 __in efx_evq_t *eep, 40 __in efx_txq_t *etp, 41 __out unsigned int *addedp) 42 { 43 efx_rc_t rc; 44 45 /* 46 * NMC manages the NMMU entries, and so buffer table IDs are 47 * ignored here 48 */ 49 _NOTE(ARGUNUSED(id)) 50 51 if ((rc = efx_mcdi_init_txq(enp, ndescs, eep->ee_index, label, index, 52 flags, esmp)) != 0) 53 goto fail1; 54 55 /* 56 * Return the initial queue index which is zero since no option 57 * descriptors are sent at start of day. 58 */ 59 *addedp = 0; 60 61 return (0); 62 63 fail1: 64 EFSYS_PROBE1(fail1, efx_rc_t, rc); 65 66 return (rc); 67 } 68 69 void 70 rhead_tx_qdestroy( 71 __in efx_txq_t *etp) 72 { 73 _NOTE(ARGUNUSED(etp)) 74 /* Nothing to do here */ 75 } 76 77 __checkReturn efx_rc_t 78 rhead_tx_qpost( 79 __in efx_txq_t *etp, 80 __in_ecount(ndescs) efx_buffer_t *eb, 81 __in unsigned int ndescs, 82 __in unsigned int completed, 83 __inout unsigned int *addedp) 84 { 85 _NOTE(ARGUNUSED(etp)) 86 _NOTE(ARGUNUSED(eb)) 87 _NOTE(ARGUNUSED(ndescs)) 88 _NOTE(ARGUNUSED(completed)) 89 _NOTE(ARGUNUSED(addedp)) 90 91 /* FIXME Implement the method for Riverhead */ 92 93 return (ENOTSUP); 94 } 95 96 void 97 rhead_tx_qpush( 98 __in efx_txq_t *etp, 99 __in unsigned int added, 100 __in unsigned int pushed) 101 { 102 _NOTE(ARGUNUSED(etp, added, pushed)) 103 104 /* FIXME Implement the method for Riverhead */ 105 EFSYS_ASSERT(B_FALSE); 106 } 107 108 __checkReturn efx_rc_t 109 rhead_tx_qpace( 110 __in efx_txq_t *etp, 111 __in unsigned int ns) 112 { 113 _NOTE(ARGUNUSED(etp)) 114 _NOTE(ARGUNUSED(ns)) 115 116 /* FIXME Implement the method for Riverhead */ 117 118 return (ENOTSUP); 119 } 120 121 __checkReturn efx_rc_t 122 rhead_tx_qflush( 123 __in efx_txq_t *etp) 124 { 125 efx_nic_t *enp = etp->et_enp; 126 efx_rc_t rc; 127 128 if ((rc = efx_mcdi_fini_txq(enp, etp->et_index)) != 0) 129 goto fail1; 130 131 return (0); 132 133 fail1: 134 /* 135 * EALREADY is not an error, but indicates that the MC has rebooted and 136 * that the TXQ has already been destroyed. Callers need to know that 137 * the TXQ flush has completed to avoid waiting until timeout for a 138 * flush done event that will not be delivered. 139 */ 140 if (rc != EALREADY) 141 EFSYS_PROBE1(fail1, efx_rc_t, rc); 142 143 return (rc); 144 } 145 146 void 147 rhead_tx_qenable( 148 __in efx_txq_t *etp) 149 { 150 _NOTE(ARGUNUSED(etp)) 151 /* Nothing to do here */ 152 } 153 154 __checkReturn efx_rc_t 155 rhead_tx_qdesc_post( 156 __in efx_txq_t *etp, 157 __in_ecount(ndescs) efx_desc_t *ed, 158 __in unsigned int ndescs, 159 __in unsigned int completed, 160 __inout unsigned int *addedp) 161 { 162 _NOTE(ARGUNUSED(etp)) 163 _NOTE(ARGUNUSED(ed)) 164 _NOTE(ARGUNUSED(ndescs)) 165 _NOTE(ARGUNUSED(completed)) 166 _NOTE(ARGUNUSED(addedp)) 167 168 /* FIXME Implement the method for Riverhead */ 169 170 return (ENOTSUP); 171 } 172 173 #if EFSYS_OPT_QSTATS 174 175 void 176 rhead_tx_qstats_update( 177 __in efx_txq_t *etp, 178 __inout_ecount(TX_NQSTATS) efsys_stat_t *stat) 179 { 180 unsigned int id; 181 182 for (id = 0; id < TX_NQSTATS; id++) { 183 efsys_stat_t *essp = &stat[id]; 184 185 EFSYS_STAT_INCR(essp, etp->et_stat[id]); 186 etp->et_stat[id] = 0; 187 } 188 } 189 190 #endif /* EFSYS_OPT_QSTATS */ 191 192 #endif /* EFSYS_OPT_RIVERHEAD */ 193