Skip to content

Commit 99a7b0c

Browse files
Shannon NelsonJeff Kirsher
authored andcommitted
ixgbe: prep IPsec constants for later use
Pull out a couple of values from a function so they can be used later elsewhere. Signed-off-by: Shannon Nelson <[email protected]> Tested-by: Andrew Bowers <[email protected]> Signed-off-by: Jeff Kirsher <[email protected]>
1 parent b2875fb commit 99a7b0c

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
#include <net/xfrm.h>
66
#include <crypto/aead.h>
77

8+
#define IXGBE_IPSEC_KEY_BITS 160
9+
static const char aes_gcm_name[] = "rfc4106(gcm(aes))";
10+
811
/**
912
* ixgbe_ipsec_set_tx_sa - set the Tx SA registers
1013
* @hw: hw specific details
@@ -407,7 +410,6 @@ static int ixgbe_ipsec_parse_proto_keys(struct xfrm_state *xs,
407410
struct net_device *dev = xs->xso.dev;
408411
unsigned char *key_data;
409412
char *alg_name = NULL;
410-
const char aes_gcm_name[] = "rfc4106(gcm(aes))";
411413
int key_len;
412414

413415
if (!xs->aead) {
@@ -435,9 +437,9 @@ static int ixgbe_ipsec_parse_proto_keys(struct xfrm_state *xs,
435437
* we don't need to do any byteswapping.
436438
* 160 accounts for 16 byte key and 4 byte salt
437439
*/
438-
if (key_len == 160) {
440+
if (key_len == IXGBE_IPSEC_KEY_BITS) {
439441
*mysalt = ((u32 *)key_data)[4];
440-
} else if (key_len != 128) {
442+
} else if (key_len != (IXGBE_IPSEC_KEY_BITS - (sizeof(*mysalt) * 8))) {
441443
netdev_err(dev, "IPsec hw offload only supports keys up to 128 bits with a 32 bit salt\n");
442444
return -EINVAL;
443445
} else {

0 commit comments

Comments
 (0)