netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jerin Jacob <jerinjacobk@gmail.com>
To: netdev@vger.kernel.org, davem@davemloft.net
Cc: sgoutham@marvell.com, lcherian@marvell.com, gakula@marvell.com,
	jerinj@marvell.com, Vidhya Raman <vraman@marvell.com>
Subject: [PATCH v1 net-next 12/14] octeontx2-af: Add L3 and L4 packet verification mailbox
Date: Sat,  1 Dec 2018 14:44:01 +0530	[thread overview]
Message-ID: <20181201091403.30166-13-jerinjacobk@gmail.com> (raw)
In-Reply-To: <20181201091403.30166-1-jerinjacobk@gmail.com>

From: Vidhya Raman <vraman@marvell.com>

Adds mailbox support for L4 checksum verification
and L3 and L4 length verification configuration.

Signed-off-by: Vidhya Raman <vraman@marvell.com>
Signed-off-by: Jerin Jacob <jerinj@marvell.com>
---
 .../net/ethernet/marvell/octeontx2/af/mbox.h  | 10 +++++
 .../net/ethernet/marvell/octeontx2/af/rvu.h   |  3 ++
 .../ethernet/marvell/octeontx2/af/rvu_nix.c   | 42 +++++++++++++++++++
 3 files changed, 55 insertions(+)

diff --git a/drivers/net/ethernet/marvell/octeontx2/af/mbox.h b/drivers/net/ethernet/marvell/octeontx2/af/mbox.h
index 723586740de6..a4c391fe5eb2 100644
--- a/drivers/net/ethernet/marvell/octeontx2/af/mbox.h
+++ b/drivers/net/ethernet/marvell/octeontx2/af/mbox.h
@@ -203,6 +203,7 @@ M(NIX_LF_STOP_RX,	0x800e, nix_lf_stop_rx, msg_req, msg_rsp)	\
 M(NIX_MARK_FORMAT_CFG,	0x800f, nix_mark_format_cfg,			\
 				 nix_mark_format_cfg,			\
 				 nix_mark_format_cfg_rsp)		\
+M(NIX_SET_RX_CFG,	0x8010, nix_set_rx_cfg, nix_rx_cfg, msg_rsp)	\
 M(NIX_RXVLAN_ALLOC,	0x8012, nix_rxvlan_alloc, msg_req, msg_rsp)
 
 /* Messages initiated by AF (range 0xC00 - 0xDFF) */
@@ -609,6 +610,15 @@ struct nix_rx_mode {
 	u16	mode;
 };
 
