mirror of
https://github.com/torvalds/linux.git
synced 2026-05-24 23:22:31 +02:00
Merge branch 'cn10k-ipswec-outbound-inline-support'
Bharat Bhushan says: ==================== cn10k-ipsec: Add outbound inline ipsec support This patch series adds outbound inline ipsec support on Marvell cn10k series of platform. One crypto hardware logical function (cpt-lf) per netdev is required for inline ipsec outbound functionality. Software prepare and submit crypto hardware (CPT) instruction for outbound inline ipsec crypto mode offload. The CPT instruction have details for encryption and authentication Crypto hardware encrypt, authenticate and provide the ESP packet to network hardware logic to transmit ipsec packet. First patch makes dma memory writable for in-place encryption, Second patch moves code to common file, Third patch disable backpressure on crypto (CPT) and network (NIX) hardware. Patch four onwards enables inline outbound ipsec. v9->v10: - Removed unlikely() in data-patch and used static_branch when at least a SA is configured. - Added missing READ_ONCE() as per comment on previous patch - Removed "\n" from end of extack messages - Poll for context write status check reduced to 100ms from 10s v8->v9: - Removed mutex lock to use hardware, now using hardware state - Previous versions were supporting only 64 SAs and a bitmap was used for same. That limitation is removed from this version. - Replaced netdev_err with NL_SET_ERR_MSG_MOD in state add flow as per comment in previous version v7->v8: - spell correction in patch 1/8 (s/sdk/skb) v6->v7: - skb data was mapped as device writeable but it was not ensured that skb is writeable. This version calls skb_unshare() to make skb data writeable (Thanks Jakub Kicinski for pointing out). v4->v5: - Fixed un-initialized warning and pointer check (comment from Kalesh Anakkur Purayil) v3->v4: - Few error messages in data-path removed and some moved under netif_msg_tx_err(). - Added check for crypto offload (XFRM_DEV_OFFLOAD_CRYPTO) Thanks "Leon Romanovsky" for pointing out - Fixed codespell error as per comment from Simon Horman - Added some other cleanup comment from Kalesh Anakkur Purayil v2->v3: - Fix smatch and sparse errors (Comment from Simon Horman) - Fix build error with W=1 (Comment from Simon Horman) https://patchwork.kernel.org/project/netdevbpf/patch/20240513105446.297451-6-bbhushan2@marvell.com/ - Some other minor cleanup as per comment https://www.spinics.net/lists/netdev/msg997197.html v1->v2: - Fix compilation error to build driver a module - Use dma_wmb() instead of architecture specific barrier - Fix couple of other compilation warnings ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
commit
6145fefc1e
|
|
@ -13942,6 +13942,7 @@ M: Sunil Goutham <sgoutham@marvell.com>
|
|||
M: Geetha sowjanya <gakula@marvell.com>
|
||||
M: Subbaraya Sundeep <sbhatta@marvell.com>
|
||||
M: hariprasad <hkelam@marvell.com>
|
||||
M: Bharat Bhushan <bbhushan2@marvell.com>
|
||||
L: netdev@vger.kernel.org
|
||||
S: Supported
|
||||
F: drivers/net/ethernet/marvell/octeontx2/nic/
|
||||
|
|
|
|||
|
|
@ -313,6 +313,10 @@ M(NIX_BANDPROF_FREE, 0x801e, nix_bandprof_free, nix_bandprof_free_req, \
|
|||
msg_rsp) \
|
||||
M(NIX_BANDPROF_GET_HWINFO, 0x801f, nix_bandprof_get_hwinfo, msg_req, \
|
||||
nix_bandprof_get_hwinfo_rsp) \
|
||||
M(NIX_CPT_BP_ENABLE, 0x8020, nix_cpt_bp_enable, nix_bp_cfg_req, \
|
||||
nix_bp_cfg_rsp) \
|
||||
M(NIX_CPT_BP_DISABLE, 0x8021, nix_cpt_bp_disable, nix_bp_cfg_req, \
|
||||
msg_rsp) \
|
||||
M(NIX_READ_INLINE_IPSEC_CFG, 0x8023, nix_read_inline_ipsec_cfg, \
|
||||
msg_req, nix_inline_ipsec_cfg) \
|
||||
M(NIX_MCAST_GRP_CREATE, 0x802b, nix_mcast_grp_create, nix_mcast_grp_create_req, \
|
||||
|
|
|
|||
|
|
@ -569,9 +569,17 @@ void rvu_nix_flr_free_bpids(struct rvu *rvu, u16 pcifunc)
|
|||
mutex_unlock(&rvu->rsrc_lock);
|
||||
}
|
||||
|
||||
int rvu_mbox_handler_nix_bp_disable(struct rvu *rvu,
|
||||
struct nix_bp_cfg_req *req,
|
||||
struct msg_rsp *rsp)
|
||||
static u16 nix_get_channel(u16 chan, bool cpt_link)
|
||||
{
|
||||
/* CPT channel for a given link channel is always
|
||||
* assumed to be BIT(11) set in link channel.
|
||||
*/
|
||||
return cpt_link ? chan | BIT(11) : chan;
|
||||
}
|
||||
|
||||
static int nix_bp_disable(struct rvu *rvu,
|
||||
struct nix_bp_cfg_req *req,
|
||||
struct msg_rsp *rsp, bool cpt_link)
|
||||
{
|
||||
u16 pcifunc = req->hdr.pcifunc;
|
||||
int blkaddr, pf, type, err;
|
||||
|
|
@ -579,6 +587,7 @@ int rvu_mbox_handler_nix_bp_disable(struct rvu *rvu,
|
|||
struct rvu_pfvf *pfvf;
|
||||
struct nix_hw *nix_hw;
|
||||
struct nix_bp *bp;
|
||||
u16 chan_v;
|
||||
u64 cfg;
|
||||
|
||||
pf = rvu_get_pf(pcifunc);
|
||||
|
|
@ -589,6 +598,9 @@ int rvu_mbox_handler_nix_bp_disable(struct rvu *rvu,
|
|||
if (is_sdp_pfvf(pcifunc))
|
||||
type = NIX_INTF_TYPE_SDP;
|
||||
|
||||
if (cpt_link && !rvu->hw->cpt_links)
|
||||
return 0;
|
||||
|
||||
pfvf = rvu_get_pfvf(rvu, pcifunc);
|
||||
err = nix_get_struct_ptrs(rvu, pcifunc, &nix_hw, &blkaddr);
|
||||
if (err)
|
||||
|
|
@ -597,8 +609,9 @@ int rvu_mbox_handler_nix_bp_disable(struct rvu *rvu,
|
|||
bp = &nix_hw->bp;
|
||||
chan_base = pfvf->rx_chan_base + req->chan_base;
|
||||
for (chan = chan_base; chan < (chan_base + req->chan_cnt); chan++) {
|
||||
cfg = rvu_read64(rvu, blkaddr, NIX_AF_RX_CHANX_CFG(chan));
|
||||
rvu_write64(rvu, blkaddr, NIX_AF_RX_CHANX_CFG(chan),
|
||||
chan_v = nix_get_channel(chan, cpt_link);
|
||||
cfg = rvu_read64(rvu, blkaddr, NIX_AF_RX_CHANX_CFG(chan_v));
|
||||
rvu_write64(rvu, blkaddr, NIX_AF_RX_CHANX_CFG(chan_v),
|
||||
cfg & ~BIT_ULL(16));
|
||||
|
||||
if (type == NIX_INTF_TYPE_LBK) {
|
||||
|
|
@ -617,6 +630,20 @@ int rvu_mbox_handler_nix_bp_disable(struct rvu *rvu,
|
|||
return 0;
|
||||
}
|
||||
|
||||
int rvu_mbox_handler_nix_bp_disable(struct rvu *rvu,
|
||||
struct nix_bp_cfg_req *req,
|
||||
struct msg_rsp *rsp)
|
||||
{
|
||||
return nix_bp_disable(rvu, req, rsp, false);
|
||||
}
|
||||
|
||||
int rvu_mbox_handler_nix_cpt_bp_disable(struct rvu *rvu,
|
||||
struct nix_bp_cfg_req *req,
|
||||
struct msg_rsp *rsp)
|
||||
{
|
||||
return nix_bp_disable(rvu, req, rsp, true);
|
||||
}
|
||||
|
||||
static int rvu_nix_get_bpid(struct rvu *rvu, struct nix_bp_cfg_req *req,
|
||||
int type, int chan_id)
|
||||
{
|
||||
|
|
@ -696,15 +723,17 @@ static int rvu_nix_get_bpid(struct rvu *rvu, struct nix_bp_cfg_req *req,
|
|||
return bpid;
|
||||
}
|
||||
|
||||
int rvu_mbox_handler_nix_bp_enable(struct rvu *rvu,
|
||||
struct nix_bp_cfg_req *req,
|
||||
struct nix_bp_cfg_rsp *rsp)
|
||||
static int nix_bp_enable(struct rvu *rvu,
|
||||
struct nix_bp_cfg_req *req,
|
||||
struct nix_bp_cfg_rsp *rsp,
|
||||
bool cpt_link)
|
||||
{
|
||||
int blkaddr, pf, type, chan_id = 0;
|
||||
u16 pcifunc = req->hdr.pcifunc;
|
||||
struct rvu_pfvf *pfvf;
|
||||
u16 chan_base, chan;
|
||||
s16 bpid, bpid_base;
|
||||
u16 chan_v;
|
||||
u64 cfg;
|
||||
|
||||
pf = rvu_get_pf(pcifunc);
|
||||
|
|
@ -717,6 +746,9 @@ int rvu_mbox_handler_nix_bp_enable(struct rvu *rvu,
|
|||
type != NIX_INTF_TYPE_SDP)
|
||||
return 0;
|
||||
|
||||
if (cpt_link && !rvu->hw->cpt_links)
|
||||
return 0;
|
||||
|
||||
pfvf = rvu_get_pfvf(rvu, pcifunc);
|
||||
blkaddr = rvu_get_blkaddr(rvu, BLKTYPE_NIX, pcifunc);
|
||||
|
||||
|
|
@ -730,9 +762,11 @@ int rvu_mbox_handler_nix_bp_enable(struct rvu *rvu,
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
cfg = rvu_read64(rvu, blkaddr, NIX_AF_RX_CHANX_CFG(chan));
|
||||
chan_v = nix_get_channel(chan, cpt_link);
|
||||
|
||||
cfg = rvu_read64(rvu, blkaddr, NIX_AF_RX_CHANX_CFG(chan_v));
|
||||
cfg &= ~GENMASK_ULL(8, 0);
|
||||
rvu_write64(rvu, blkaddr, NIX_AF_RX_CHANX_CFG(chan),
|
||||
rvu_write64(rvu, blkaddr, NIX_AF_RX_CHANX_CFG(chan_v),
|
||||
cfg | (bpid & GENMASK_ULL(8, 0)) | BIT_ULL(16));
|
||||
chan_id++;
|
||||
bpid = rvu_nix_get_bpid(rvu, req, type, chan_id);
|
||||
|
|
@ -750,6 +784,20 @@ int rvu_mbox_handler_nix_bp_enable(struct rvu *rvu,
|
|||
return 0;
|
||||
}
|
||||
|
||||
int rvu_mbox_handler_nix_bp_enable(struct rvu *rvu,
|
||||
struct nix_bp_cfg_req *req,
|
||||
struct nix_bp_cfg_rsp *rsp)
|
||||
{
|
||||
return nix_bp_enable(rvu, req, rsp, false);
|
||||
}
|
||||
|
||||
int rvu_mbox_handler_nix_cpt_bp_enable(struct rvu *rvu,
|
||||
struct nix_bp_cfg_req *req,
|
||||
struct nix_bp_cfg_rsp *rsp)
|
||||
{
|
||||
return nix_bp_enable(rvu, req, rsp, true);
|
||||
}
|
||||
|
||||
static void nix_setup_lso_tso_l3(struct rvu *rvu, int blkaddr,
|
||||
u64 format, bool v4, u64 *fidx)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -15,5 +15,6 @@ rvu_rep-y := rep.o
|
|||
|
||||
rvu_nicpf-$(CONFIG_DCB) += otx2_dcbnl.o
|
||||
rvu_nicpf-$(CONFIG_MACSEC) += cn10k_macsec.o
|
||||
rvu_nicpf-$(CONFIG_XFRM_OFFLOAD) += cn10k_ipsec.o
|
||||
|
||||
ccflags-y += -I$(srctree)/drivers/net/ethernet/marvell/octeontx2/af
|
||||
|
|
|
|||
1058
drivers/net/ethernet/marvell/octeontx2/nic/cn10k_ipsec.c
Normal file
1058
drivers/net/ethernet/marvell/octeontx2/nic/cn10k_ipsec.c
Normal file
File diff suppressed because it is too large
Load Diff
265
drivers/net/ethernet/marvell/octeontx2/nic/cn10k_ipsec.h
Normal file
265
drivers/net/ethernet/marvell/octeontx2/nic/cn10k_ipsec.h
Normal file
|
|
@ -0,0 +1,265 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
/* Marvell IPSEC offload driver
|
||||
*
|
||||
* Copyright (C) 2024 Marvell.
|
||||
*/
|
||||
|
||||
#ifndef CN10K_IPSEC_H
|
||||
#define CN10K_IPSEC_H
|
||||
|
||||
#include <linux/types.h>
|
||||
|
||||
DECLARE_STATIC_KEY_FALSE(cn10k_ipsec_sa_enabled);
|
||||
|
||||
/* CPT instruction size in bytes */
|
||||
#define CN10K_CPT_INST_SIZE 64
|
||||
|
||||
/* CPT instruction (CPT_INST_S) queue length */
|
||||
#define CN10K_CPT_INST_QLEN 8200
|
||||
|
||||
/* CPT instruction queue size passed to HW is in units of
|
||||
* 40*CPT_INST_S messages.
|
||||
*/
|
||||
#define CN10K_CPT_SIZE_DIV40 (CN10K_CPT_INST_QLEN / 40)
|
||||
|
||||
/* CPT needs 320 free entries */
|
||||
#define CN10K_CPT_INST_QLEN_EXTRA_BYTES (320 * CN10K_CPT_INST_SIZE)
|
||||
#define CN10K_CPT_EXTRA_SIZE_DIV40 (320 / 40)
|
||||
|
||||
/* CPT instruction queue length in bytes */
|
||||
#define CN10K_CPT_INST_QLEN_BYTES \
|
||||
((CN10K_CPT_SIZE_DIV40 * 40 * CN10K_CPT_INST_SIZE) + \
|
||||
CN10K_CPT_INST_QLEN_EXTRA_BYTES)
|
||||
|
||||
/* CPT instruction group queue length in bytes */
|
||||
#define CN10K_CPT_INST_GRP_QLEN_BYTES \
|
||||
((CN10K_CPT_SIZE_DIV40 + CN10K_CPT_EXTRA_SIZE_DIV40) * 16)
|
||||
|
||||
/* CPT FC length in bytes */
|
||||
#define CN10K_CPT_Q_FC_LEN 128
|
||||
|
||||
/* Default CPT engine group for ipsec offload */
|
||||
#define CN10K_DEF_CPT_IPSEC_EGRP 1
|
||||
|
||||
/* CN10K CPT LF registers */
|
||||
#define CPT_LFBASE (BLKTYPE_CPT << RVU_FUNC_BLKADDR_SHIFT)
|
||||
#define CN10K_CPT_LF_CTL (CPT_LFBASE | 0x10)
|
||||
#define CN10K_CPT_LF_INPROG (CPT_LFBASE | 0x40)
|
||||
#define CN10K_CPT_LF_Q_BASE (CPT_LFBASE | 0xf0)
|
||||
#define CN10K_CPT_LF_Q_SIZE (CPT_LFBASE | 0x100)
|
||||
#define CN10K_CPT_LF_Q_INST_PTR (CPT_LFBASE | 0x110)
|
||||
#define CN10K_CPT_LF_Q_GRP_PTR (CPT_LFBASE | 0x120)
|
||||
#define CN10K_CPT_LF_NQX(a) (CPT_LFBASE | 0x400 | (a) << 3)
|
||||
#define CN10K_CPT_LF_CTX_FLUSH (CPT_LFBASE | 0x510)
|
||||
|
||||
/* IPSEC Instruction opcodes */
|
||||
#define CN10K_IPSEC_MAJOR_OP_WRITE_SA 0x01UL
|
||||
#define CN10K_IPSEC_MINOR_OP_WRITE_SA 0x09UL
|
||||
#define CN10K_IPSEC_MAJOR_OP_OUTB_IPSEC 0x2AUL
|
||||
|
||||
enum cn10k_cpt_comp_e {
|
||||
CN10K_CPT_COMP_E_NOTDONE = 0x00,
|
||||
CN10K_CPT_COMP_E_GOOD = 0x01,
|
||||
CN10K_CPT_COMP_E_FAULT = 0x02,
|
||||
CN10K_CPT_COMP_E_HWERR = 0x04,
|
||||
CN10K_CPT_COMP_E_INSTERR = 0x05,
|
||||
CN10K_CPT_COMP_E_WARN = 0x06,
|
||||
CN10K_CPT_COMP_E_MASK = 0x3F
|
||||
};
|
||||
|
||||
struct cn10k_cpt_inst_queue {
|
||||
u8 *vaddr;
|
||||
u8 *real_vaddr;
|
||||
dma_addr_t dma_addr;
|
||||
dma_addr_t real_dma_addr;
|
||||
u32 size;
|
||||
};
|
||||
|
||||
enum cn10k_cpt_hw_state_e {
|
||||
CN10K_CPT_HW_UNAVAILABLE,
|
||||
CN10K_CPT_HW_AVAILABLE,
|
||||
CN10K_CPT_HW_IN_USE
|
||||
};
|
||||
|
||||
struct cn10k_ipsec {
|
||||
/* Outbound CPT */
|
||||
u64 io_addr;
|
||||
atomic_t cpt_state;
|
||||
struct cn10k_cpt_inst_queue iq;
|
||||
|
||||
/* SA info */
|
||||
u32 sa_size;
|
||||
u32 outb_sa_count;
|
||||
struct work_struct sa_work;
|
||||
struct workqueue_struct *sa_workq;
|
||||
};
|
||||
|
||||
/* CN10K IPSEC Security Association (SA) */
|
||||
/* SA direction */
|
||||
#define CN10K_IPSEC_SA_DIR_INB 0
|
||||
#define CN10K_IPSEC_SA_DIR_OUTB 1
|
||||
/* SA protocol */
|
||||
#define CN10K_IPSEC_SA_IPSEC_PROTO_AH 0
|
||||
#define CN10K_IPSEC_SA_IPSEC_PROTO_ESP 1
|
||||
/* SA Encryption Type */
|
||||
#define CN10K_IPSEC_SA_ENCAP_TYPE_AES_GCM 5
|
||||
/* SA IPSEC mode Transport/Tunnel */
|
||||
#define CN10K_IPSEC_SA_IPSEC_MODE_TRANSPORT 0
|
||||
#define CN10K_IPSEC_SA_IPSEC_MODE_TUNNEL 1
|
||||
/* SA AES Key Length */
|
||||
#define CN10K_IPSEC_SA_AES_KEY_LEN_128 1
|
||||
#define CN10K_IPSEC_SA_AES_KEY_LEN_192 2
|
||||
#define CN10K_IPSEC_SA_AES_KEY_LEN_256 3
|
||||
/* IV Source */
|
||||
#define CN10K_IPSEC_SA_IV_SRC_COUNTER 0
|
||||
#define CN10K_IPSEC_SA_IV_SRC_PACKET 3
|
||||
|
||||
struct cn10k_tx_sa_s {
|
||||
u64 esn_en : 1; /* W0 */
|
||||
u64 rsvd_w0_1_8 : 8;
|
||||
u64 hw_ctx_off : 7;
|
||||
u64 ctx_id : 16;
|
||||
u64 rsvd_w0_32_47 : 16;
|
||||
u64 ctx_push_size : 7;
|
||||
u64 rsvd_w0_55 : 1;
|
||||
u64 ctx_hdr_size : 2;
|
||||
u64 aop_valid : 1;
|
||||
u64 rsvd_w0_59 : 1;
|
||||
u64 ctx_size : 4;
|
||||
u64 w1; /* W1 */
|
||||
u64 sa_valid : 1; /* W2 */
|
||||
u64 sa_dir : 1;
|
||||
u64 rsvd_w2_2_3 : 2;
|
||||
u64 ipsec_mode : 1;
|
||||
u64 ipsec_protocol : 1;
|
||||
u64 aes_key_len : 2;
|
||||
u64 enc_type : 3;
|
||||
u64 rsvd_w2_11_19 : 9;
|
||||
u64 iv_src : 2;
|
||||
u64 rsvd_w2_22_31 : 10;
|
||||
u64 rsvd_w2_32_63 : 32;
|
||||
u64 w3; /* W3 */
|
||||
u8 cipher_key[32]; /* W4 - W7 */
|
||||
u32 rsvd_w8_0_31; /* W8 : IV */
|
||||
u32 iv_gcm_salt;
|
||||
u64 rsvd_w9_w30[22]; /* W9 - W30 */
|
||||
u64 hw_ctx[6]; /* W31 - W36 */
|
||||
};
|
||||
|
||||
/* CPT instruction parameter-1 */
|
||||
#define CN10K_IPSEC_INST_PARAM1_DIS_L4_CSUM 0x1
|
||||
#define CN10K_IPSEC_INST_PARAM1_DIS_L3_CSUM 0x2
|
||||
#define CN10K_IPSEC_INST_PARAM1_CRYPTO_MODE 0x20
|
||||
#define CN10K_IPSEC_INST_PARAM1_IV_OFFSET_SHIFT 8
|
||||
|
||||
/* CPT instruction parameter-2 */
|
||||
#define CN10K_IPSEC_INST_PARAM2_ENC_DATA_OFFSET_SHIFT 0
|
||||
#define CN10K_IPSEC_INST_PARAM2_AUTH_DATA_OFFSET_SHIFT 8
|
||||
|
||||
/* CPT Instruction Structure */
|
||||
struct cpt_inst_s {
|
||||
u64 nixtxl : 3; /* W0 */
|
||||
u64 doneint : 1;
|
||||
u64 rsvd_w0_4_15 : 12;
|
||||
u64 dat_offset : 8;
|
||||
u64 ext_param1 : 8;
|
||||
u64 nixtx_offset : 20;
|
||||
u64 rsvd_w0_52_63 : 12;
|
||||
u64 res_addr; /* W1 */
|
||||
u64 tag : 32; /* W2 */
|
||||
u64 tt : 2;
|
||||
u64 grp : 10;
|
||||
u64 rsvd_w2_44_47 : 4;
|
||||
u64 rvu_pf_func : 16;
|
||||
u64 qord : 1; /* W3 */
|
||||
u64 rsvd_w3_1_2 : 2;
|
||||
u64 wqe_ptr : 61;
|
||||
u64 dlen : 16; /* W4 */
|
||||
u64 param2 : 16;
|
||||
u64 param1 : 16;
|
||||
u64 opcode_major : 8;
|
||||
u64 opcode_minor : 8;
|
||||
u64 dptr; /* W5 */
|
||||
u64 rptr; /* W6 */
|
||||
u64 cptr : 60; /* W7 */
|
||||
u64 ctx_val : 1;
|
||||
u64 egrp : 3;
|
||||
};
|
||||
|
||||
/* CPT Instruction Result Structure */
|
||||
struct cpt_res_s {
|
||||
u64 compcode : 7; /* W0 */
|
||||
u64 doneint : 1;
|
||||
u64 uc_compcode : 8;
|
||||
u64 uc_info : 48;
|
||||
u64 esn; /* W1 */
|
||||
};
|
||||
|
||||
/* CPT SG structure */
|
||||
struct cpt_sg_s {
|
||||
u64 seg1_size : 16;
|
||||
u64 seg2_size : 16;
|
||||
u64 seg3_size : 16;
|
||||
u64 segs : 2;
|
||||
u64 rsvd_63_50 : 14;
|
||||
};
|
||||
|
||||
/* CPT LF_INPROG Register */
|
||||
#define CPT_LF_INPROG_INFLIGHT GENMASK_ULL(8, 0)
|
||||
#define CPT_LF_INPROG_GRB_CNT GENMASK_ULL(39, 32)
|
||||
#define CPT_LF_INPROG_GWB_CNT GENMASK_ULL(47, 40)
|
||||
|
||||
/* CPT LF_Q_GRP_PTR Register */
|
||||
#define CPT_LF_Q_GRP_PTR_DQ_PTR GENMASK_ULL(14, 0)
|
||||
#define CPT_LF_Q_GRP_PTR_NQ_PTR GENMASK_ULL(46, 32)
|
||||
|
||||
/* CPT LF_Q_SIZE Register */
|
||||
#define CPT_LF_Q_BASE_ADDR GENMASK_ULL(52, 7)
|
||||
|
||||
/* CPT LF_Q_SIZE Register */
|
||||
#define CPT_LF_Q_SIZE_DIV40 GENMASK_ULL(14, 0)
|
||||
|
||||
/* CPT LF CTX Flush Register */
|
||||
#define CPT_LF_CTX_FLUSH GENMASK_ULL(45, 0)
|
||||
|
||||
#ifdef CONFIG_XFRM_OFFLOAD
|
||||
int cn10k_ipsec_init(struct net_device *netdev);
|
||||
void cn10k_ipsec_clean(struct otx2_nic *pf);
|
||||
int cn10k_ipsec_ethtool_init(struct net_device *netdev, bool enable);
|
||||
bool otx2_sqe_add_sg_ipsec(struct otx2_nic *pfvf, struct otx2_snd_queue *sq,
|
||||
struct sk_buff *skb, int num_segs, int *offset);
|
||||
bool cn10k_ipsec_transmit(struct otx2_nic *pf, struct netdev_queue *txq,
|
||||
struct otx2_snd_queue *sq, struct sk_buff *skb,
|
||||
int num_segs, int size);
|
||||
#else
|
||||
static inline __maybe_unused int cn10k_ipsec_init(struct net_device *netdev)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline __maybe_unused void cn10k_ipsec_clean(struct otx2_nic *pf)
|
||||
{
|
||||
}
|
||||
|
||||
static inline __maybe_unused
|
||||
int cn10k_ipsec_ethtool_init(struct net_device *netdev, bool enable)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline bool __maybe_unused
|
||||
otx2_sqe_add_sg_ipsec(struct otx2_nic *pfvf, struct otx2_snd_queue *sq,
|
||||
struct sk_buff *skb, int num_segs, int *offset)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
static inline bool __maybe_unused
|
||||
cn10k_ipsec_transmit(struct otx2_nic *pf, struct netdev_queue *txq,
|
||||
struct otx2_snd_queue *sq, struct sk_buff *skb,
|
||||
int num_segs, int size)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
#endif // CN10K_IPSEC_H
|
||||
|
|
@ -10,12 +10,18 @@
|
|||
#include <net/page_pool/helpers.h>
|
||||
#include <net/tso.h>
|
||||
#include <linux/bitfield.h>
|
||||
#include <net/xfrm.h>
|
||||
|
||||
#include "otx2_reg.h"
|
||||
#include "otx2_common.h"
|
||||
#include "otx2_struct.h"
|
||||
#include "cn10k.h"
|
||||
|
||||
static bool otx2_is_pfc_enabled(struct otx2_nic *pfvf)
|
||||
{
|
||||
return IS_ENABLED(CONFIG_DCB) && !!pfvf->pfc_en;
|
||||
}
|
||||
|
||||
static void otx2_nix_rq_op_stats(struct queue_stats *stats,
|
||||
struct otx2_nic *pfvf, int qidx)
|
||||
{
|
||||
|
|
@ -964,6 +970,29 @@ int otx2_sq_init(struct otx2_nic *pfvf, u16 qidx, u16 sqb_aura)
|
|||
if (err)
|
||||
return err;
|
||||
|
||||
/* Allocate memory for NIX SQE (which includes NIX SG) and CPT SG.
|
||||
* SG of NIX and CPT are same in size. Allocate memory for CPT SG
|
||||
* same as NIX SQE for base address alignment.
|
||||
* Layout of a NIX SQE and CPT SG entry:
|
||||
* -----------------------------
|
||||
* | CPT Scatter Gather |
|
||||
* | (SQE SIZE) |
|
||||
* | |
|
||||
* -----------------------------
|
||||
* | NIX SQE |
|
||||
* | (SQE SIZE) |
|
||||
* | |
|
||||
* -----------------------------
|
||||
*/
|
||||
err = qmem_alloc(pfvf->dev, &sq->sqe_ring, qset->sqe_cnt,
|
||||
sq->sqe_size * 2);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
err = qmem_alloc(pfvf->dev, &sq->cpt_resp, qset->sqe_cnt, 64);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
if (qidx < pfvf->hw.tx_queues) {
|
||||
err = qmem_alloc(pfvf->dev, &sq->tso_hdrs, qset->sqe_cnt,
|
||||
TSO_HEADER_SIZE);
|
||||
|
|
@ -1722,18 +1751,43 @@ int otx2_nix_config_bp(struct otx2_nic *pfvf, bool enable)
|
|||
return -ENOMEM;
|
||||
|
||||
req->chan_base = 0;
|
||||
#ifdef CONFIG_DCB
|
||||
req->chan_cnt = pfvf->pfc_en ? IEEE_8021QAZ_MAX_TCS : 1;
|
||||
req->bpid_per_chan = pfvf->pfc_en ? 1 : 0;
|
||||
#else
|
||||
req->chan_cnt = 1;
|
||||
req->bpid_per_chan = 0;
|
||||
#endif
|
||||
if (otx2_is_pfc_enabled(pfvf)) {
|
||||
req->chan_cnt = IEEE_8021QAZ_MAX_TCS;
|
||||
req->bpid_per_chan = 1;
|
||||
} else {
|
||||
req->chan_cnt = 1;
|
||||
req->bpid_per_chan = 0;
|
||||
}
|
||||
|
||||
return otx2_sync_mbox_msg(&pfvf->mbox);
|
||||
}
|
||||
EXPORT_SYMBOL(otx2_nix_config_bp);
|
||||
|
||||
int otx2_nix_cpt_config_bp(struct otx2_nic *pfvf, bool enable)
|
||||
{
|
||||
struct nix_bp_cfg_req *req;
|
||||
|
||||
if (enable)
|
||||
req = otx2_mbox_alloc_msg_nix_cpt_bp_enable(&pfvf->mbox);
|
||||
else
|
||||
req = otx2_mbox_alloc_msg_nix_cpt_bp_disable(&pfvf->mbox);
|
||||
|
||||
if (!req)
|
||||
return -ENOMEM;
|
||||
|
||||
req->chan_base = 0;
|
||||
if (otx2_is_pfc_enabled(pfvf)) {
|
||||
req->chan_cnt = IEEE_8021QAZ_MAX_TCS;
|
||||
req->bpid_per_chan = 1;
|
||||
} else {
|
||||
req->chan_cnt = 1;
|
||||
req->bpid_per_chan = 0;
|
||||
}
|
||||
|
||||
return otx2_sync_mbox_msg(&pfvf->mbox);
|
||||
}
|
||||
EXPORT_SYMBOL(otx2_nix_cpt_config_bp);
|
||||
|
||||
/* Mbox message handlers */
|
||||
void mbox_handler_cgx_stats(struct otx2_nic *pfvf,
|
||||
struct cgx_stats_rsp *rsp)
|
||||
|
|
@ -1947,3 +2001,48 @@ EXPORT_SYMBOL(otx2_mbox_up_handler_ ## _fn_name);
|
|||
MBOX_UP_CGX_MESSAGES
|
||||
MBOX_UP_MCS_MESSAGES
|
||||
#undef M
|
||||
|
||||
dma_addr_t otx2_dma_map_skb_frag(struct otx2_nic *pfvf,
|
||||
struct sk_buff *skb, int seg, int *len)
|
||||
{
|
||||
enum dma_data_direction dir = DMA_TO_DEVICE;
|
||||
const skb_frag_t *frag;
|
||||
struct page *page;
|
||||
int offset;
|
||||
|
||||
/* Crypto hardware need write permission for ipsec crypto offload */
|
||||
if (unlikely(xfrm_offload(skb))) {
|
||||
dir = DMA_BIDIRECTIONAL;
|
||||
skb = skb_unshare(skb, GFP_ATOMIC);
|
||||
}
|
||||
|
||||
/* First segment is always skb->data */
|
||||
if (!seg) {
|
||||
page = virt_to_page(skb->data);
|
||||
offset = offset_in_page(skb->data);
|
||||
*len = skb_headlen(skb);
|
||||
} else {
|
||||
frag = &skb_shinfo(skb)->frags[seg - 1];
|
||||
page = skb_frag_page(frag);
|
||||
offset = skb_frag_off(frag);
|
||||
*len = skb_frag_size(frag);
|
||||
}
|
||||
return otx2_dma_map_page(pfvf, page, offset, *len, dir);
|
||||
}
|
||||
|
||||
void otx2_dma_unmap_skb_frags(struct otx2_nic *pfvf, struct sg_list *sg)
|
||||
{
|
||||
enum dma_data_direction dir = DMA_TO_DEVICE;
|
||||
struct sk_buff *skb = NULL;
|
||||
int seg;
|
||||
|
||||
skb = (struct sk_buff *)sg->skb;
|
||||
if (unlikely(xfrm_offload(skb)))
|
||||
dir = DMA_BIDIRECTIONAL;
|
||||
|
||||
for (seg = 0; seg < sg->num_segs; seg++) {
|
||||
otx2_dma_unmap_page(pfvf, sg->dma_addr[seg],
|
||||
sg->size[seg], dir);
|
||||
}
|
||||
sg->num_segs = 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@
|
|||
#include <rvu_trace.h>
|
||||
#include "qos.h"
|
||||
#include "rep.h"
|
||||
#include "cn10k_ipsec.h"
|
||||
|
||||
/* IPv4 flag more fragment bit */
|
||||
#define IPV4_FLAG_MORE 0x20
|
||||
|
|
@ -40,6 +41,7 @@
|
|||
#define PCI_DEVID_OCTEONTX2_RVU_AFVF 0xA0F8
|
||||
|
||||
#define PCI_SUBSYS_DEVID_96XX_RVU_PFVF 0xB200
|
||||
#define PCI_SUBSYS_DEVID_CN10K_A_RVU_PFVF 0xB900
|
||||
#define PCI_SUBSYS_DEVID_CN10K_B_RVU_PFVF 0xBD00
|
||||
|
||||
#define PCI_DEVID_OCTEONTX2_SDP_REP 0xA0F7
|
||||
|
|
@ -55,6 +57,9 @@
|
|||
#define NIX_PF_PFC_PRIO_MAX 8
|
||||
#endif
|
||||
|
||||
/* Number of segments per SG structure */
|
||||
#define MAX_SEGS_PER_SG 3
|
||||
|
||||
enum arua_mapped_qtypes {
|
||||
AURA_NIX_RQ,
|
||||
AURA_NIX_SQ,
|
||||
|
|
@ -448,6 +453,7 @@ struct otx2_nic {
|
|||
#define OTX2_FLAG_TC_MARK_ENABLED BIT_ULL(17)
|
||||
#define OTX2_FLAG_REP_MODE_ENABLED BIT_ULL(18)
|
||||
#define OTX2_FLAG_PORT_UP BIT_ULL(19)
|
||||
#define OTX2_FLAG_IPSEC_OFFLOAD_ENABLED BIT_ULL(20)
|
||||
u64 flags;
|
||||
u64 *cq_op_addr;
|
||||
|
||||
|
|
@ -522,6 +528,9 @@ struct otx2_nic {
|
|||
u16 rep_pf_map[RVU_MAX_REP];
|
||||
u16 esw_mode;
|
||||
#endif
|
||||
|
||||
/* Inline ipsec */
|
||||
struct cn10k_ipsec ipsec;
|
||||
};
|
||||
|
||||
static inline bool is_otx2_lbkvf(struct pci_dev *pdev)
|
||||
|
|
@ -572,6 +581,15 @@ static inline bool is_dev_cn10kb(struct pci_dev *pdev)
|
|||
return pdev->subsystem_device == PCI_SUBSYS_DEVID_CN10K_B_RVU_PFVF;
|
||||
}
|
||||
|
||||
static inline bool is_dev_cn10ka_b0(struct pci_dev *pdev)
|
||||
{
|
||||
if (pdev->subsystem_device == PCI_SUBSYS_DEVID_CN10K_A_RVU_PFVF &&
|
||||
(pdev->revision & 0xFF) == 0x54)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static inline void otx2_setup_dev_hw_settings(struct otx2_nic *pfvf)
|
||||
{
|
||||
struct otx2_hw *hw = &pfvf->hw;
|
||||
|
|
@ -621,6 +639,9 @@ static inline void __iomem *otx2_get_regaddr(struct otx2_nic *nic, u64 offset)
|
|||
case BLKTYPE_NPA:
|
||||
blkaddr = BLKADDR_NPA;
|
||||
break;
|
||||
case BLKTYPE_CPT:
|
||||
blkaddr = BLKADDR_CPT0;
|
||||
break;
|
||||
default:
|
||||
blkaddr = BLKADDR_RVUM;
|
||||
break;
|
||||
|
|
@ -985,6 +1006,7 @@ int otx2_alloc_rbuf(struct otx2_nic *pfvf, struct otx2_pool *pool,
|
|||
int otx2_rxtx_enable(struct otx2_nic *pfvf, bool enable);
|
||||
void otx2_ctx_disable(struct mbox *mbox, int type, bool npa);
|
||||
int otx2_nix_config_bp(struct otx2_nic *pfvf, bool enable);
|
||||
int otx2_nix_cpt_config_bp(struct otx2_nic *pfvf, bool enable);
|
||||
void otx2_cleanup_rx_cqes(struct otx2_nic *pfvf, struct otx2_cq_queue *cq, int qidx);
|
||||
void otx2_cleanup_tx_cqes(struct otx2_nic *pfvf, struct otx2_cq_queue *cq);
|
||||
int otx2_sq_init(struct otx2_nic *pfvf, u16 qidx, u16 sqb_aura);
|
||||
|
|
@ -1149,4 +1171,8 @@ static inline int mcam_entry_cmp(const void *a, const void *b)
|
|||
{
|
||||
return *(u16 *)a - *(u16 *)b;
|
||||
}
|
||||
|
||||
dma_addr_t otx2_dma_map_skb_frag(struct otx2_nic *pfvf,
|
||||
struct sk_buff *skb, int seg, int *len);
|
||||
void otx2_dma_unmap_skb_frags(struct otx2_nic *pfvf, struct sg_list *sg);
|
||||
#endif /* OTX2_COMMON_H */
|
||||
|
|
|
|||
|
|
@ -435,6 +435,9 @@ static int otx2_dcbnl_ieee_setpfc(struct net_device *dev, struct ieee_pfc *pfc)
|
|||
return err;
|
||||
}
|
||||
|
||||
/* Default disable backpressure on NIX-CPT */
|
||||
otx2_nix_cpt_config_bp(pfvf, false);
|
||||
|
||||
/* Request Per channel Bpids */
|
||||
if (pfc->pfc_en)
|
||||
otx2_nix_config_bp(pfvf, true);
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@
|
|||
#include "cn10k.h"
|
||||
#include "qos.h"
|
||||
#include <rvu_trace.h>
|
||||
#include "cn10k_ipsec.h"
|
||||
|
||||
#define DRV_NAME "rvu_nicpf"
|
||||
#define DRV_STRING "Marvell RVU NIC Physical Function Driver"
|
||||
|
|
@ -1484,6 +1485,8 @@ static void otx2_free_sq_res(struct otx2_nic *pf)
|
|||
if (!sq->sqe)
|
||||
continue;
|
||||
qmem_free(pf->dev, sq->sqe);
|
||||
qmem_free(pf->dev, sq->sqe_ring);
|
||||
qmem_free(pf->dev, sq->cpt_resp);
|
||||
qmem_free(pf->dev, sq->tso_hdrs);
|
||||
kfree(sq->sg);
|
||||
kfree(sq->sqb_ptrs);
|
||||
|
|
@ -1551,6 +1554,9 @@ int otx2_init_hw_resources(struct otx2_nic *pf)
|
|||
if (err)
|
||||
goto err_free_npa_lf;
|
||||
|
||||
/* Default disable backpressure on NIX-CPT */
|
||||
otx2_nix_cpt_config_bp(pf, false);
|
||||
|
||||
/* Enable backpressure for CGX mapped PF/VFs */
|
||||
if (!is_otx2_lbkvf(pf->pdev))
|
||||
otx2_nix_config_bp(pf, true);
|
||||
|
|
@ -2273,6 +2279,10 @@ static int otx2_set_features(struct net_device *netdev,
|
|||
return otx2_enable_rxvlan(pf,
|
||||
features & NETIF_F_HW_VLAN_CTAG_RX);
|
||||
|
||||
if (changed & NETIF_F_HW_ESP)
|
||||
return cn10k_ipsec_ethtool_init(netdev,
|
||||
features & NETIF_F_HW_ESP);
|
||||
|
||||
return otx2_handle_ntuple_tc_features(netdev, features);
|
||||
}
|
||||
|
||||
|
|
@ -3162,10 +3172,14 @@ static int otx2_probe(struct pci_dev *pdev, const struct pci_device_id *id)
|
|||
/* reset CGX/RPM MAC stats */
|
||||
otx2_reset_mac_stats(pf);
|
||||
|
||||
err = cn10k_ipsec_init(netdev);
|
||||
if (err)
|
||||
goto err_mcs_free;
|
||||
|
||||
err = register_netdev(netdev);
|
||||
if (err) {
|
||||
dev_err(dev, "Failed to register netdevice\n");
|
||||
goto err_mcs_free;
|
||||
goto err_ipsec_clean;
|
||||
}
|
||||
|
||||
err = otx2_wq_init(pf);
|
||||
|
|
@ -3206,6 +3220,8 @@ static int otx2_probe(struct pci_dev *pdev, const struct pci_device_id *id)
|
|||
otx2_mcam_flow_del(pf);
|
||||
err_unreg_netdev:
|
||||
unregister_netdev(netdev);
|
||||
err_ipsec_clean:
|
||||
cn10k_ipsec_clean(pf);
|
||||
err_mcs_free:
|
||||
cn10k_mcs_free(pf);
|
||||
err_del_mcam_entries:
|
||||
|
|
@ -3403,6 +3419,7 @@ static void otx2_remove(struct pci_dev *pdev)
|
|||
|
||||
otx2_unregister_dl(pf);
|
||||
unregister_netdev(netdev);
|
||||
cn10k_ipsec_clean(pf);
|
||||
cn10k_mcs_free(pf);
|
||||
otx2_sriov_disable(pf->pdev);
|
||||
otx2_sriov_vfcfg_cleanup(pf);
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@
|
|||
#include <linux/bpf.h>
|
||||
#include <linux/bpf_trace.h>
|
||||
#include <net/ip6_checksum.h>
|
||||
#include <net/xfrm.h>
|
||||
|
||||
#include "otx2_reg.h"
|
||||
#include "otx2_common.h"
|
||||
|
|
@ -32,6 +33,17 @@ static bool otx2_xdp_rcv_pkt_handler(struct otx2_nic *pfvf,
|
|||
struct otx2_cq_queue *cq,
|
||||
bool *need_xdp_flush);
|
||||
|
||||
static void otx2_sq_set_sqe_base(struct otx2_snd_queue *sq,
|
||||
struct sk_buff *skb)
|
||||
{
|
||||
if (static_branch_unlikely(&cn10k_ipsec_sa_enabled) &&
|
||||
(xfrm_offload(skb)))
|
||||
sq->sqe_base = sq->sqe_ring->base + sq->sqe_size +
|
||||
(sq->head * (sq->sqe_size * 2));
|
||||
else
|
||||
sq->sqe_base = sq->sqe->base;
|
||||
}
|
||||
|
||||
static int otx2_nix_cq_op_status(struct otx2_nic *pfvf,
|
||||
struct otx2_cq_queue *cq)
|
||||
{
|
||||
|
|
@ -80,38 +92,6 @@ static unsigned int frag_num(unsigned int i)
|
|||
#endif
|
||||
}
|
||||
|
||||
static dma_addr_t otx2_dma_map_skb_frag(struct otx2_nic *pfvf,
|
||||
struct sk_buff *skb, int seg, int *len)
|
||||
{
|
||||
const skb_frag_t *frag;
|
||||
struct page *page;
|
||||
int offset;
|
||||
|
||||
/* First segment is always skb->data */
|
||||
if (!seg) {
|
||||
page = virt_to_page(skb->data);
|
||||
offset = offset_in_page(skb->data);
|
||||
*len = skb_headlen(skb);
|
||||
} else {
|
||||
frag = &skb_shinfo(skb)->frags[seg - 1];
|
||||
page = skb_frag_page(frag);
|
||||
offset = skb_frag_off(frag);
|
||||
*len = skb_frag_size(frag);
|
||||
}
|
||||
return otx2_dma_map_page(pfvf, page, offset, *len, DMA_TO_DEVICE);
|
||||
}
|
||||
|
||||
static void otx2_dma_unmap_skb_frags(struct otx2_nic *pfvf, struct sg_list *sg)
|
||||
{
|
||||
int seg;
|
||||
|
||||
for (seg = 0; seg < sg->num_segs; seg++) {
|
||||
otx2_dma_unmap_page(pfvf, sg->dma_addr[seg],
|
||||
sg->size[seg], DMA_TO_DEVICE);
|
||||
}
|
||||
sg->num_segs = 0;
|
||||
}
|
||||
|
||||
static void otx2_xdp_snd_pkt_handler(struct otx2_nic *pfvf,
|
||||
struct otx2_snd_queue *sq,
|
||||
struct nix_cqe_tx_s *cqe)
|
||||
|
|
@ -625,7 +605,6 @@ void otx2_sqe_flush(void *dev, struct otx2_snd_queue *sq,
|
|||
sq->head &= (sq->sqe_cnt - 1);
|
||||
}
|
||||
|
||||
#define MAX_SEGS_PER_SG 3
|
||||
/* Add SQE scatter/gather subdescriptor structure */
|
||||
static bool otx2_sqe_add_sg(struct otx2_nic *pfvf, struct otx2_snd_queue *sq,
|
||||
struct sk_buff *skb, int num_segs, int *offset)
|
||||
|
|
@ -1161,6 +1140,7 @@ bool otx2_sq_append_skb(void *dev, struct netdev_queue *txq,
|
|||
int offset, num_segs, free_desc;
|
||||
struct nix_sqe_hdr_s *sqe_hdr;
|
||||
struct otx2_nic *pfvf = dev;
|
||||
bool ret;
|
||||
|
||||
/* Check if there is enough room between producer
|
||||
* and consumer index.
|
||||
|
|
@ -1177,6 +1157,7 @@ bool otx2_sq_append_skb(void *dev, struct netdev_queue *txq,
|
|||
/* If SKB doesn't fit in a single SQE, linearize it.
|
||||
* TODO: Consider adding JUMP descriptor instead.
|
||||
*/
|
||||
|
||||
if (unlikely(num_segs > OTX2_MAX_FRAGS_IN_SQE)) {
|
||||
if (__skb_linearize(skb)) {
|
||||
dev_kfree_skb_any(skb);
|
||||
|
|
@ -1196,6 +1177,9 @@ bool otx2_sq_append_skb(void *dev, struct netdev_queue *txq,
|
|||
return true;
|
||||
}
|
||||
|
||||
/* Set sqe base address */
|
||||
otx2_sq_set_sqe_base(sq, skb);
|
||||
|
||||
/* Set SQE's SEND_HDR.
|
||||
* Do not clear the first 64bit as it contains constant info.
|
||||
*/
|
||||
|
|
@ -1208,7 +1192,13 @@ bool otx2_sq_append_skb(void *dev, struct netdev_queue *txq,
|
|||
otx2_sqe_add_ext(pfvf, sq, skb, &offset);
|
||||
|
||||
/* Add SG subdesc with data frags */
|
||||
if (!otx2_sqe_add_sg(pfvf, sq, skb, num_segs, &offset)) {
|
||||
if (static_branch_unlikely(&cn10k_ipsec_sa_enabled) &&
|
||||
(xfrm_offload(skb)))
|
||||
ret = otx2_sqe_add_sg_ipsec(pfvf, sq, skb, num_segs, &offset);
|
||||
else
|
||||
ret = otx2_sqe_add_sg(pfvf, sq, skb, num_segs, &offset);
|
||||
|
||||
if (!ret) {
|
||||
otx2_dma_unmap_skb_frags(pfvf, &sq->sg[sq->head]);
|
||||
return false;
|
||||
}
|
||||
|
|
@ -1217,11 +1207,15 @@ bool otx2_sq_append_skb(void *dev, struct netdev_queue *txq,
|
|||
|
||||
sqe_hdr->sizem1 = (offset / 16) - 1;
|
||||
|
||||
if (static_branch_unlikely(&cn10k_ipsec_sa_enabled) &&
|
||||
(xfrm_offload(skb)))
|
||||
return cn10k_ipsec_transmit(pfvf, txq, sq, skb, num_segs,
|
||||
offset);
|
||||
|
||||
netdev_tx_sent_queue(txq, skb->len);
|
||||
|
||||
/* Flush SQE to HW */
|
||||
pfvf->hw_ops->sqe_flush(pfvf, sq, offset, qidx);
|
||||
|
||||
return true;
|
||||
}
|
||||
EXPORT_SYMBOL(otx2_sq_append_skb);
|
||||
|
|
|
|||
|
|
@ -101,6 +101,9 @@ struct otx2_snd_queue {
|
|||
struct queue_stats stats;
|
||||
u16 sqb_count;
|
||||
u64 *sqb_ptrs;
|
||||
/* SQE ring and CPT response queue for Inline IPSEC */
|
||||
struct qmem *sqe_ring;
|
||||
struct qmem *cpt_resp;
|
||||
} ____cacheline_aligned_in_smp;
|
||||
|
||||
enum cq_type {
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@
|
|||
#include "otx2_reg.h"
|
||||
#include "otx2_ptp.h"
|
||||
#include "cn10k.h"
|
||||
#include "cn10k_ipsec.h"
|
||||
|
||||
#define DRV_NAME "rvu_nicvf"
|
||||
#define DRV_STRING "Marvell RVU NIC Virtual Function Driver"
|
||||
|
|
@ -693,10 +694,14 @@ static int otx2vf_probe(struct pci_dev *pdev, const struct pci_device_id *id)
|
|||
pdev->bus->number, n);
|
||||
}
|
||||
|
||||
err = cn10k_ipsec_init(netdev);
|
||||
if (err)
|
||||
goto err_ptp_destroy;
|
||||
|
||||
err = register_netdev(netdev);
|
||||
if (err) {
|
||||
dev_err(dev, "Failed to register netdevice\n");
|
||||
goto err_ptp_destroy;
|
||||
goto err_ipsec_clean;
|
||||
}
|
||||
|
||||
err = otx2_vf_wq_init(vf);
|
||||
|
|
@ -730,6 +735,8 @@ static int otx2vf_probe(struct pci_dev *pdev, const struct pci_device_id *id)
|
|||
otx2_shutdown_tc(vf);
|
||||
err_unreg_netdev:
|
||||
unregister_netdev(netdev);
|
||||
err_ipsec_clean:
|
||||
cn10k_ipsec_clean(vf);
|
||||
err_ptp_destroy:
|
||||
otx2_ptp_destroy(vf);
|
||||
err_detach_rsrc:
|
||||
|
|
@ -782,6 +789,7 @@ static void otx2vf_remove(struct pci_dev *pdev)
|
|||
unregister_netdev(netdev);
|
||||
if (vf->otx2_wq)
|
||||
destroy_workqueue(vf->otx2_wq);
|
||||
cn10k_ipsec_clean(vf);
|
||||
otx2_ptp_destroy(vf);
|
||||
otx2_mcam_flow_del(vf);
|
||||
otx2_shutdown_tc(vf);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user