Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0458aa0a authored by Subash Abhinov Kasiviswanathan's avatar Subash Abhinov Kasiviswanathan
Browse files

tpacket: Notify userspace about packets with CHECKSUM_UNNECESSARY



tpacket already notifies userspace about packets filtered with
CHECKSUM_PARTIAL. This indicates to userspace that the checksum
field is invalid and needs to be recomputed. For instance, this
helps to avoid checksum calculation for GRO coalesced packets.
Note that we can safely skip validation of checksum for GRO
coalesced packets as the GRO engine validates checksum prior
to the coalesce.

Add a new flag to pass to userspace for CHECKSUM_UNNECESSARY.
Userspace will now be able to skip checksum validation for packets
which have passed checksum validation earlier in a driver. Hardware
supports checksum offload for IPv4 / IPv6 for TCP / UDP. This
means that userspace would not need to recompute checksum for these
packets.

Change-Id: I931cfc35c33b8a55f25d264fa568bc93135fd3ef
Signed-off-by: default avatarSubash Abhinov Kasiviswanathan <subashab@codeaurora.org>
parent 2ec3aad9
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -99,6 +99,7 @@ struct tpacket_auxdata {
#define TP_STATUS_VLAN_VALID		(1 << 4) /* auxdata has valid tp_vlan_tci */
#define TP_STATUS_BLK_TMO		(1 << 5)
#define TP_STATUS_VLAN_TPID_VALID	(1 << 6) /* auxdata has valid tp_vlan_tpid */
#define TP_STATUS_CSUM_UNNECESSARY	(1 << 7)

/* Tx ring - header status */
#define TP_STATUS_AVAILABLE	      0
+3 −0
Original line number Diff line number Diff line
@@ -1888,6 +1888,9 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev,
	if (skb->ip_summed == CHECKSUM_PARTIAL)
		status |= TP_STATUS_CSUMNOTREADY;

	if (skb->ip_summed == CHECKSUM_UNNECESSARY)
		status |= TP_STATUS_CSUM_UNNECESSARY;

	snaplen = skb->len;

	res = run_filter(skb, sk, snaplen);