+struct nix_rx_cfg {
+	struct mbox_msghdr hdr;
+#define NIX_RX_OL3_VERIFY   BIT(0)
+#define NIX_RX_OL4_VERIFY   BIT(1)
+	u8 len_verify; /* Outer L3/L4 len check */
+#define NIX_RX_CSUM_OL4_VERIFY  BIT(0)
+	u8 csum_verify; /* Outer L4 checksum verification */
+};
+
 struct nix_frs_cfg {
 	struct mbox_msghdr hdr;
 	u8	update_smq;    /* Update SMQ's min/max lens */
diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu.h b/drivers/net/ethernet/marvell/octeontx2/af/rvu.h
index e976789e8a8e..a890d4ff867a 100644
--- a/drivers/net/ethernet/marvell/octeontx2/af/rvu.h
+++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu.h
@@ -433,6 +433,9 @@ int rvu_mbox_handler_nix_lf_stop_rx(struct rvu *rvu, struct msg_req *req,
 int rvu_mbox_handler_nix_mark_format_cfg(struct rvu *rvu,
 					 struct nix_mark_format_cfg  *req,
 					 struct nix_mark_format_cfg_rsp *rsp);
+int rvu_mbox_handler_nix_set_rx_cfg(struct rvu *rvu, struct nix_rx_cfg *req,
+				    struct msg_rsp *rsp);
+
 
 /* NPC APIs */
 int rvu_npc_init(struct rvu *rvu);
diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c
index 5baa427952bb..f80f39b046d8 100644
--- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c
+++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c
@@ -2503,6 +2503,48 @@ int rvu_mbox_handler_nix_rxvlan_alloc(struct rvu *rvu, struct msg_req *req,
 	return err;
 }
 
+int rvu_mbox_handler_nix_set_rx_cfg(struct rvu *rvu, struct nix_rx_cfg *req,
+				    struct msg_rsp *rsp)
+{
+	struct rvu_hwinfo *hw = rvu->hw;
+	u16 pcifunc = req->hdr.pcifunc;
+	struct rvu_block *block;
+	struct rvu_pfvf *pfvf;
+	int nixlf, blkaddr;
+	u64 cfg;
+
+	pfvf = rvu_get_pfvf(rvu, pcifunc);
+	blkaddr = rvu_get_blkaddr(rvu, BLKTYPE_NIX, pcifunc);
+	if (!pfvf->nixlf || blkaddr < 0)
+		return NIX_AF_ERR_AF_LF_INVALID;
+
+	block = &hw->block[blkaddr];
+	nixlf = rvu_get_lf(rvu, block, pcifunc, 0);
+	if (nixlf < 0)
+		return NIX_AF_ERR_AF_LF_INVALID;
+
+	cfg = rvu_read64(rvu, blkaddr, NIX_AF_LFX_RX_CFG(nixlf));
+	/* Set the interface configuration */
+	if (req->len_verify & BIT(0))
+		cfg |= BIT_ULL(41);
+	else
+		cfg &= ~BIT_ULL(41);
+
+	if (req->len_verify & BIT(1))
+		cfg |= BIT_ULL(40);
+	else
+		cfg &= ~BIT_ULL(40);
+
+	if (req->csum_verify & BIT(0))
+		cfg |= BIT_ULL(37);
+	else
+		cfg &= ~BIT_ULL(37);
+
+	rvu_write64(rvu, blkaddr, NIX_AF_LFX_RX_CFG(nixlf), cfg);
+
+	return 0;
+}
+
 static void nix_link_config(struct rvu *rvu, int blkaddr)
 {
 	struct rvu_hwinfo *hw = rvu->hw;
-- 
2.19.2

  parent reply	other threads:[~2018-12-01 20:28 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-01  9:13 [PATCH v1 net-next 00/14] octeontx2-af: NIX and NPC enhancements Jerin Jacob
2018-12-01  9:13 ` [PATCH v1 net-next 01/14] octeontx2-af: Skip NIXLF check for bcast MCE entry Jerin Jacob
2018-12-01  9:13 ` [PATCH v1 net-next 02/14] octeontx2-af: Add response for RSS flow key cfg message Jerin Jacob
2018-12-02  1:30   ` David Miller
2018-12-01  9:13 ` [PATCH v1 net-next 03/14] octeontx2-af: Add support for dynamic flow cfg to RSS field generation Jerin Jacob
2018-12-01  9:13 ` [PATCH v1 net-next 04/14] octeontx2-af: Add support for runtime RSS algo index reservation Jerin Jacob
2018-12-01  9:13 ` [PATCH v1 net-next 05/14] octeontx2-af: Restrict TL1 allocation and configuration Jerin Jacob
2018-12-02  1:31   ` David Miller
2018-12-01  9:13 ` [PATCH v1 net-next 06/14] octeontx2-af: Allow freeing single TLx Tx schedule queue Jerin Jacob
2018-12-01  9:13 ` [PATCH v1 net-next 07/14] octeontx2-af: Enable inner IPv4 checksum and its error code Jerin Jacob
2018-12-01  9:13 ` [PATCH v1 net-next 08/14] octeontx2-af: Define all NIX_AF_RX_DEF_* registers Jerin Jacob
2018-12-01  9:13 ` [PATCH v1 net-next 09/14] octeontx2-af: Enable RSS with promiscuous mode Jerin Jacob
2018-12-01  9:13 ` [PATCH v1 net-next 10/14] octeontx2-af: Add support for Tx packet marking Jerin Jacob
2018-12-01  9:14 ` [PATCH v1 net-next 11/14] octeontx2-af: Configure VLAN TPIDs Jerin Jacob
2018-12-01  9:14 ` Jerin Jacob [this message]
2018-12-01  9:14 ` [PATCH v1 net-next 13/14] octeontx2-af: Add LSO format configuration mailbox Jerin Jacob
2018-12-01  9:14 ` [PATCH v1 net-next 14/14] octeontx2-af: Enable mkex profile Jerin Jacob

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181201091403.30166-13-jerinjacobk@gmail.com \
    --to=jerinjacobk@gmail.com \
    --cc=davem@davemloft.net \
    --cc=gakula@marvell.com \
    --cc=jerinj@marvell.com \
    --cc=lcherian@marvell.com \
    --cc=netdev@vger.kernel.org \
    --cc=sgoutham@marvell.com \
    --cc=vraman@marvell.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).