netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Fan Du <fan.du@windriver.com>
To: <steffen.klassert@secunet.com>, <davem@davemloft.net>
Cc: <netdev@vger.kernel.org>
Subject: [PATCHv2 net-next 2/5] {pktgen, xfrm} Using "pgset spi xxx" to spedifiy SA for a given flow
Date: Fri, 6 Dec 2013 17:53:31 +0800	[thread overview]
Message-ID: <1386323614-5077-3-git-send-email-fan.du@windriver.com> (raw)
In-Reply-To: <1386323614-5077-1-git-send-email-fan.du@windriver.com>

User could set specific SPI value to arm pktgen flow with IPsec
transformation, instead of looking up SA by sadr/daddr. The reaseon
to do so is because current state lookup scheme is both slow and, most
important of all, in fact pktgen doesn't need to match any SA state
addresses information, all it needs is the SA transfromation shell to
do the encapuslation.

Signed-off-by: Fan Du <fan.du@windriver.com>
---
 net/core/pktgen.c |   11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index e6820e5..717e0b7 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -387,6 +387,7 @@ struct pktgen_dev {
 	int node;               /* Memory node */
 
 #ifdef CONFIG_XFRM
+	__u32 spi;
 #endif
 	char result[512];
 };
@@ -1474,6 +1475,16 @@ static ssize_t pktgen_if_write(struct file *file,
 		sprintf(pg_result, "OK: flows=%u", pkt_dev->cflows);
 		return count;
 	}
+	if (!strcmp(name, "spi")) {
+		len = num_arg(&user_buffer[i], 10, &value);
+		if (len < 0)
+			return len;
+
+		i += len;
+		pkt_dev->spi = value;
+		sprintf(pg_result, "OK: spi=%u", pkt_dev->spi);
+		return count;
+	}
 
 	if (!strcmp(name, "flowlen")) {
 		len = num_arg(&user_buffer[i], 10, &value);
-- 
1.7.9.5

  parent reply	other threads:[~2013-12-06  9:53 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-06  9:53 [PATCHv2 net-next 0/5] pktgen IPsec support Fan Du
2013-12-06  9:53 ` [PATCHv2 net-next 1/5] {pktgen, xfrm} Remove original pktgen ipsec fixed configuration Fan Du
2013-12-06  9:53 ` Fan Du [this message]
2013-12-06  9:53 ` [PATCHv2 net-next 3/5] {pktgen,xfrm} Construct skb dst for tunnel mode transformation Fan Du
2013-12-06  9:53 ` [PATCHv2 net-next 4/5] {pktgen, xfrm} Introduce xfrm_state_lookup_byspi for pktgen Fan Du
2013-12-06  9:53 ` [PATCHv2 net-next 5/5] {pktgen, xfrm} Correct xfrm state lock usage when transforming Fan Du
2013-12-10  0:58 ` [PATCHv2 net-next 0/5] pktgen IPsec support David Miller
2013-12-10  1:19   ` Fan Du
2013-12-10  1:23     ` David Miller
2013-12-10  2:02       ` Fan Du
2013-12-10  2:09         ` David Miller
2013-12-10  2:27           ` Fan Du
2013-12-10  5:49             ` David Miller
2013-12-11 13:42       ` Jamal Hadi Salim
2013-12-13  8:56         ` Fan Du
2013-12-13 12:13           ` Jamal Hadi Salim
2013-12-13 12:22             ` Fan Du

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1386323614-5077-3-git-send-email-fan.du@windriver.com \
    --to=fan.du@windriver.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=steffen.klassert@secunet.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).