| 3076 | (ctx)->ifc_softc_ctx.isc_tx_nsegments) |
| 3077 | |
| 3078 | static inline bool |
| 3079 | iflib_txd_db_check(iflib_txq_t txq, int ring) |
| 3080 | { |
| 3081 | if_ctx_t ctx = txq->ift_ctx; |
| 3082 | qidx_t dbval, max; |
| 3083 | |
| 3084 | max = TXQ_MAX_DB_DEFERRED(txq, txq->ift_in_use); |
| 3085 | |
| 3086 | /* force || threshold exceeded || at the edge of the ring */ |
| 3087 | if (ring || (txq->ift_db_pending >= max) || (TXQ_AVAIL(txq) <= MAX_TX_DESC(ctx) + 2)) { |
| 3088 | |
| 3089 | /* |
| 3090 | * 'npending' is used if the card's doorbell is in terms of the number of descriptors |
| 3091 | * pending flush (BRCM). 'pidx' is used in cases where the card's doorbeel uses the |
| 3092 | * producer index explicitly (INTC). |
| 3093 | */ |
| 3094 | dbval = txq->ift_npending ? txq->ift_npending : txq->ift_pidx; |
| 3095 | bus_dmamap_sync(txq->ift_ifdi->idi_tag, txq->ift_ifdi->idi_map, |
| 3096 | BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); |
| 3097 | ctx->isc_txd_flush(ctx->ifc_softc, txq->ift_id, dbval); |
| 3098 | |
| 3099 | /* |
| 3100 | * Absent bugs there are zero packets pending so reset pending counts to zero. |
| 3101 | */ |
| 3102 | txq->ift_db_pending = txq->ift_npending = 0; |
| 3103 | return (true); |
| 3104 | } |
| 3105 | return (false); |
| 3106 | } |
| 3107 | |
| 3108 | #ifdef PKT_DEBUG |
| 3109 | static void |
no test coverage detected