Commit c068ec5c authored by Leon Romanovsky's avatar Leon Romanovsky Committed by Jakub Kicinski

ixgbevf: fill IPsec state validation failure reason

Rely on extack to return failure reason.
Signed-off-by: default avatarLeon Romanovsky <leonro@nvidia.com>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 05ddf5f8
...@@ -272,18 +272,17 @@ static int ixgbevf_ipsec_add_sa(struct xfrm_state *xs, ...@@ -272,18 +272,17 @@ static int ixgbevf_ipsec_add_sa(struct xfrm_state *xs,
ipsec = adapter->ipsec; ipsec = adapter->ipsec;
if (xs->id.proto != IPPROTO_ESP && xs->id.proto != IPPROTO_AH) { if (xs->id.proto != IPPROTO_ESP && xs->id.proto != IPPROTO_AH) {
netdev_err(dev, "Unsupported protocol 0x%04x for IPsec offload\n", NL_SET_ERR_MSG_MOD(extack, "Unsupported protocol for IPsec offload");
xs->id.proto);
return -EINVAL; return -EINVAL;
} }
if (xs->props.mode != XFRM_MODE_TRANSPORT) { if (xs->props.mode != XFRM_MODE_TRANSPORT) {
netdev_err(dev, "Unsupported mode for ipsec offload\n"); NL_SET_ERR_MSG_MOD(extack, "Unsupported mode for ipsec offload");
return -EINVAL; return -EINVAL;
} }
if (xs->xso.type != XFRM_DEV_OFFLOAD_CRYPTO) { if (xs->xso.type != XFRM_DEV_OFFLOAD_CRYPTO) {
netdev_err(dev, "Unsupported ipsec offload type\n"); NL_SET_ERR_MSG_MOD(extack, "Unsupported ipsec offload type");
return -EINVAL; return -EINVAL;
} }
...@@ -291,14 +290,14 @@ static int ixgbevf_ipsec_add_sa(struct xfrm_state *xs, ...@@ -291,14 +290,14 @@ static int ixgbevf_ipsec_add_sa(struct xfrm_state *xs,
struct rx_sa rsa; struct rx_sa rsa;
if (xs->calg) { if (xs->calg) {
netdev_err(dev, "Compression offload not supported\n"); NL_SET_ERR_MSG_MOD(extack, "Compression offload not supported");
return -EINVAL; return -EINVAL;
} }
/* find the first unused index */ /* find the first unused index */
ret = ixgbevf_ipsec_find_empty_idx(ipsec, true); ret = ixgbevf_ipsec_find_empty_idx(ipsec, true);
if (ret < 0) { if (ret < 0) {
netdev_err(dev, "No space for SA in Rx table!\n"); NL_SET_ERR_MSG_MOD(extack, "No space for SA in Rx table!");
return ret; return ret;
} }
sa_idx = (u16)ret; sa_idx = (u16)ret;
...@@ -313,7 +312,7 @@ static int ixgbevf_ipsec_add_sa(struct xfrm_state *xs, ...@@ -313,7 +312,7 @@ static int ixgbevf_ipsec_add_sa(struct xfrm_state *xs,
/* get the key and salt */ /* get the key and salt */
ret = ixgbevf_ipsec_parse_proto_keys(xs, rsa.key, &rsa.salt); ret = ixgbevf_ipsec_parse_proto_keys(xs, rsa.key, &rsa.salt);
if (ret) { if (ret) {
netdev_err(dev, "Failed to get key data for Rx SA table\n"); NL_SET_ERR_MSG_MOD(extack, "Failed to get key data for Rx SA table");
return ret; return ret;
} }
...@@ -352,7 +351,7 @@ static int ixgbevf_ipsec_add_sa(struct xfrm_state *xs, ...@@ -352,7 +351,7 @@ static int ixgbevf_ipsec_add_sa(struct xfrm_state *xs,
/* find the first unused index */ /* find the first unused index */
ret = ixgbevf_ipsec_find_empty_idx(ipsec, false); ret = ixgbevf_ipsec_find_empty_idx(ipsec, false);
if (ret < 0) { if (ret < 0) {
netdev_err(dev, "No space for SA in Tx table\n"); NL_SET_ERR_MSG_MOD(extack, "No space for SA in Tx table");
return ret; return ret;
} }
sa_idx = (u16)ret; sa_idx = (u16)ret;
...@@ -366,7 +365,7 @@ static int ixgbevf_ipsec_add_sa(struct xfrm_state *xs, ...@@ -366,7 +365,7 @@ static int ixgbevf_ipsec_add_sa(struct xfrm_state *xs,
ret = ixgbevf_ipsec_parse_proto_keys(xs, tsa.key, &tsa.salt); ret = ixgbevf_ipsec_parse_proto_keys(xs, tsa.key, &tsa.salt);
if (ret) { if (ret) {
netdev_err(dev, "Failed to get key data for Tx SA table\n"); NL_SET_ERR_MSG_MOD(extack, "Failed to get key data for Tx SA table");
memset(&tsa, 0, sizeof(tsa)); memset(&tsa, 0, sizeof(tsa));
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment