Home | History | Annotate | Download | only in netinet
History log of /src/sys/netinet/in_offload.c
RevisionDateAuthorComments
 1.15  05-Jul-2024  rin sys: Drop redundant NULL check before m_freem(9)

m_freem(9) safely has accepted NULL argument at least since 4.2BSD:
https://www.tuhs.org/cgi-bin/utree.pl?file=4.2BSD/usr/src/sys/sys/uipc_mbuf.c

Compile-tested on amd64/ALL.

Suggested by knakahara@
 1.14  27-Mar-2020  jdolecek branches: 1.14.28;
fix in4_cksum() panic "in4_cksum: mbuf 14 too short for IP header 20"
triggered by bridge_output() when passing packet originally for
interface supporting hw csum offload to destination interface
not supporting it

problem happens because bridge_output() is called after ether_output()
M_PREPEND() the ether_header into the mbuf chain, if there is not
enough space on the first mbuf of the chain, it ends up prepending
a new short mbuf with just ether_header

triggered by running UDP (IPv4) 'netio -u' benchmark with packet size 2 KB

XXX seems in6_undefer_cksum() should have similar fix, however I was
XXX not able to trigger the problem there
 1.13  12-Dec-2018  rin PR kern/53562

Add ether_sw_offload_[tr]x: handle TX/RX offload options in software.
Since this violates separation b/w L2 and L3/L4, new files are added
rather than having the routines in sys/net/if_ethersubr.c.

OK msaitoh thorpej
 1.12  19-Sep-2018  rin Fix in_undefer_cksum() and in6_undefer_cksum().

The 4th argument for in[46]_cksum() should be length of L4 header +
L4 payload. The previous revisions are wrong

- for IPv4 when hdrlen != 0
- for IPv6 always

These functions are used only in net/if_loop.c and
arch/powerpc/booke/dev/pq3etsec.c under some special circumferences.
This should be why the bugs have not been found until today.

OK maxv
 1.11  11-Jul-2018  maxv Add KASSERTs in in_undefer_cksum_tcpudp.
 1.10  11-Jul-2018  maxv Style, rename 'iph' -> 'ip', and reduce the diff between
in_undefer_cksum_tcpudp and the last part of in_undefer_cksum.
 1.9  11-Jul-2018  maxv Remove the callback, localify, and add a comment.
 1.8  11-Jul-2018  maxv Rename

ip_undefer_csum -> in_undefer_cksum
in_delayed_cksum -> in_undefer_cksum_tcpudp

The two previous names were inconsistent and misleading.

Put the two functions into in_offload.c. Add comments to explain what
we're doing.

The same could be done for IPv6.
 1.7  26-Apr-2016  ozaki-r branches: 1.7.16; 1.7.18;
Stop using rt_gwroute on packet sending paths

rt_gwroute of rtentry is a reference to a rtentry of the gateway
for a rtentry with RTF_GATEWAY. That was used by L2 (arp and ndp)
to look up L2 addresses. By separating L2 nexthop caches, we don't
need a route for the purpose and we can stop using rt_gwroute.
By doing so, we can reduce referencing and modifying rtentries,
which makes it easy to apply a lock (and/or psref) to the
routing table and rtentries.

One issue to do this is to keep RTF_REJECT behavior. It seems it
was broken when we moved rtalloc1 things from L2 output routines
(e.g., ether_output) to ip_hresolv_output, but (fortunately?)
it works unexpectedly. What we mistook are:
- RTF_REJECT was checked for any routes in L2 output routines,
but in ip_hresolv_output it is checked only when the route
is RTF_GATEWAY
- The RTF_REJECT check wasn't copied to IPv6 (nd6_output)

It seems that rt_gwroute checks hid the mistakes and it looked
work (unexpectedly) and removing rt_gwroute checks unveil the
issue. So we need to fix RTF_REJECT checks in ip_hresolv_output
and also add them to nd6_output.

