vmxnet3: add Tx L4 checksum offload

Support TCP/UDP checksum offload.

Signed-off-by: Yong Wang <yongwang@vmware.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
This commit is contained in:
Yong Wang 2016-01-12 18:08:35 -08:00 committed by Thomas Monjalon
parent 55cd9f139e
commit f598fd063b
2 changed files with 27 additions and 3 deletions

View File

@ -52,6 +52,10 @@ This section should contain new features added in this release. Sample format:
Tx data ring has been shown to improve small pkt forwarding performance
on vSphere environment.
* **Added vmxnet3 Tx L4 checksum offload.**
Support TCP/UDP checksum offload.
* **Virtio 1.0.**
Enabled virtio 1.0 support for virtio pmd driver.

View File

@ -409,7 +409,27 @@ vmxnet3_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
gdesc->txd.tci = txm->vlan_tci;
}
/* TODO: Add transmit checksum offload here */
if (txm->ol_flags & PKT_TX_L4_MASK) {
gdesc->txd.om = VMXNET3_OM_CSUM;
gdesc->txd.hlen = txm->l2_len + txm->l3_len;
switch (txm->ol_flags & PKT_TX_L4_MASK) {
case PKT_TX_TCP_CKSUM:
gdesc->txd.msscof = gdesc->txd.hlen + offsetof(struct tcp_hdr, cksum);
break;
case PKT_TX_UDP_CKSUM:
gdesc->txd.msscof = gdesc->txd.hlen + offsetof(struct udp_hdr, dgram_cksum);
break;
default:
PMD_TX_LOG(WARNING, "requested cksum offload not supported %#llx",
txm->ol_flags & PKT_TX_L4_MASK);
abort();
}
} else {
gdesc->txd.hlen = 0;
gdesc->txd.om = VMXNET3_OM_NONE;
gdesc->txd.msscof = 0;
}
/* flip the GEN bit on the SOP */
rte_compiler_barrier();
@ -724,8 +744,8 @@ vmxnet3_dev_tx_queue_setup(struct rte_eth_dev *dev,
PMD_INIT_FUNC_TRACE();
if ((tx_conf->txq_flags & ETH_TXQ_FLAGS_NOXSUMS) !=
ETH_TXQ_FLAGS_NOXSUMS) {
PMD_INIT_LOG(ERR, "TX no support for checksum offload yet");
ETH_TXQ_FLAGS_NOXSUMSCTP) {
PMD_INIT_LOG(ERR, "SCTP checksum offload not supported");
return -EINVAL;
}