src/dpdk/drivers/net/netvsc/hn_rxtx.c
static unsigned int hn_fill_sg(struct vmbus_gpa *sg,
			       const struct rte_mbuf *m)
{
	unsigned int segs = 0;

	while (m) {
		rte_iova_t addr = rte_mbuf_data_iova(m);
		unsigned int page = addr / PAGE_SIZE;
		unsigned int offset = addr & PAGE_MASK;
		unsigned int len = rte_pktmbuf_data_len(m);

		while (len > 0) {
			unsigned int bytes = RTE_MIN(len, PAGE_SIZE - offset);

			sg[segs].page = page;
			sg[segs].ofs = offset;
			sg[segs].len = bytes;
			segs++;

			++page;
			offset = 0;
			len -= bytes;
		}
		m = m->next;
	}

	return segs;
}
/* Build scatter gather list from chained mbuf */
Build scatter gather list from chained mbuf
Build scatter gather list from chained mbuf
static unsigned int hn_fill_sg(struct vmbus_gpa *sg,
			       const struct rte_mbuf *m)
{
	unsigned int segs = 0;
	while (m) {
		rte_iova_t addr = rte_mbuf_data_iova(m);
		unsigned int page = addr / PAGE_SIZE;
		unsigned int offset = addr & PAGE_MASK;
		unsigned int len = rte_pktmbuf_data_len(m);
		while (len > 0) {
			unsigned int bytes = RTE_MIN(len, PAGE_SIZE - offset);
			sg[segs].page = page;
			sg[segs].ofs = offset;
			sg[segs].len = bytes;
			segs++;
			++page;
			offset = 0;
			len -= bytes;
		}
		m = m->next;
	}
	return segs;
}
static unsigned int hn_fill_sg ( struct vmbus_gpa * sg , const struct rte_mbuf * m ) { unsigned int segs = 0 ; while ( m ) { rte_iova_t addr = rte_mbuf_data_iova ( m ) ; unsigned int page = addr / PAGE_SIZE ; unsigned int offset = addr & PAGE_MASK ; unsigned int len = rte_pktmbuf_data_len ( m ) ; while ( len > 0 ) { unsigned int bytes = RTE_MIN ( len , PAGE_SIZE - offset ) ; sg [ segs ] . page = page ; sg [ segs ] . ofs = offset ; sg [ segs ] . len = bytes ; segs ++ ; ++ page ; offset = 0 ; len -= bytes ; } m = m -> next ; } return segs ; }
Build scatter gather list from chained mbuf
Build scatter gather list from chained mbuf