Commit 0c05ab78 authored by Leon Romanovsky's avatar Leon Romanovsky Committed by Steffen Klassert

ixgbe: propagate XFRM offload state direction instead of flags

Convert the ixgbe driver to rely on XFRM offload state direction instead
of flags bits that were not checked at all.
Reviewed-by: default avatarRaed Salem <raeds@nvidia.com>
Signed-off-by: default avatarLeon Romanovsky <leonro@nvidia.com>
Signed-off-by: default avatarSteffen Klassert <steffen.klassert@secunet.com>
parent 482db2f1
...@@ -585,7 +585,7 @@ static int ixgbe_ipsec_add_sa(struct xfrm_state *xs) ...@@ -585,7 +585,7 @@ static int ixgbe_ipsec_add_sa(struct xfrm_state *xs)
return -EINVAL; return -EINVAL;
} }
if (xs->xso.flags & XFRM_OFFLOAD_INBOUND) { if (xs->xso.dir == XFRM_DEV_OFFLOAD_IN) {
struct rx_sa rsa; struct rx_sa rsa;
if (xs->calg) { if (xs->calg) {
...@@ -757,7 +757,7 @@ static void ixgbe_ipsec_del_sa(struct xfrm_state *xs) ...@@ -757,7 +757,7 @@ static void ixgbe_ipsec_del_sa(struct xfrm_state *xs)
u32 zerobuf[4] = {0, 0, 0, 0}; u32 zerobuf[4] = {0, 0, 0, 0};
u16 sa_idx; u16 sa_idx;
if (xs->xso.flags & XFRM_OFFLOAD_INBOUND) { if (xs->xso.dir == XFRM_DEV_OFFLOAD_IN) {
struct rx_sa *rsa; struct rx_sa *rsa;
u8 ipi; u8 ipi;
...@@ -903,8 +903,7 @@ int ixgbe_ipsec_vf_add_sa(struct ixgbe_adapter *adapter, u32 *msgbuf, u32 vf) ...@@ -903,8 +903,7 @@ int ixgbe_ipsec_vf_add_sa(struct ixgbe_adapter *adapter, u32 *msgbuf, u32 vf)
/* Tx IPsec offload doesn't seem to work on this /* Tx IPsec offload doesn't seem to work on this
* device, so block these requests for now. * device, so block these requests for now.
*/ */
sam->flags = sam->flags & ~XFRM_OFFLOAD_IPV6; if (sam->dir != XFRM_DEV_OFFLOAD_IN) {
if (sam->flags != XFRM_OFFLOAD_INBOUND) {
err = -EOPNOTSUPP; err = -EOPNOTSUPP;
goto err_out; goto err_out;
} }
...@@ -915,7 +914,7 @@ int ixgbe_ipsec_vf_add_sa(struct ixgbe_adapter *adapter, u32 *msgbuf, u32 vf) ...@@ -915,7 +914,7 @@ int ixgbe_ipsec_vf_add_sa(struct ixgbe_adapter *adapter, u32 *msgbuf, u32 vf)
goto err_out; goto err_out;
} }
xs->xso.flags = sam->flags; xs->xso.dir = sam->dir;
xs->id.spi = sam->spi; xs->id.spi = sam->spi;
xs->id.proto = sam->proto; xs->id.proto = sam->proto;
xs->props.family = sam->family; xs->props.family = sam->family;
......
...@@ -74,7 +74,7 @@ struct ixgbe_ipsec { ...@@ -74,7 +74,7 @@ struct ixgbe_ipsec {
struct sa_mbx_msg { struct sa_mbx_msg {
__be32 spi; __be32 spi;
u8 flags; u8 dir;
u8 proto; u8 proto;
u16 family; u16 family;
__be32 addr[4]; __be32 addr[4];
......
...@@ -25,7 +25,7 @@ static int ixgbevf_ipsec_set_pf_sa(struct ixgbevf_adapter *adapter, ...@@ -25,7 +25,7 @@ static int ixgbevf_ipsec_set_pf_sa(struct ixgbevf_adapter *adapter,
/* send the important bits to the PF */ /* send the important bits to the PF */
sam = (struct sa_mbx_msg *)(&msgbuf[1]); sam = (struct sa_mbx_msg *)(&msgbuf[1]);
sam->flags = xs->xso.flags; sam->dir = xs->xso.dir;
sam->spi = xs->id.spi; sam->spi = xs->id.spi;
sam->proto = xs->id.proto; sam->proto = xs->id.proto;
sam->family = xs->props.family; sam->family = xs->props.family;
...@@ -280,7 +280,7 @@ static int ixgbevf_ipsec_add_sa(struct xfrm_state *xs) ...@@ -280,7 +280,7 @@ static int ixgbevf_ipsec_add_sa(struct xfrm_state *xs)
return -EINVAL; return -EINVAL;
} }
if (xs->xso.flags & XFRM_OFFLOAD_INBOUND) { if (xs->xso.dir == XFRM_DEV_OFFLOAD_IN) {
struct rx_sa rsa; struct rx_sa rsa;
if (xs->calg) { if (xs->calg) {
...@@ -394,7 +394,7 @@ static void ixgbevf_ipsec_del_sa(struct xfrm_state *xs) ...@@ -394,7 +394,7 @@ static void ixgbevf_ipsec_del_sa(struct xfrm_state *xs)
adapter = netdev_priv(dev); adapter = netdev_priv(dev);
ipsec = adapter->ipsec; ipsec = adapter->ipsec;
if (xs->xso.flags & XFRM_OFFLOAD_INBOUND) { if (xs->xso.dir == XFRM_DEV_OFFLOAD_IN) {
sa_idx = xs->xso.offload_handle - IXGBE_IPSEC_BASE_RX_INDEX; sa_idx = xs->xso.offload_handle - IXGBE_IPSEC_BASE_RX_INDEX;
if (!ipsec->rx_tbl[sa_idx].used) { if (!ipsec->rx_tbl[sa_idx].used) {
......
...@@ -57,7 +57,7 @@ struct ixgbevf_ipsec { ...@@ -57,7 +57,7 @@ struct ixgbevf_ipsec {
struct sa_mbx_msg { struct sa_mbx_msg {
__be32 spi; __be32 spi;
u8 flags; u8 dir;
u8 proto; u8 proto;
u16 family; u16 family;
__be32 addr[4]; __be32 addr[4];
......
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