ixgbevf: fix msglen for ipsec mbx messages
Don't be fancy with message lengths, just set lengths to
number of dwords, not bytes.
Fixes: 0062e7cc95
("ixgbevf: add VF IPsec offload code")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Shannon Nelson <shannon.nelson@oracle.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
This commit is contained in:
parent
072eff2d9e
commit
2c49d34f3b
@ -21,7 +21,6 @@ static int ixgbevf_ipsec_set_pf_sa(struct ixgbevf_adapter *adapter,
|
|||||||
u32 msgbuf[IXGBE_VFMAILBOX_SIZE] = { 0 };
|
u32 msgbuf[IXGBE_VFMAILBOX_SIZE] = { 0 };
|
||||||
struct ixgbe_hw *hw = &adapter->hw;
|
struct ixgbe_hw *hw = &adapter->hw;
|
||||||
struct sa_mbx_msg *sam;
|
struct sa_mbx_msg *sam;
|
||||||
u16 msglen;
|
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
/* send the important bits to the PF */
|
/* send the important bits to the PF */
|
||||||
@ -38,16 +37,14 @@ static int ixgbevf_ipsec_set_pf_sa(struct ixgbevf_adapter *adapter,
|
|||||||
memcpy(sam->key, xs->aead->alg_key, sizeof(sam->key));
|
memcpy(sam->key, xs->aead->alg_key, sizeof(sam->key));
|
||||||
|
|
||||||
msgbuf[0] = IXGBE_VF_IPSEC_ADD;
|
msgbuf[0] = IXGBE_VF_IPSEC_ADD;
|
||||||
msglen = sizeof(*sam) + sizeof(msgbuf[0]);
|
|
||||||
|
|
||||||
spin_lock_bh(&adapter->mbx_lock);
|
spin_lock_bh(&adapter->mbx_lock);
|
||||||
|
|
||||||
ret = hw->mbx.ops.write_posted(hw, msgbuf, msglen);
|
ret = hw->mbx.ops.write_posted(hw, msgbuf, IXGBE_VFMAILBOX_SIZE);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
msglen = sizeof(msgbuf[0]) * 2;
|
ret = hw->mbx.ops.read_posted(hw, msgbuf, 2);
|
||||||
ret = hw->mbx.ops.read_posted(hw, msgbuf, msglen);
|
|
||||||
if (ret)
|
if (ret)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
@ -80,11 +77,11 @@ static int ixgbevf_ipsec_del_pf_sa(struct ixgbevf_adapter *adapter, int pfsa)
|
|||||||
|
|
||||||
spin_lock_bh(&adapter->mbx_lock);
|
spin_lock_bh(&adapter->mbx_lock);
|
||||||
|
|
||||||
err = hw->mbx.ops.write_posted(hw, msgbuf, sizeof(msgbuf));
|
err = hw->mbx.ops.write_posted(hw, msgbuf, 2);
|
||||||
if (err)
|
if (err)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
err = hw->mbx.ops.read_posted(hw, msgbuf, sizeof(msgbuf));
|
err = hw->mbx.ops.read_posted(hw, msgbuf, 2);
|
||||||
if (err)
|
if (err)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user