RE: [PATCHv9 net-next 2/4] sunvnet: make transmit path zero-copy in the kernel
From: David Laight <hidden>
Date: 2014-10-02 09:08:41
From: David Laight <hidden>
Date: 2014-10-02 09:08:41
From: Raghuram Kothakota
Sorry I am late in providing my comments, but I feel it is important to share this comment.
A comment on the original patch... ...
quoted
@@ -811,14 +930,27 @@ static int vnet_start_xmit(struct sk_buff *skb, struct net_device *dev)d = vio_dring_cur(dr); - tx_buf = port->tx_bufs[dr->prod].buf; - skb_copy_from_linear_data(skb, tx_buf + VNET_PACKET_SKIP, skb->len); + txi = dr->prod; + + freeskbs = vnet_clean_tx_ring(port, &pending); + + BUG_ON(port->tx_bufs[txi].skb); len = skb->len; - if (len < ETH_ZLEN) { + if (len < ETH_ZLEN) len = ETH_ZLEN; - memset(tx_buf+VNET_PACKET_SKIP+skb->len, 0, len - skb->len); +
Aren't you transmitting 'random' bytes from the end of the data? Plausibly they might not even be mapped. Also, for short frames the copy could well be faster - especially on systems with non-trivial iommu. It is also worth checking whether the original copy was aligned. David