ipfw NAT, igb and hardware checksums

Alexander V. Chernikov melifaro at ipfw.ru
Wed Jan 13 22:14:52 UTC 2016


13.01.2016, 22:56, "Karim Fodil-Lemelin" <fodillemlinkarim at gmail.com>:
> Hi,
>
> I've hit a very interesting problem with ipfw-nat and local TCP traffic
> that has enough TCP options to hit a special case in m_megapullup().
> Here is the story:
>
> I am using the following NIC:
>
> igb0 at pci0:4:0:0: class=0x020000 card=0x00008086 chip=0x150e8086
> rev=0x01 hdr=0x00
>
> And when I do ipfw nat to locally emitted packets I see packets not
> being processed in the igb driver for HW checksum. Now a quick search
> for m_pullup in the igb driver code will show that our igb driver
> expects a contiguous ethernet + ip header in igb_tx_ctx_setup(). Now the
> friendly m_megapullup() in alias.c doesn't reserve any space before the
> ip header for the ethernet header after its call to m_getcl like
> tcp_output.c (see m->m_data += max_linkhdr in tcp_output.c).
>
> So the call to M_PREPEND() in ether_output() is forced to prepend a new
> mbuf for the ethernet header, leading to a non contiguous ether + ip.
> This in turn leads to a failure to properly read the IP protocol in the
> igb driver and apply the proper HW checksum function. Particularly this
> call in igb_tcp_ctx_setup(): ip = (struct ip *)(mp->m_data + ehdrlen);
Thanks for the detailed explanation. Looks reasonable. I'll do several more tests on that and commit.
>
> It would be nice if some FBSD comitter could review and hopefully add
> this patch to FBSD.
>
> Thank you,
>
> Karim.
> _______________________________________________
> freebsd-net at freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-net
> To unsubscribe, send any mail to "freebsd-net-unsubscribe at freebsd.org"


More information about the freebsd-ipfw mailing list