[PATCH v4] net/hns3: fix Rx packet without CRC data

Stephen Hemminger stephen at networkplumber.org
Fri Nov 29 18:12:06 CET 2024


On Fri, 29 Nov 2024 09:36:43 +0800
Jie Hai <haijie1 at huawei.com> wrote:

> > +
> > +static inline void
> > +hns3_recalculate_crc(struct rte_mbuf *m)
> > +{
> > +	char *append_data;
> > +	uint32_t crc;
> > +
> > +	crc = rte_net_crc_calc(rte_pktmbuf_mtod(m, void *),
> > +			       m->data_len, RTE_NET_CRC32_ETH);
> > +
> > +	/*
> > +	 * After CRC is stripped by hardware, pkt_len and data_len do not
> > +	 * contain the CRC length. Therefore, after CRC data is appended
> > +	 * by PMD again.
> > +	 */
> > +	append_data = rte_pktmbuf_append(m, RTE_ETHER_CRC_LEN);
> > +
> > +	/* CRC data is binary data and does not care about the byte order. */
> > +	memcpy(append_data, &crc, RTE_ETHER_CRC_LEN);
> > +}

As mentioned previously.
Including CRC in the packet length (pkt_len and data_len) is not the
current behavior of most drivers. Therefore hns3 should follow the precedent
of other drivers and put it past the data.

In the future the KEEP_CRC flag needs more work to be useable. It needs
documentation and flag in mbuf (similar to hash and checksum) so that application
can no that it is present and valid.

Please resend the patch as a bugfix that puts crc after the data.


More information about the dev mailing list