Subject: Re: RTL8169 hw IP4CSUM_Tx workaround
To: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
From: Pavel Cahyna <pavel@NetBSD.org>
List: tech-net
Date: 10/21/2006 10:27:03
On Sat, Oct 21, 2006 at 03:15:32PM +0900, Izumi Tsutsui wrote:
> +static inline int
> +re_cksum_pad(struct mbuf *pkt)
> +{
> +	struct mbuf *m_last, *m_pad;
> +	int padlen;
> +
> +	padlen = ETHER_PAD_LEN - pkt->m_pkthdr.len;
> +
> +	/*
> +	 * Walk packet chain to find last mbuf. We will either
> +	 * pad there, or append a new mbuf and pad it.
> +	 */
> +	for (m_last = pkt; m_last->m_next != NULL; m_last = m_last->m_next)
> +		continue;
> +
> +	/* `m_last' now points to last in chain. */
> +	if (M_READONLY(m_last) || M_TRAILINGSPACE(m_last) < padlen) {

M_TRAILINGSPACE returns 0 if the mbuf is read-only.

Pavel