Skip to contentSkip to conversation

ip xfrm: Add xfrm state crypto offload

PATCH Applied [email protected] 2 participants 2 messages Apr 30, 2017 – May 1, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ip xfrm: Add xfrm state crypto offload

From: Boris Pismenny <[email protected]>

syntax:
ip xfrm state .... offload dev <if-name> dir <in or out>

Example to add inbound offload:
ip xfrm state .... offload dev mlx0 dir in
Example to add outbound offload:
ip xfrm state .... offload dev mlx0 dir out

---
 ip/ipxfrm.c     | 19 +++++++++++++++++++
 ip/xfrm_state.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 68 insertions(+)
ip/ipxfrm.c +19 -0
index b0cfac17..d5eb22e2 100644
@@ -862,6 +862,25 @@ void xfrm_xfrma_print(struct rtattr *tb[], __u16 family,
 		}
 		fprintf(fp, "%s", _SL_);
 	}
+	if (tb[XFRMA_OFFLOAD_DEV]) {
+		struct xfrm_user_offload *xuo;
+
+		if (prefix)
+			fputs(prefix, fp);
+		fprintf(fp, "crypto offload parameters: ");
+
+		if (RTA_PAYLOAD(tb[XFRMA_OFFLOAD_DEV]) < sizeof(*xuo)) {
+			fprintf(fp, "(ERROR truncated)");
+			fprintf(fp, "%s", _SL_);
+			return;
+		}
+
+		xuo = (struct xfrm_user_offload *)
+			RTA_DATA(tb[XFRMA_OFFLOAD_DEV]);
+		fprintf(fp, "dev %s dir %s", ll_index_to_name(xuo->ifindex),
+			(xuo->flags & XFRM_OFFLOAD_INBOUND) ? "in" : "out");
+		fprintf(fp, "%s", _SL_);
+	}
 }
 
 static int xfrm_selector_iszero(struct xfrm_selector *s)
ip/xfrm_state.c +49 -0

85 lines not on this page · raw message

Signature · 1 line
2.11.0
#1 lore raw
Quoted 5 lines · On Sun, 30 Apr 2017 17:16:02 +0300 <[email protected]> wrote:

From: Boris Pismenny <[email protected]>

syntax:
ip xfrm state .... offload dev <if-name> dir <in or out>

Quoted 7 lines

Example to add inbound offload:
ip xfrm state .... offload dev mlx0 dir in
Example to add outbound offload:
ip xfrm state .... offload dev mlx0 dir out

Applied to net-next