netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Shannon Nelson <shannon.nelson@oracle.com>
To: intel-wired-lan@lists.osuosl.org, jeffrey.t.kirsher@intel.com
Cc: steffen.klassert@secunet.com, netdev@vger.kernel.org
Subject: [PATCH next-queue 2/8] ixgbe: prep ipsec constants for later use
Date: Mon, 13 Aug 2018 11:43:39 -0700	[thread overview]
Message-ID: <1534185825-12451-3-git-send-email-shannon.nelson@oracle.com> (raw)
In-Reply-To: <1534185825-12451-1-git-send-email-shannon.nelson@oracle.com>

Pull out a couple of values from a function so they can be used
later elsewhere.

Signed-off-by: Shannon Nelson <shannon.nelson@oracle.com>
---
 drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c
index 4340651..3afb1fe 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c
@@ -5,6 +5,9 @@
 #include <net/xfrm.h>
 #include <crypto/aead.h>
 
+#define IXGBE_IPSEC_KEY_BITS  160
+static const char aes_gcm_name[] = "rfc4106(gcm(aes))";
+
 /**
  * ixgbe_ipsec_set_tx_sa - set the Tx SA registers
  * @hw: hw specific details
@@ -407,7 +410,6 @@ static int ixgbe_ipsec_parse_proto_keys(struct xfrm_state *xs,
 	struct net_device *dev = xs->xso.dev;
 	unsigned char *key_data;
 	char *alg_name = NULL;
-	const char aes_gcm_name[] = "rfc4106(gcm(aes))";
 	int key_len;
 
 	if (!xs->aead) {
@@ -435,9 +437,9 @@ static int ixgbe_ipsec_parse_proto_keys(struct xfrm_state *xs,
 	 * we don't need to do any byteswapping.
 	 * 160 accounts for 16 byte key and 4 byte salt
 	 */
-	if (key_len == 160) {
+	if (key_len == IXGBE_IPSEC_KEY_BITS) {
 		*mysalt = ((u32 *)key_data)[4];
-	} else if (key_len != 128) {
+	} else if (key_len != (IXGBE_IPSEC_KEY_BITS - (sizeof(*mysalt) * 8))) {
 		netdev_err(dev, "IPsec hw offload only supports keys up to 128 bits with a 32 bit salt\n");
 		return -EINVAL;
 	} else {
-- 
2.7.4

  parent reply	other threads:[~2018-08-13 21:27 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-13 18:43 [PATCH next-queue 0/8] ixgbe/ixgbevf: IPsec offload support for VFs Shannon Nelson
2018-08-13 18:43 ` [PATCH next-queue 1/8] ixgbe: reload ipsec ip table after sa tables Shannon Nelson
2018-08-13 18:43 ` Shannon Nelson [this message]
2018-08-13 18:43 ` [PATCH next-queue 3/8] ixgbe: add VF ipsec management Shannon Nelson
2018-08-14  5:31   ` kbuild test robot
2018-08-14 18:55     ` Shannon Nelson
2018-08-13 18:43 ` [PATCH next-queue 4/8] ixgbe: add VF IPsec offload enable flag Shannon Nelson
2018-08-13 18:43 ` [PATCH next-queue 5/8] ixgbe: add VF IPsec offload request message handling Shannon Nelson
2018-08-13 18:43 ` [PATCH next-queue 6/8] ixgbevf: add defines for IPsec offload request Shannon Nelson
2018-08-13 18:43 ` [PATCH next-queue 7/8] ixgbevf: add VF ipsec offload code Shannon Nelson
2018-08-13 18:43 ` [PATCH next-queue 8/8] ixgbevf: enable VF ipsec offload operations Shannon Nelson
2018-08-14 15:30 ` [Intel-wired-lan] [PATCH next-queue 0/8] ixgbe/ixgbevf: IPsec offload support for VFs Alexander Duyck
2018-08-14 17:10   ` Shannon Nelson
2018-08-16 21:15     ` Alexander Duyck
2018-08-16 21:36       ` Shannon Nelson
2018-08-17 23:19         ` Shannon Nelson
2018-08-17 23:27           ` Alexander Duyck

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=1534185825-12451-3-git-send-email-shannon.nelson@oracle.com \
    --to=shannon.nelson@oracle.com \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=jeffrey.t.kirsher@intel.com \
    --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).