src/dpdk/drivers/net/netvsc/hn_rxtx.c
static void *
hn_try_txagg(struct hn_data *hv, struct hn_tx_queue *txq,
	     struct hn_txdesc *txd, uint32_t pktsize)
{
	struct hn_txdesc *agg_txd = txq->agg_txd;
	struct rndis_packet_msg *pkt;
	void *chim;

	if (agg_txd) {
		unsigned int padding, olen;

		/*
		 * Update the previous RNDIS packet's total length,
		 * it can be increased due to the mandatory alignment
		 * padding for this RNDIS packet.  And update the
		 * aggregating txdesc's chimney sending buffer size
		 * accordingly.
		 *
		 * Zero-out the padding, as required by the RNDIS spec.
		 */
		pkt = txq->agg_prevpkt;
		olen = pkt->len;
		padding = RTE_ALIGN(olen, txq->agg_align) - olen;
		if (padding > 0) {
			agg_txd->chim_size += padding;
			pkt->len += padding;
			memset((uint8_t *)pkt + olen, 0, padding);
		}

		chim = (uint8_t *)pkt + pkt->len;
		txq->agg_prevpkt = chim;
		txq->agg_pktleft--;
		txq->agg_szleft -= pktsize;
		if (txq->agg_szleft < HN_PKTSIZE_MIN(txq->agg_align)) {
			/*
			 * Probably can't aggregate more packets,
			 * flush this aggregating txdesc proactively.
			 */
			txq->agg_pktleft = 0;
		}

		hn_txd_put(txq, txd);
		return chim;
	}

	txd->chim_index = hn_chim_alloc(hv);
	if (txd->chim_index == NVS_CHIM_IDX_INVALID)
		return NULL;

	chim = (uint8_t *)hv->chim_res->addr
			+ txd->chim_index * hv->chim_szmax;

	txq->agg_txd = txd;
	txq->agg_pktleft = txq->agg_pktmax - 1;
	txq->agg_szleft = txq->agg_szmax - pktsize;
	txq->agg_prevpkt = chim;

	return chim;
}
/*
 * Try and find a place in a send chimney buffer to put
 * the small packet. If space is available, this routine
 * returns a pointer of where to place the data.
 * If no space, caller should try direct transmit.
 */
Try and find a place in a send chimney buffer to put
the small packet. If space is available, this routine
returns a pointer of where to place the data.
If no space, caller should try direct transmit.
Try and find a place in a send chimney buffer to put the small packet . If space is available this routine returns a pointer of where to place the data . If no space caller should try direct transmit .
static void *
hn_try_txagg(struct hn_data *hv, struct hn_tx_queue *txq,
	     struct hn_txdesc *txd, uint32_t pktsize)
{
	struct hn_txdesc *agg_txd = txq->agg_txd;
	struct rndis_packet_msg *pkt;
	void *chim;
	if (agg_txd) {
		unsigned int padding, olen;
		pkt = txq->agg_prevpkt;
		olen = pkt->len;
		padding = RTE_ALIGN(olen, txq->agg_align) - olen;
		if (padding > 0) {
			agg_txd->chim_size += padding;
			pkt->len += padding;
			memset((uint8_t *)pkt + olen, 0, padding);
		}
		chim = (uint8_t *)pkt + pkt->len;
		txq->agg_prevpkt = chim;
		txq->agg_pktleft--;
		txq->agg_szleft -= pktsize;
		if (txq->agg_szleft < HN_PKTSIZE_MIN(txq->agg_align)) {
			txq->agg_pktleft = 0;
		}
		hn_txd_put(txq, txd);
		return chim;
	}
	txd->chim_index = hn_chim_alloc(hv);
	if (txd->chim_index == NVS_CHIM_IDX_INVALID)
		return NULL;
	chim = (uint8_t *)hv->chim_res->addr
			+ txd->chim_index * hv->chim_szmax;
	txq->agg_txd = txd;
	txq->agg_pktleft = txq->agg_pktmax - 1;
	txq->agg_szleft = txq->agg_szmax - pktsize;
	txq->agg_prevpkt = chim;
	return chim;
}
static void * hn_try_txagg ( struct hn_data * hv , struct hn_tx_queue * txq , struct hn_txdesc * txd , uint32_t pktsize ) { struct hn_txdesc * agg_txd = txq -> agg_txd ; struct rndis_packet_msg * pkt ; void * chim ; if ( agg_txd ) { unsigned int padding , olen ; pkt = txq -> agg_prevpkt ; olen = pkt -> len ; padding = RTE_ALIGN ( olen , txq -> agg_align ) - olen ; if ( padding > 0 ) { agg_txd -> chim_size += padding ; pkt -> len += padding ; memset ( ( uint8_t * ) pkt + olen , 0 , padding ) ; } chim = ( uint8_t * ) pkt + pkt -> len ; txq -> agg_prevpkt = chim ; txq -> agg_pktleft -- ; txq -> agg_szleft -= pktsize ; if ( txq -> agg_szleft < HN_PKTSIZE_MIN ( txq -> agg_align ) ) { txq -> agg_pktleft = 0 ; } hn_txd_put ( txq , txd ) ; return chim ; } txd -> chim_index = hn_chim_alloc ( hv ) ; if ( txd -> chim_index == NVS_CHIM_IDX_INVALID ) return NULL ; chim = ( uint8_t * ) hv -> chim_res -> addr + txd -> chim_index * hv -> chim_szmax ; txq -> agg_txd = txd ; txq -> agg_pktleft = txq -> agg_pktmax - 1 ; txq -> agg_szleft = txq -> agg_szmax - pktsize ; txq -> agg_prevpkt = chim ; return chim ; }
Try and find a place in a send chimney buffer to put
 the small packet.
Try and find a place in a send chimney buffer to put the small packet .
/*
		 * Update the previous RNDIS packet's total length,
		 * it can be increased due to the mandatory alignment
		 * padding for this RNDIS packet.  And update the
		 * aggregating txdesc's chimney sending buffer size
		 * accordingly.
		 *
		 * Zero-out the padding, as required by the RNDIS spec.
		 */ /*
			 * Probably can't aggregate more packets,
			 * flush this aggregating txdesc proactively.
			 */