DEV_RX_OFFLOAD_JUMBO_FRAME | \
DEV_RX_OFFLOAD_RSS_HASH)
+int vmxnet3_segs_dynfield_offset = -1;
+
static int eth_vmxnet3_dev_init(struct rte_eth_dev *eth_dev);
static int eth_vmxnet3_dev_uninit(struct rte_eth_dev *eth_dev);
static int vmxnet3_dev_configure(struct rte_eth_dev *dev);
struct vmxnet3_hw *hw = eth_dev->data->dev_private;
uint32_t mac_hi, mac_lo, ver;
struct rte_eth_link link;
+ static const struct rte_mbuf_dynfield vmxnet3_segs_dynfield_desc = {
+ .name = VMXNET3_SEGS_DYNFIELD_NAME,
+ .size = sizeof(vmxnet3_segs_dynfield_t),
+ .align = __alignof__(vmxnet3_segs_dynfield_t),
+ };
PMD_INIT_FUNC_TRACE();
eth_dev->tx_pkt_prepare = vmxnet3_prep_pkts;
pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
+ /* extra mbuf field is required to guess MSS */
+ vmxnet3_segs_dynfield_offset =
+ rte_mbuf_dynfield_register(&vmxnet3_segs_dynfield_desc);
+ if (vmxnet3_segs_dynfield_offset < 0) {
+ PMD_INIT_LOG(ERR, "Cannot register mbuf field.");
+ return -rte_errno;
+ }
+
/*
* for secondary processes, we don't initialize any further as primary
* has already done this work.
uint16_t vmxnet3_prep_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
uint16_t nb_pkts);
+#define VMXNET3_SEGS_DYNFIELD_NAME "rte_net_vmxnet3_dynfield_segs"
+typedef uint8_t vmxnet3_segs_dynfield_t;
+extern int vmxnet3_segs_dynfield_offset;
+
+static inline vmxnet3_segs_dynfield_t *
+vmxnet3_segs_dynfield(struct rte_mbuf *mbuf)
+{
+ return RTE_MBUF_DYNFIELD(mbuf, \
+ vmxnet3_segs_dynfield_offset, vmxnet3_segs_dynfield_t *);
+}
+
#endif /* _VMXNET3_ETHDEV_H_ */
struct rte_ipv6_hdr *ipv6_hdr;
struct rte_tcp_hdr *tcp_hdr;
char *ptr;
+ uint8_t segs;
RTE_ASSERT(rcd->tcp);
tcp_hdr = (struct rte_tcp_hdr *)(ptr + hlen);
hlen += (tcp_hdr->data_off & 0xf0) >> 2;
- if (rxm->udata64 > 1)
- return (rte_pktmbuf_pkt_len(rxm) - hlen +
- rxm->udata64 - 1) / rxm->udata64;
+ segs = *vmxnet3_segs_dynfield(rxm);
+ if (segs > 1)
+ return (rte_pktmbuf_pkt_len(rxm) - hlen + segs - 1) / segs;
else
return hw->mtu - hlen + sizeof(struct rte_ether_hdr);
}
(const Vmxnet3_RxCompDescExt *)rcd;
rxm->tso_segsz = rcde->mss;
- rxm->udata64 = rcde->segCnt;
+ *vmxnet3_segs_dynfield(rxm) = rcde->segCnt;
ol_flags |= PKT_RX_LRO;
}
} else { /* Offloads set in eop */