One more point we have to care is returning an errno; we need
to mimic looutput behavior. Originally RTF_REJECT check was
done either in L2 output routines or in looutput. The latter is
applied when a reject route directs to a loopback interface.
However, now RTF_REJECT check is done before looutput so to keep
the original behavior we need to return an errno which looutput
chooses. Added rt_check_reject_route does such tweaks.
 1.6  04-Jun-2015  ozaki-r Pull out route lookups from L2 output routines

Route lookups for routes of RTF_GATEWAY were done in L2 output
routines such as ether_output, but they should be done in L3
i.e., before L2 output routines. This change places the lookups
between L3 output routines (say ip_output) and the L2 output
routines.

The change is based on dyoung's patch submitted in the thread:
https://mail-index.netbsd.org/tech-net/2013/02/01/msg003847.html
You can find out detailed investigations by dyoung about the
issue in there.

Note that the change introduces a workaround for MPLS. ether_output
knew that it needs to fill the ethertype of a frame as MPLS,
based on a tag of an original route (rtentry), but now we don't
pass it to ehter_output. So we have to tell that in another way.
We use mtag to do so for now, which introduces some overhead.
We should fix it somehow in the future.

Discussed on tech-kern and tech-net.
 1.5  25-Apr-2011  yamt branches: 1.5.14; 1.5.32;
ip_undefer_csum:
- don't forget ntohs.
- don't add hdrlen twice for l4 header offset.
- use M_CSUM_DATA_IPv4_IPHL instead of extracting it from ip header.
- simplify code.
- KNF.
 1.4  14-Apr-2011  yamt after ip_input.c rev.1.285 and 1.286, restore kernel_lock for if_output.
 1.3  11-Dec-2010  matt branches: 1.3.2;
Add routines to calculate a checkesum if the driver concludes that the
h/w can't do it.
 1.2  24-Apr-2007  dyoung branches: 1.2.56; 1.2.60;
Constify.
 1.1  25-Nov-2006  yamt branches: 1.1.4; 1.1.6; 1.1.8; 1.1.10; 1.1.14; 1.1.16;
move tso-by-software code to their own files. no functional changes.
 1.1.16.1  11-Jul-2007  mjf Sync with head.
 1.1.14.1  08-Jun-2007  ad Sync with head.
 1.1.10.1  07-May-2007  yamt sync with head.
 1.1.8.2  12-Jan-2007  ad Sync with head.
 1.1.8.1  25-Nov-2006  ad file in_offload.c was added on branch newlock2 on 2007-01-12 01:04:14 +0000
 1.1.6.3  03-Sep-2007  yamt sync with head.
 1.1.6.2  30-Dec-2006  yamt sync with head.
 1.1.6.1  25-Nov-2006  yamt file in_offload.c was added on branch yamt-lazymbuf on 2006-12-30 20:50:33 +0000
 1.1.4.2  10-Dec-2006  yamt sync with head.
 1.1.4.1  25-Nov-2006  yamt file in_offload.c was added on branch yamt-splraiseipl on 2006-12-10 07:19:10 +0000
 1.2.60.1  07-Jan-2011  matt If using hardware checksum offload and the packet can't be h/w checksumed
(for whatever reason, some hardware is stupid) allow the driver to calculate
the checksum instead.
 1.2.56.3  31-May-2011  rmind sync with head
 1.2.56.2  21-Apr-2011  rmind sync with head
 1.2.56.1  05-Mar-2011  rmind sync with head
 1.3.2.1  06-Jun-2011  jruoho Sync with HEAD.
 1.5.32.2  29-May-2016  skrll Sync with HEAD
 1.5.32.1  06-Jun-2015  skrll Sync with HEAD
 1.5.14.1  03-Dec-2017  jdolecek update from HEAD
 1.7.18.2  08-Apr-2020  martin Merge changes from current as of 20200406
 1.7.18.1  10-Jun-2019  christos Sync with HEAD
 1.7.16.3  26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.7.16.2  30-Sep-2018  pgoyette Ssync with HEAD
 1.7.16.1  28-Jul-2018  pgoyette Sync with HEAD
 1.14.28.1  02-Aug-2025  perseant Sync with HEAD

RSS XML Feed