octeontx2-af: NPC parser and NIX blocks initialization
v2 cover octeontx2-af: NPC parser and NIX blocks initialization
From: Sunil Goutham <[email protected]>
This patchset is a continuation to earlier submitted two patch series to add a new driver for Marvell's OcteonTX2 SOC's Resource virtualization unit (RVU) admin function driver.
1. octeontx2-af: Add RVU Admin Function driver
https://www.spinics.net/lists/netdev/msg528272.html
2. octeontx2-af: NPA and NIX blocks initialization
https://www.spinics.net/lists/netdev/msg529163.html
This patch series adds more NIX block configuration logic and additionally adds NPC block parser profile configuration. In brief below is what this series adds.
NIX block:
- Support for PF/VF to allocate/free transmit scheduler queues, maintenance and their configuration.
- Adds support for packet replication lists, only broadcast packets is covered for now.
- Defines few RSS flow algorithms for HW to distribute packets. This is not the hash algorithsm (i.e toeplitz or crc32), here SW defines what fields in packet should HW take and calculate the hash.
- Support for PF/VF to configure VTAG strip and capture capabilities.
- Reset NIXLF statastics.
NPC block:
This block has multiple parser engines which support packet parsing at multiple layers and generates a parse result which is further used to generate a key. Based on packet field offsets in the key, SW can install packet forwarding rules.
This patch series adds
- Initial parser profile to be programmed into parser engines.
- Default forwarding rules to forward packets to different logical interfaces having a NIXLF attached.
- Support for promiscuous and multicast modes.
Changes from v1:
1 Fixed kernel build failure when compiled with BIG_ENDIAN enabled.
- Reported by Kbuild test robot
2 Fixed a warning observed when kernel is built with -Wunused-but-set-variable
Geetha sowjanya (1):
octeontx2-af: Config pkind for CGX mapped PFs
Hao Zheng (1):
octeontx2-af: Add NPC KPU profile
Stanislaw Kardach (1):
octeontx2-af: Add LMAC channel info to NIXLF_ALLOC response
Sunil Goutham (12):
octeontx2-af: NIX Tx scheduler queues alloc/free
octeontx2-af: NIX Tx scheduler queue config support
octeontx2-af: Config NPC KPU engines with parser profile
octeontx2-af: Broadcast packet replication support
octeontx2-af: Update bcast list upon NIXLF alloc/free
octeontx2-af: Enable packet length and csum validation
octeontx2-af: NPC MCAM and LDATA extract minimal configuration
octeontx2-af: Install ucast and bcast pkt forwarding rules
octeontx2-af: NIX Rx flowkey configuration for RSS
octeontx2-af: Support for changing RSS algorithm
octeontx2-af: Support for setting MAC address
octeontx2-af: Support for NIXLF's UCAST/PROMISC/ALLMULTI modes
Vamsi Attunuru (2):
octeontx2-af: Reset NIXLF's Rx/Tx stats
octeontx2-af: Support for VTAG strip and capture
drivers/net/ethernet/marvell/octeontx2/af/Makefile | 3 +- drivers/net/ethernet/marvell/octeontx2/af/cgx.c | 12 + drivers/net/ethernet/marvell/octeontx2/af/cgx.h | 1 + drivers/net/ethernet/marvell/octeontx2/af/common.h | 50 + drivers/net/ethernet/marvell/octeontx2/af/mbox.h | 110 +- drivers/net/ethernet/marvell/octeontx2/af/npc.h | 262 + .../ethernet/marvell/octeontx2/af/npc_profile.h | 5709 ++++++++++++++++++++ drivers/net/ethernet/marvell/octeontx2/af/rvu.c | 12 +- drivers/net/ethernet/marvell/octeontx2/af/rvu.h | 97 +- .../net/ethernet/marvell/octeontx2/af/rvu_cgx.c | 7 +- .../net/ethernet/marvell/octeontx2/af/rvu_nix.c | 1067 ++++ .../net/ethernet/marvell/octeontx2/af/rvu_npc.c | 816 +++ .../net/ethernet/marvell/octeontx2/af/rvu_reg.c | 71 + .../net/ethernet/marvell/octeontx2/af/rvu_reg.h | 61 + .../net/ethernet/marvell/octeontx2/af/rvu_struct.h | 35 + 15 files changed, 8306 insertions(+), 7 deletions(-) create mode 100644 drivers/net/ethernet/marvell/octeontx2/af/npc.h create mode 100644 drivers/net/ethernet/marvell/octeontx2/af/npc_profile.h create mode 100644 drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c create mode 100644 drivers/net/ethernet/marvell/octeontx2/af/rvu_reg.c
Signature · 1 line
2.7.4
PATCH v2 1/17 octeontx2-af: NIX Tx scheduler queues alloc/free
From: Sunil Goutham <[email protected]>
Added support for a PF/VF to allocate or free NIX transmit scheduler queues via mbox. For setting up pkt transmission priorities between queues, the scheduler queues have to be contiguous w.r.t their HW indices. So both contiguous and non-contiguous allocations are supported.
Upon receiving NIX_TXSCH_FREE mbox msg all scheduler queues allocated to sending PFFUNC (PF/VF) will be freed. Selective free is not supported.
--- drivers/net/ethernet/marvell/octeontx2/af/mbox.h | 36 +++- drivers/net/ethernet/marvell/octeontx2/af/rvu.c | 4 +- drivers/net/ethernet/marvell/octeontx2/af/rvu.h | 9 +- .../net/ethernet/marvell/octeontx2/af/rvu_nix.c | 220 +++++++++++++++++++++ 4 files changed, 265 insertions(+), 4 deletions(-)
drivers/net/ethernet/marvell/octeontx2/af/mbox.h +35 -1
@@ -15,6 +15,7 @@#include <linux/sizes.h> #include "rvu_struct.h" +#include "common.h" #define MBOX_SIZE SZ_64K
@@ -151,7 +152,9 @@ M(NPA_HWCTX_DISABLE, 0x403, hwctx_disable_req, msg_rsp) \ M(NIX_LF_ALLOC, 0x8000, nix_lf_alloc_req, nix_lf_alloc_rsp) \ M(NIX_LF_FREE, 0x8001, msg_req, msg_rsp) \ M(NIX_AQ_ENQ, 0x8002, nix_aq_enq_req, nix_aq_enq_rsp) \ -M (NIX_HWCTX_DISABLE ,0x8003 , hwctx_disable_req, msg_rsp) +M(NIX_HWCTX_DISABLE, 0x8003, hwctx_disable_req, msg_rsp) \ +M(NIX_TXSCH_ALLOC, 0x8004, nix_txsch_alloc_req, nix_txsch_alloc_rsp) \ +M (NIX_TXSCH_FREE ,0x8005 , nix_txsch_free_req, msg_rsp) /* Messages initiated by AF (range 0xC00 - 0xDFF) */#define MBOX_UP_CGX_MESSAGES \
@@ -414,4 +417,35 @@ struct nix_aq_enq_rsp { }; }; +/* Tx scheduler/shaper mailbox messages */ + +#define MAX_TXSCHQ_PER_FUNC 128 + +struct nix_txsch_alloc_req { +struct mbox_msghdr hdr; +/* Scheduler queue count request at each level */ +u16 schq_contig[NIX_TXSCH_LVL_CNT ];/* No of contiguous queues */ +u16 schq[NIX_TXSCH_LVL_CNT ];/* No of non-contiguous queues */ +}; + +struct nix_txsch_alloc_rsp { +struct mbox_msghdr hdr; +/* Scheduler queue count allocated at each level */ +u16 schq_contig[NIX_TXSCH_LVL_CNT ]; +u16 schq[NIX_TXSCH_LVL_CNT ]; +/* Scheduler queue list allocated at each level */ +u16 schq_contig_list[NIX_TXSCH_LVL_CNT ][MAX_TXSCHQ_PER_FUNC ]; +u16 schq_list[NIX_TXSCH_LVL_CNT ][MAX_TXSCHQ_PER_FUNC ]; +}; + +struct nix_txsch_free_req { +struct mbox_msghdr hdr; +#define TXSCHQ_FREE_ALL BIT_ULL(0) +u16 flags; +/* Scheduler queue level to be freed */ +u16 schq_lvl; +/* List of scheduler queues to be freed */ +u16 schq; +}; +#endif /* MBOX_H */
drivers/net/ethernet/marvell/octeontx2/af/rvu.c +2 -2
@@ -80,7 +80,7 @@ int rvu_alloc_rsrc(struct rsrc_bmap *rsrc)return id; } -static int rvu_alloc_rsrc_contig (struct rsrc_bmap *rsrc,int nrsrc) +int rvu_alloc_rsrc_contig (struct rsrc_bmap *rsrc,int nrsrc) {int start;
@@ -105,7 +105,7 @@ static void rvu_free_rsrc_contig(struct rsrc_bmap *rsrc, int nrsrc, int start)bitmap_clear (rsrc->bmap, start, nrsrc); } -static bool rvu_rsrc_check_contig (struct rsrc_bmap *rsrc,int nrsrc) +bool rvu_rsrc_check_contig (struct rsrc_bmap *rsrc,int nrsrc) {int start;
drivers/net/ethernet/marvell/octeontx2/af/rvu.h +8 -1
@@ -180,11 +180,12 @@ static inline u64 rvupf_read64(struct rvu *rvu, u64 offset)/* Function Prototypes * RVU */ -int rvu_alloc_bitmap (struct rsrc_bmap *rsrc);int rvu_alloc_rsrc (struct rsrc_bmap *rsrc);void rvu_free_rsrc (struct rsrc_bmap *rsrc,int id);int rvu_rsrc_free_count (struct rsrc_bmap *rsrc); +int rvu_alloc_rsrc_contig (struct rsrc_bmap *rsrc,int nrsrc); +bool rvu_rsrc_check_contig (struct rsrc_bmap *rsrc,int nrsrc);int rvu_get_pf (u16 pcifunc);struct rvu_pfvf *rvu_get_pfvf (struct rvu *rvu,int pcifunc);void rvu_get_pf_numvfs (struct rvu *rvu,int pf,int *numvfs,int *hwvf);
@@ -270,4 +271,10 @@ int rvu_mbox_handler_NIX_AQ_ENQ(struct rvu *rvu,int rvu_mbox_handler_NIX_HWCTX_DISABLE (struct rvu *rvu,struct hwctx_disable_req *req,struct msg_rsp *rsp); +int rvu_mbox_handler_NIX_TXSCH_ALLOC (struct rvu *rvu, +struct nix_txsch_alloc_req *req, +struct nix_txsch_alloc_rsp *rsp); +int rvu_mbox_handler_NIX_TXSCH_FREE (struct rvu *rvu, +struct nix_txsch_free_req *req, +struct msg_rsp *rsp);#endif /* RVU_H */
drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c +220 -0
226 lines not on this page · raw message
Signature · 1 line
2.7.4
PATCH v2 2/17 octeontx2-af: NIX Tx scheduler queue config support
In reply to [email protected]From: Sunil Goutham <[email protected]>
This patch adds support for a PF/VF driver to configure NIX transmit scheduler queues via mbox. Since PF/VF doesn't know the absolute HW index of the NIXLF attached to it, AF traps the register config and overwrites with the correct NIXLF index.
HW supports shaping, colouring and policing of packets with these multilevel traffic scheduler queues. Instead of introducing different mbox message formats for different configurations and making both AF & PF/VF driver implementation cumbersome, access to the scheduler queue's CSRs is provided via mbox. AF checks whether the sender PF/VF has the corresponding queue allocated or not and dumps the config to HW. With a single mbox msg 20 registers can be configured.
--- drivers/net/ethernet/marvell/octeontx2/af/Makefile | 3 +- drivers/net/ethernet/marvell/octeontx2/af/mbox.h | 15 ++- drivers/net/ethernet/marvell/octeontx2/af/rvu.h | 11 +++ .../net/ethernet/marvell/octeontx2/af/rvu_nix.c | 104 ++++++++++++++++++++- .../net/ethernet/marvell/octeontx2/af/rvu_reg.c | 71 ++++++++++++++ 5 files changed, 199 insertions(+), 5 deletions(-) create mode 100644 drivers/net/ethernet/marvell/octeontx2/af/rvu_reg.c
drivers/net/ethernet/marvell/octeontx2/af/Makefile +2 -1
@@ -7,4 +7,5 @@ obj-$(CONFIG_OCTEONTX2_MBOX) += octeontx2_mbox.o obj-$(CONFIG_OCTEONTX2_AF) += octeontx2_af.o octeontx2_mbox-y := mbox.o -octeontx2_af-y := cgx.o rvu.o rvu_cgx.o rvu_npa.o rvu_nix.o +octeontx2_af-y := cgx.o rvu.o rvu_cgx.o rvu_npa.o rvu_nix.o \ + rvu_reg.o
drivers/net/ethernet/marvell/octeontx2/af/mbox.h +14 -1
@@ -154,7 +154,8 @@ M(NIX_LF_FREE, 0x8001, msg_req, msg_rsp) \ M(NIX_AQ_ENQ, 0x8002, nix_aq_enq_req, nix_aq_enq_rsp) \ M(NIX_HWCTX_DISABLE, 0x8003, hwctx_disable_req, msg_rsp) \ M(NIX_TXSCH_ALLOC, 0x8004, nix_txsch_alloc_req, nix_txsch_alloc_rsp) \ -M (NIX_TXSCH_FREE ,0x8005 , nix_txsch_free_req, msg_rsp) +M(NIX_TXSCH_FREE, 0x8005, nix_txsch_free_req, msg_rsp) \ +M (NIX_TXSCHQ_CFG ,0x8006 , nix_txschq_config, msg_rsp) /* Messages initiated by AF (range 0xC00 - 0xDFF) */#define MBOX_UP_CGX_MESSAGES \
@@ -448,4 +449,16 @@ struct nix_txsch_free_req { u16 schq; }; +struct nix_txschq_config { +struct mbox_msghdr hdr; +u8 lvl;/* SMQ/MDQ/TL4/TL3/TL2/TL1 */ +#define TXSCHQ_IDX_SHIFT 16 +#define TXSCHQ_IDX_MASK (BIT_ULL(10) - 1) +#define TXSCHQ_IDX (reg, shift) (((reg) >> (shift)) & TXSCHQ_IDX_MASK) +u8 num_regs; +#define MAX_REGS_PER_MBOX_MSG 20 +u64 reg[MAX_REGS_PER_MBOX_MSG ]; +u64 regval[MAX_REGS_PER_MBOX_MSG ]; +}; +#endif /* MBOX_H */
drivers/net/ethernet/marvell/octeontx2/af/rvu.h +11 -0
@@ -195,6 +195,14 @@ int rvu_lf_reset(struct rvu *rvu, struct rvu_block *block, int lf);int rvu_get_blkaddr (struct rvu *rvu,int blktype,u16 pcifunc);int rvu_poll_reg (struct rvu *rvu,u64 block,u64 offset,u64 mask,bool zero); +/* RVU HW reg validation */ +enum regmap_block { +TXSCHQ_HWREGMAP =0 , +MAX_HWREGMAP , +}; + +bool rvu_check_valid_reg (int regmap,int regblk,u64 reg); +/* NPA/NIX AQ APIs */ int rvu_aq_alloc (struct rvu *rvu,struct admin_queue **ad_queue,int qsize,int inst_size,int res_size);
@@ -277,4 +285,7 @@ int rvu_mbox_handler_NIX_TXSCH_ALLOC(struct rvu *rvu,int rvu_mbox_handler_NIX_TXSCH_FREE (struct rvu *rvu,struct nix_txsch_free_req *req,struct msg_rsp *rsp); +int rvu_mbox_handler_NIX_TXSCHQ_CFG (struct rvu *rvu, +struct nix_txschq_config *req, +struct msg_rsp *rsp);#endif /* RVU_H */
drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c +101 -3
124 lines not on this page · raw message
drivers/net/ethernet/marvell/octeontx2/af/rvu_reg.c new file +71 -0
71 lines not on this page · raw message
Signature · 1 line
2.7.4
PATCH v2 3/17 octeontx2-af: Reset NIXLF's Rx/Tx stats
In reply to [email protected]From: Vamsi Attunuru <[email protected]>
This patch adds a new mailbox message to reset
a NIXLF's receive and transmit HW stats.
--- drivers/net/ethernet/marvell/octeontx2/af/mbox.h | 3 ++- drivers/net/ethernet/marvell/octeontx2/af/rvu.h | 2 ++ .../net/ethernet/marvell/octeontx2/af/rvu_nix.c | 30 ++++++++++++++++++++++ 3 files changed, 34 insertions(+), 1 deletion(-)
drivers/net/ethernet/marvell/octeontx2/af/mbox.h +2 -1
@@ -155,7 +155,8 @@ M(NIX_AQ_ENQ, 0x8002, nix_aq_enq_req, nix_aq_enq_rsp) \ M(NIX_HWCTX_DISABLE, 0x8003, hwctx_disable_req, msg_rsp) \ M(NIX_TXSCH_ALLOC, 0x8004, nix_txsch_alloc_req, nix_txsch_alloc_rsp) \ M(NIX_TXSCH_FREE, 0x8005, nix_txsch_free_req, msg_rsp) \ -M (NIX_TXSCHQ_CFG ,0x8006 , nix_txschq_config, msg_rsp) +M(NIX_TXSCHQ_CFG, 0x8006, nix_txschq_config, msg_rsp) \ +M (NIX_STATS_RST ,0x8007 , msg_req, msg_rsp) /* Messages initiated by AF (range 0xC00 - 0xDFF) */#define MBOX_UP_CGX_MESSAGES \
drivers/net/ethernet/marvell/octeontx2/af/rvu.h +2 -0
@@ -288,4 +288,6 @@ int rvu_mbox_handler_NIX_TXSCH_FREE(struct rvu *rvu,int rvu_mbox_handler_NIX_TXSCHQ_CFG (struct rvu *rvu,struct nix_txschq_config *req,struct msg_rsp *rsp); +int rvu_mbox_handler_NIX_STATS_RST (struct rvu *rvu,struct msg_req *req, +struct msg_rsp *rsp);#endif /* RVU_H */
drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c +30 -0
@@ -1053,6 +1053,36 @@ static int nix_setup_txschq(struct rvu *rvu, struct nix_hw *nix_hw, int blkaddr)return 0 ; } +int rvu_mbox_handler_NIX_STATS_RST (struct rvu *rvu,struct msg_req *req, +struct msg_rsp *rsp) +{ +struct rvu_hwinfo *hw = rvu->hw; +u16 pcifunc = req->hdr.pcifunc; +int i, nixlf, blkaddr; +u64 stats; + + blkaddr =rvu_get_blkaddr (rvu,BLKTYPE_NIX , pcifunc); +if (blkaddr <0 ) +return NIX_AF_ERR_AF_LF_INVALID ; + + nixlf =rvu_get_lf (rvu, &hw->block[blkaddr], pcifunc,0 ); +if (nixlf <0 ) +return NIX_AF_ERR_AF_LF_INVALID ; + +/* Get stats count supported by HW */ + stats =rvu_read64 (rvu, blkaddr,NIX_AF_CONST1 ); + +/* Reset tx stats */ +for (i =0 ; i < ((stats >>24 ) &0xFF ); i++) +rvu_write64 (rvu, blkaddr,NIX_AF_LFX_TX_STATX (nixlf, i),0 ); + +/* Reset rx stats */ +for (i =0 ; i < ((stats >>32 ) &0xFF ); i++) +rvu_write64 (rvu, blkaddr,NIX_AF_LFX_RX_STATX (nixlf, i),0 ); + +return 0 ; +} +static int nix_calibrate_x2p (struct rvu *rvu,int blkaddr) {int idx, err;
Signature · 1 line
2.7.4
PATCH v2 4/17 octeontx2-af: Add NPC KPU profile
In reply to [email protected]From: Hao Zheng <[email protected]>
NPC block is responsible for parsing and forwarding packets to different NIXLFs. NPC has 16 KPU engines (Kangaroo parse engine) and one iKPU which represents pkinds. Each physical port either CGX/LBK is assigned a pkind and upon receiving a packet HW takes that port's pkind and starts parsing as per the KPU engines config.
This patch adds header files which contain configuration profile/array for each of the iKPU and 16 KPU engines.
--- drivers/net/ethernet/marvell/octeontx2/af/npc.h | 143 + .../ethernet/marvell/octeontx2/af/npc_profile.h | 5709 ++++++++++++++++++++ 2 files changed, 5852 insertions(+) create mode 100644 drivers/net/ethernet/marvell/octeontx2/af/npc.h create mode 100644 drivers/net/ethernet/marvell/octeontx2/af/npc_profile.h
drivers/net/ethernet/marvell/octeontx2/af/npc.h new file +143 -0
@@ -0,0 +1,143 @@ +/* SPDX-License-Identifier: GPL-2.0 +* Marvell OcteonTx2 RVU Admin Function driver +* +* Copyright (C) 2018 Marvell International Ltd. +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +*/ + +#ifndef NPC_H +#define NPC_H + +enum NPC_LID_E { +NPC_LID_LA =0 , +NPC_LID_LB , +NPC_LID_LC , +NPC_LID_LD , +NPC_LID_LE , +NPC_LID_LF , +NPC_LID_LG , +NPC_LID_LH , +}; + +#define NPC_LT_NA 0 + +enum npc_kpu_la_ltype { +NPC_LT_LA_8023 =1 , +NPC_LT_LA_ETHER , +}; + +enum npc_kpu_lb_ltype { +NPC_LT_LB_ETAG =1 , +NPC_LT_LB_CTAG , +NPC_LT_LB_STAG , +NPC_LT_LB_BTAG , +NPC_LT_LB_QINQ , +NPC_LT_LB_ITAG , +}; + +enum npc_kpu_lc_ltype { +NPC_LT_LC_IP =1 , +NPC_LT_LC_IP6 , +NPC_LT_LC_ARP , +NPC_LT_LC_RARP , +NPC_LT_LC_MPLS , +NPC_LT_LC_NSH , +NPC_LT_LC_PTP , +NPC_LT_LC_FCOE , +}; + +/* Don't modify Ltypes upto SCTP, otherwise it will +* effect flow tag calculation and thus RSS. +*/ +enum npc_kpu_ld_ltype { +NPC_LT_LD_TCP =1 , +NPC_LT_LD_UDP , +NPC_LT_LD_ICMP , +NPC_LT_LD_SCTP , +NPC_LT_LD_IGMP , +NPC_LT_LD_ICMP6 , +NPC_LT_LD_ESP , +NPC_LT_LD_AH , +NPC_LT_LD_GRE , +NPC_LT_LD_GRE_MPLS , +NPC_LT_LD_GRE_NSH , +NPC_LT_LD_TU_MPLS , +}; + +enum npc_kpu_le_ltype { +NPC_LT_LE_TU_ETHER =1 , +NPC_LT_LE_TU_PPP , +NPC_LT_LE_TU_MPLS_IN_NSH , +NPC_LT_LE_TU_3RD_NSH , +}; + +enum npc_kpu_lf_ltype { +NPC_LT_LF_TU_IP =1 , +NPC_LT_LF_TU_IP6 , +NPC_LT_LF_TU_ARP , +NPC_LT_LF_TU_MPLS_IP , +NPC_LT_LF_TU_MPLS_IP6 , +NPC_LT_LF_TU_MPLS_ETHER , +}; + +enum npc_kpu_lg_ltype { +NPC_LT_LG_TU_TCP =1 , +NPC_LT_LG_TU_UDP , +NPC_LT_LG_TU_SCTP , +NPC_LT_LG_TU_ICMP , +NPC_LT_LG_TU_IGMP , +NPC_LT_LG_TU_ICMP6 , +NPC_LT_LG_TU_ESP , +NPC_LT_LG_TU_AH , +}; + +enum npc_kpu_lh_ltype { +NPC_LT_LH_TCP_DATA =1 , +NPC_LT_LH_HTTP_DATA , +NPC_LT_LH_HTTPS_DATA , +NPC_LT_LH_PPTP_DATA , +NPC_LT_LH_UDP_DATA , +}; + +struct npc_kpu_profile_cam { +u8 state; +u8 state_mask; +u16 dp0; +u16 dp0_mask; +u16 dp1; +u16 dp1_mask; +u16 dp2; +u16 dp2_mask; +}; + +struct npc_kpu_profile_action { +u8 errlev; +u8 errcode; +u8 dp0_offset; +u8 dp1_offset; +u8 dp2_offset; +u8 bypass_count; +u8 parse_done; +u8 next_state; +u8 ptr_advance; +u8 cap_ena; +u8 lid; +u8 ltype; +u8 flags; +u8 offset; +u8 mask; +u8 right; +u8 shift; +}; + +struct npc_kpu_profile { +int cam_entries; +int action_entries; +struct npc_kpu_profile_cam *cam; +struct npc_kpu_profile_action *action; +}; + +#endif /* NPC_H */
drivers/net/ethernet/marvell/octeontx2/af/npc_profile.h new file +5709 -0
2,857 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.7.4
Part of the diff is not shown here. View the raw message.
PATCH v2 5/17 octeontx2-af: Config NPC KPU engines with parser profile
In reply to [email protected]From: Sunil Goutham <[email protected]>
This patch configures all 16 KPUs and iKPU (pkinds) with the KPU parser profile defined in npc_profile.h. Each KPU engine has a 128 entry CAM, only CAM entries which are listed in the profile are enabled and rest are left disabled.
Also
- Memory is allocated for pkind's bitmap and PFFUNC, interface channel mapping.
- Added all CSR offsets of NPC HW block.
--- drivers/net/ethernet/marvell/octeontx2/af/Makefile | 2 +- drivers/net/ethernet/marvell/octeontx2/af/npc.h | 100 ++++++++++ drivers/net/ethernet/marvell/octeontx2/af/rvu.c | 8 + drivers/net/ethernet/marvell/octeontx2/af/rvu.h | 12 ++ .../net/ethernet/marvell/octeontx2/af/rvu_npc.c | 203 +++++++++++++++++++++ .../net/ethernet/marvell/octeontx2/af/rvu_reg.h | 61 +++++++ 6 files changed, 385 insertions(+), 1 deletion(-) create mode 100644 drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c
drivers/net/ethernet/marvell/octeontx2/af/Makefile +1 -1
@@ -8,4 +8,4 @@ obj-$(CONFIG_OCTEONTX2_AF) += octeontx2_af.o octeontx2_mbox-y := mbox.o octeontx2_af-y := cgx.o rvu.o rvu_cgx.o rvu_npa.o rvu_nix.o \ - rvu_reg.o + rvu_reg.o rvu_npc.o
drivers/net/ethernet/marvell/octeontx2/af/npc.h +100 -0
104 lines not on this page · raw message
drivers/net/ethernet/marvell/octeontx2/af/rvu.c +8 -0
@@ -180,6 +180,9 @@ int rvu_get_blkaddr(struct rvu *rvu, int blktype, u16 pcifunc)bool is_pf;switch (blktype) { +case BLKTYPE_NPC : + blkaddr =BLKADDR_NPC ; + goto exit;case BLKTYPE_NPA : blkaddr =BLKADDR_NPA ; goto exit;
@@ -566,6 +569,7 @@ static void rvu_free_hw_resources(struct rvu *rvu)u64 cfg;rvu_npa_freemem (rvu); +rvu_npc_freemem (rvu);rvu_nix_freemem (rvu);/* Free block LF bitmaps */
@@ -771,6 +775,10 @@ static int rvu_setup_hw_resources(struct rvu *rvu)rvu_scan_block (rvu, block); } + err =rvu_npc_init (rvu); +if (err) +return err; + err =rvu_npa_init (rvu);if (err)return err;
drivers/net/ethernet/marvell/octeontx2/af/rvu.h +12 -0
@@ -100,6 +100,11 @@ struct nix_txsch {u16 *pfvf_map; }; +struct npc_pkind { +struct rsrc_bmap rsrc; +u32 *pfchan_map; +}; +struct nix_hw {struct nix_txsch txsch[NIX_TXSCH_LVL_CNT ];/* Tx schedulers */ };
@@ -113,9 +118,12 @@ struct rvu_hwinfo {u8 cgx_links;u8 lbk_links;u8 sdp_links; +u8 npc_kpus;/* No of parser units */ +struct rvu_block block[BLK_COUNT ];/* Block info */ struct nix_hw *nix0; +struct npc_pkind pkind; };struct rvu {
@@ -290,4 +298,8 @@ int rvu_mbox_handler_NIX_TXSCHQ_CFG(struct rvu *rvu, struct msg_rsp *rsp);int rvu_mbox_handler_NIX_STATS_RST (struct rvu *rvu,struct msg_req *req,struct msg_rsp *rsp); + +/* NPC APIs */ +int rvu_npc_init (struct rvu *rvu); +void rvu_npc_freemem (struct rvu *rvu);#endif /* RVU_H */
drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c new file +203 -0
203 lines not on this page · raw message
drivers/net/ethernet/marvell/octeontx2/af/rvu_reg.h +61 -0
65 lines not on this page · raw message
Signature · 1 line
2.7.4
Re: [PATCH v2 05/17] octeontx2-af: Config NPC KPU engines with parser profile
drivers/net/ethernet/marvell/octeontx2/af/npc.h struct npc_kpu_profile { · line 168
Quoted 12 lines · On 10/22/18, [email protected] <[email protected]> wrote:
From: Sunil Goutham <[email protected]>
drivers/net/ethernet/marvell/octeontx2/af/npc.h +9
-0+struct npc_kpu_action0 { +#if defined(__BIG_ENDIAN_BITFIELD) +u64 rsvd_63_57 :7 ; +u64 byp_count :3 ; +u64 capture_ena :1 ; +u64 parse_done :1 ; +u64 next_state :8 ; +u64 rsvd_43 :1 ; +u64 capture_lid :3 ;
This looks like it again introduces a problem on bit-endian kernels, since you have fields that span multiple bytes. Could you rewrite it to avoid the use of bitfields?
Arnd
PATCH v2 6/17 octeontx2-af: Config pkind for CGX mapped PFs
In reply to [email protected]From: Geetha sowjanya <[email protected]>
For each CGX LMAC that is mapped to a RVU PF, allocate a pkind and config the same in CGX. For a received packet at CGX LMAC interface this pkind is used by NPC block to start parsing of packet.
--- drivers/net/ethernet/marvell/octeontx2/af/cgx.c | 12 ++++++++ drivers/net/ethernet/marvell/octeontx2/af/cgx.h | 1 + drivers/net/ethernet/marvell/octeontx2/af/common.h | 6 ++++ drivers/net/ethernet/marvell/octeontx2/af/rvu.h | 4 +++ .../net/ethernet/marvell/octeontx2/af/rvu_cgx.c | 7 +++-- .../net/ethernet/marvell/octeontx2/af/rvu_nix.c | 34 ++++++++++++++++++++++ .../net/ethernet/marvell/octeontx2/af/rvu_npc.c | 28 ++++++++++++++++++ 7 files changed, 90 insertions(+), 2 deletions(-)
drivers/net/ethernet/marvell/octeontx2/af/cgx.c +12 -0
@@ -186,6 +186,18 @@ u64 cgx_lmac_addr_get(u8 cgx_id, u8 lmac_id) }EXPORT_SYMBOL (cgx_lmac_addr_get); +int cgx_set_pkind (void *cgxd,u8 lmac_id,int pkind) +{ +struct cgx *cgx = cgxd; + +if (!cgx || lmac_id >= cgx->lmac_count) +return -ENODEV ; + +cgx_write (cgx, lmac_id,CGXX_CMRX_RX_ID_MAP , (pkind &0x3F )); +return 0 ; +} +EXPORT_SYMBOL (cgx_set_pkind); +static inline u8 cgx_get_lmac_type (struct cgx *cgx,int lmac_id) {u64 cfg;
drivers/net/ethernet/marvell/octeontx2/af/cgx.h +1 -0
@@ -97,6 +97,7 @@ extern struct pci_driver cgx_driver;int cgx_get_cgx_cnt (void );int cgx_get_lmac_cnt (void *cgxd);void *cgx_get_pdata (int cgx_id); +int cgx_set_pkind (void *cgxd,u8 lmac_id,int pkind);int cgx_lmac_evh_register (struct cgx_event_cb *cb,void *cgxd,int lmac_id);int cgx_get_tx_stats (void *cgxd,int lmac_id,int idx,u64 *tx_stat);int cgx_get_rx_stats (void *cgxd,int lmac_id,int idx,u64 *rx_stat);
drivers/net/ethernet/marvell/octeontx2/af/common.h +6 -0
@@ -143,6 +143,12 @@ enum nix_scheduler { NIX_TXSCH_LVL_CNT = 0x5, }; +#define NIX_INTF_TYPE_CGX 0 +#define NIX_INTF_TYPE_LBK 1 + +#define MAX_LMAC_PKIND 12 +#define NIX_LINK_CGX_LMAC (a, b) (0 + 4 * (a) + (b)) +/* NIX LSO format indices. * As of now TSO is the only one using, so statically assigning indices. */
drivers/net/ethernet/marvell/octeontx2/af/rvu.h +4 -0
@@ -67,6 +67,7 @@ struct rvu_pfvf {u16 ssow;u16 cptlfs;u16 timlfs; +u8 cgx_lmac;/* Block LF's MSIX vector info */ struct rsrc_bmap msix;/* Bitmap for MSIX vector alloc */
@@ -230,6 +231,7 @@ static inline void rvu_get_cgx_lmac_id(u8 map, u8 *cgx_id, u8 *lmac_id)int rvu_cgx_probe (struct rvu *rvu);void rvu_cgx_wq_destroy (struct rvu *rvu); +void *rvu_cgx_pdata (u8 cgx_id,struct rvu *rvu);int rvu_cgx_config_rxtx (struct rvu *rvu,u16 pcifunc,bool start);int rvu_mbox_handler_CGX_START_RXTX (struct rvu *rvu,struct msg_req *req,struct msg_rsp *rsp);
@@ -302,4 +304,6 @@ int rvu_mbox_handler_NIX_STATS_RST(struct rvu *rvu, struct msg_req *req,/* NPC APIs */ int rvu_npc_init (struct rvu *rvu);void rvu_npc_freemem (struct rvu *rvu); +int rvu_npc_get_pkind (struct rvu *rvu,u16 pf); +void rvu_npc_set_pkind (struct rvu *rvu,int pkind,struct rvu_pfvf *pfvf);#endif /* RVU_H */
drivers/net/ethernet/marvell/octeontx2/af/rvu_cgx.c +5 -2
@@ -50,7 +50,7 @@ static inline u8 cgxlmac_id_to_bmap(u8 cgx_id, u8 lmac_id)return ((cgx_id &0xF ) <<4 ) | (lmac_id &0xF ); } -static void *rvu_cgx_pdata (u8 cgx_id,struct rvu *rvu) +void *rvu_cgx_pdata (u8 cgx_id,struct rvu *rvu) {if (cgx_id >= rvu->cgx_cnt)return NULL ;
@@ -60,10 +60,11 @@ static void *rvu_cgx_pdata(u8 cgx_id, struct rvu *rvu)static int rvu_map_cgx_lmac_pf (struct rvu *rvu) { +struct npc_pkind *pkind = &rvu->hw->pkind;int cgx_cnt = rvu->cgx_cnt;int cgx, lmac_cnt, lmac;int pf =PF_CGXMAP_BASE ; -int size; +int size, free_pkind;if (!cgx_cnt)return 0 ;
@@ -96,6 +97,8 @@ static int rvu_map_cgx_lmac_pf(struct rvu *rvu)for (lmac =0 ; lmac < lmac_cnt; lmac++, pf++) { rvu->pf2cgxlmac_map[pf] =cgxlmac_id_to_bmap (cgx, lmac); rvu->cgxlmac2pf_map[CGX_OFFSET (cgx) + lmac] =1 << pf; + free_pkind =rvu_alloc_rsrc (&pkind->rsrc); + pkind->pfchan_map[free_pkind] = ((pf) &0x3F ) <<16 ; rvu->cgx_mapped_pfs++; } }
drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c +34 -0
@@ -48,6 +48,36 @@ static bool is_valid_txschq(struct rvu *rvu, int blkaddr,return true; } +static int nix_interface_init (struct rvu *rvu,u16 pcifunc,int type,int nixlf) +{ +struct rvu_pfvf *pfvf =rvu_get_pfvf (rvu, pcifunc); +u8 cgx_id, lmac_id; +int pkind, pf; + + pf =rvu_get_pf (pcifunc); +if (!is_pf_cgxmapped (rvu, pf) && type !=NIX_INTF_TYPE_LBK ) +return 0 ; + +switch (type) { +case NIX_INTF_TYPE_CGX : + pfvf->cgx_lmac = rvu->pf2cgxlmac_map[pf]; +rvu_get_cgx_lmac_id (pfvf->cgx_lmac, &cgx_id, &lmac_id); + + pkind =rvu_npc_get_pkind (rvu, pf); +if (pkind <0 ) { +dev_err (rvu->dev, +"PF_Func 0x%x: Invalid pkind\n" , pcifunc); +return -EINVAL ; + } +cgx_set_pkind (rvu_cgx_pdata (cgx_id, rvu), lmac_id, pkind); +rvu_npc_set_pkind (rvu, pkind, pfvf); +break ; +case NIX_INTF_TYPE_LBK : +break ; + } +return 0 ; +} +static void nix_setup_lso_tso_l3 (struct rvu *rvu,int blkaddr,u64 format,bool v4,u64 *fidx) {
@@ -639,6 +669,10 @@ int rvu_mbox_handler_NIX_LF_ALLOC(struct rvu *rvu,/* Config Rx pkt length, csum checks and apad enable / disable */ rvu_write64 (rvu, blkaddr,NIX_AF_LFX_RX_CFG (nixlf), req->rx_cfg); + err =nix_interface_init (rvu, pcifunc,NIX_INTF_TYPE_CGX , nixlf); +if (err) + goto free_mem; + goto exit; free_mem:
drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c +28 -0
@@ -17,6 +17,34 @@#include "npc.h" #include "npc_profile.h" +void rvu_npc_set_pkind (struct rvu *rvu,int pkind,struct rvu_pfvf *pfvf) +{ +int blkaddr; +u64 val =0 ; + + blkaddr =rvu_get_blkaddr (rvu,BLKTYPE_NPC ,0 ); +if (blkaddr <0 ) +return ; + +/* Config CPI base for the PKIND */ + val = pkind |1ULL <<62 ; +rvu_write64 (rvu, blkaddr,NPC_AF_PKINDX_CPI_DEFX (pkind,0 ), val); +} + +int rvu_npc_get_pkind (struct rvu *rvu,u16 pf) +{ +struct npc_pkind *pkind = &rvu->hw->pkind; +u32 map; +int i; + +for (i =0 ; i < pkind->rsrc.max; i++) { + map = pkind->pfchan_map[i]; +if (((map >>16 ) &0x3F ) == pf) +return i; + } +return -1 ; +} +static void npc_config_kpuaction (struct rvu *rvu,int blkaddr,struct npc_kpu_profile_action *kpuaction,int kpu,int entry,bool pkind)
Signature · 1 line
2.7.4
PATCH v2 7/17 octeontx2-af: Broadcast packet replication support
In reply to [email protected]From: Sunil Goutham <[email protected]>
Allocate memory for mcast/bcast/mirror replication entry contexts, replication buffers (used by HW) and config HW with corresponding memory bases. Added support for installing MCEs via NIX AQ mbox.
For now support is restricted to broadcast pkt replication, hence MCE table size and number of replication buffers allocated are less. Each CGX LMAC mapped RVU PF is assigned a MCE table of size 'num VFs of that PF + PF'.
--- drivers/net/ethernet/marvell/octeontx2/af/rvu.h | 19 ++ .../net/ethernet/marvell/octeontx2/af/rvu_nix.c | 201 +++++++++++++++++++++ 2 files changed, 220 insertions(+)
drivers/net/ethernet/marvell/octeontx2/af/rvu.h +19 -0
@@ -59,6 +59,20 @@ struct rvu_block {unsigned char name[NAME_SIZE ]; }; +struct nix_mcast { +struct qmem *mce_ctx; +struct qmem *mcast_buf; +int replay_pkind; +int next_free_mce; +spinlock_t mce_lock;/* Serialize MCE updates */ +}; + +struct nix_mce_list { +struct hlist_head head; +int count; +int max; +}; +/* Structure for per RVU func info ie PF/VF */ struct rvu_pfvf {bool npalf;/* Only one NPALF per RVU_FUNC */
@@ -93,6 +107,10 @@ struct rvu_pfvf {unsigned long *cq_bmap;u8 mac_addr[ETH_ALEN ];/* MAC address of this PF/VF */ + +/* Broadcast pkt replication info */ +u16 bcast_mce_idx; +struct nix_mce_list bcast_mce_list; };struct nix_txsch {
@@ -108,6 +126,7 @@ struct npc_pkind {struct nix_hw {struct nix_txsch txsch[NIX_TXSCH_LVL_CNT ];/* Tx schedulers */ +struct nix_mcast mcast; };struct rvu_hwinfo {
drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c +201 -0
254 lines not on this page · raw message
Signature · 1 line
2.7.4
PATCH v2 8/17 octeontx2-af: Update bcast list upon NIXLF alloc/free
In reply to [email protected]From: Sunil Goutham <[email protected]>
Upon NIXLF ALLOC/FREE, add or remove corresponding PF_FUNC from the broadcast packet replication list of the CGX LMAC mapped RVU PF.
--- .../net/ethernet/marvell/octeontx2/af/rvu_nix.c | 133 +++++++++++++++++++++ 1 file changed, 133 insertions(+)
drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c +133 -0
@@ -16,6 +16,8 @@#include "rvu.h" #include "cgx.h" +static int nix_update_bcast_mce_list (struct rvu *rvu,u16 pcifunc,bool add); +enum mc_tbl_sz {MC_TBL_SZ_256 ,MC_TBL_SZ_512 ,
@@ -108,6 +110,7 @@ static int nix_interface_init(struct rvu *rvu, u16 pcifunc, int type, int nixlf)struct rvu_pfvf *pfvf =rvu_get_pfvf (rvu, pcifunc);u8 cgx_id, lmac_id;int pkind, pf; +int err; pf =rvu_get_pf (pcifunc);if (!is_pf_cgxmapped (rvu, pf) && type !=NIX_INTF_TYPE_LBK )
@@ -130,9 +133,30 @@ static int nix_interface_init(struct rvu *rvu, u16 pcifunc, int type, int nixlf)case NIX_INTF_TYPE_LBK :break ; } + +/* Add this PF_FUNC to bcast pkt replication list */ + err =nix_update_bcast_mce_list (rvu, pcifunc, true); +if (err) { +dev_err (rvu->dev, +"Bcast list, failed to enable PF_FUNC 0x%x\n" , + pcifunc); + }return 0 ; } +static void nix_interface_deinit (struct rvu *rvu,u16 pcifunc,u8 nixlf) +{ +int err; + +/* Remove this PF_FUNC from bcast pkt replication list */ + err =nix_update_bcast_mce_list (rvu, pcifunc, false); +if (err) { +dev_err (rvu->dev, +"Bcast list, failed to disable PF_FUNC 0x%x\n" , + pcifunc); + } +} +static void nix_setup_lso_tso_l3 (struct rvu *rvu,int blkaddr,u64 format,bool v4,u64 *fidx) {
@@ -786,6 +810,8 @@ int rvu_mbox_handler_NIX_LF_FREE(struct rvu *rvu, struct msg_req *req,if (nixlf <0 )return NIX_AF_ERR_AF_LF_INVALID ; +nix_interface_deinit (rvu, pcifunc, nixlf); +/* Reset this NIX LF */ err =rvu_lf_reset (rvu, block, nixlf);if (err) {
@@ -1147,6 +1173,113 @@ static int nix_setup_mce(struct rvu *rvu, int mce, u8 op,return 0 ; } +static int nix_update_mce_list (struct nix_mce_list *mce_list, +u16 pcifunc,int idx,bool add) +{ +struct mce *mce, *tail =NULL ; +bool delete = false; + +/* Scan through the current list */ +hlist_for_each_entry (mce, &mce_list->head, node) { +/* If already exists, then delete */ +if (mce->pcifunc == pcifunc && !add) { + delete = true; +break ; + } + tail = mce; + } + +if (delete) { +hlist_del (&mce->node); +kfree (mce); + mce_list->count--; +return 0 ; + } + +if (!add) +return 0 ; + +/* Add a new one to the list, at the tail */ + mce =kzalloc (sizeof (*mce),GFP_KERNEL ); +if (!mce) +return -ENOMEM ; + mce->idx = idx; + mce->pcifunc = pcifunc; +if (!tail) +hlist_add_head (&mce->node, &mce_list->head); +else +hlist_add_behind (&mce->node, &tail->node); + mce_list->count++; +return 0 ; +} + +static int nix_update_bcast_mce_list (struct rvu *rvu,u16 pcifunc,bool add) +{ +int err =0 , idx, next_idx, count; +struct nix_mce_list *mce_list; +struct mce *mce, *next_mce; +struct nix_mcast *mcast; +struct nix_hw *nix_hw; +struct rvu_pfvf *pfvf; +int blkaddr; + + blkaddr =rvu_get_blkaddr (rvu,BLKTYPE_NIX , pcifunc); +if (blkaddr <0 ) +return 0 ; + + nix_hw =get_nix_hw (rvu->hw, blkaddr); +if (!nix_hw) +return 0 ; + + mcast = &nix_hw->mcast; + +/* Get this PF/VF func's MCE index */ + pfvf =rvu_get_pfvf (rvu, pcifunc & ~RVU_PFVF_FUNC_MASK ); + idx = pfvf->bcast_mce_idx + (pcifunc &RVU_PFVF_FUNC_MASK ); + + mce_list = &pfvf->bcast_mce_list; +if (idx > (pfvf->bcast_mce_idx + mce_list->max)) { +dev_err (rvu->dev, +"%s: Idx %d > max MCE idx %d, for PF%d bcast list\n" , + __func__, idx, mce_list->max, + pcifunc >>RVU_PFVF_PF_SHIFT ); +return -EINVAL ; + } + +spin_lock (&mcast->mce_lock); + + err =nix_update_mce_list (mce_list, pcifunc, idx, add); +if (err) + goto end; + +/* Disable MCAM entry in NPC */ + +if (!mce_list->count) + goto end; + count = mce_list->count; + +/* Dump the updated list to HW */ +hlist_for_each_entry (mce, &mce_list->head, node) { + next_idx =0 ; + count--; +if (count) { + next_mce =hlist_entry (mce->node.next, + struct mce, node); + next_idx = next_mce->idx; + } +/* EOL should be set in last MCE */ + err =nix_setup_mce (rvu, mce->idx, +NIX_AQ_INSTOP_WRITE , mce->pcifunc, + next_idx, count ? false : true); +if (err) + goto end; + } + +end: +spin_unlock (&mcast->mce_lock); +return err; +} +static int nix_setup_bcast_tables (struct rvu *rvu,struct nix_hw *nix_hw) {struct nix_mcast *mcast = &nix_hw->mcast;
Signature · 1 line
2.7.4
PATCH v2 9/17 octeontx2-af: Support for VTAG strip and capture
In reply to [email protected]From: Vamsi Attunuru <[email protected]>
Added support for PF/VF drivers to configure NIX to capture and/or strip VLAN tag from ingress packets.
--- drivers/net/ethernet/marvell/octeontx2/af/mbox.h | 35 ++++++++++++- drivers/net/ethernet/marvell/octeontx2/af/rvu.h | 3 ++ .../net/ethernet/marvell/octeontx2/af/rvu_nix.c | 59 ++++++++++++++++++++++ .../net/ethernet/marvell/octeontx2/af/rvu_struct.h | 5 ++ 4 files changed, 101 insertions(+), 1 deletion(-)
drivers/net/ethernet/marvell/octeontx2/af/mbox.h +34 -1
@@ -156,7 +156,8 @@ M(NIX_HWCTX_DISABLE, 0x8003, hwctx_disable_req, msg_rsp) \ M(NIX_TXSCH_ALLOC, 0x8004, nix_txsch_alloc_req, nix_txsch_alloc_rsp) \ M(NIX_TXSCH_FREE, 0x8005, nix_txsch_free_req, msg_rsp) \ M(NIX_TXSCHQ_CFG, 0x8006, nix_txschq_config, msg_rsp) \ -M (NIX_STATS_RST ,0x8007 , msg_req, msg_rsp) +M(NIX_STATS_RST, 0x8007, msg_req, msg_rsp) \ +M (NIX_VTAG_CFG ,0x8008 , nix_vtag_config, msg_rsp) /* Messages initiated by AF (range 0xC00 - 0xDFF) */#define MBOX_UP_CGX_MESSAGES \
@@ -462,4 +463,36 @@ struct nix_txschq_config { u64 regval[MAX_REGS_PER_MBOX_MSG]; }; +struct nix_vtag_config { +struct mbox_msghdr hdr; +u8 vtag_size; +/* cfg_type is '0' for tx vlan cfg +* cfg_type is '1' for rx vlan cfg +*/ +u8 cfg_type; +union { +/* valid when cfg_type is '0' */ +struct { +/* tx vlan0 tag(C-VLAN) */ +u64 vlan0; +/* tx vlan1 tag(S-VLAN) */ +u64 vlan1; +/* insert tx vlan tag */ +u8 insert_vlan :1 ; +/* insert tx double vlan tag */ +u8 double_vlan :1 ; + } tx; + +/* valid when cfg_type is '1' */ +struct { +/* rx vtag type index */ +u8 vtag_type; +/* rx vtag strip */ +u8 strip_vtag :1 ; +/* rx vtag capture */ +u8 capture_vtag :1 ; + } rx; + }; +}; +#endif /* MBOX_H */
drivers/net/ethernet/marvell/octeontx2/af/rvu.h +3 -0
@@ -319,6 +319,9 @@ int rvu_mbox_handler_NIX_TXSCHQ_CFG(struct rvu *rvu, struct msg_rsp *rsp);int rvu_mbox_handler_NIX_STATS_RST (struct rvu *rvu,struct msg_req *req,struct msg_rsp *rsp); +int rvu_mbox_handler_NIX_VTAG_CFG (struct rvu *rvu, +struct nix_vtag_config *req, +struct msg_rsp *rsp);/* NPC APIs */ int rvu_npc_init (struct rvu *rvu);
drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c +59 -0
65 lines not on this page · raw message
drivers/net/ethernet/marvell/octeontx2/af/rvu_struct.h +5 -0
@@ -879,4 +879,9 @@ struct nix_lso_format { #endif }; +/* NIX VTAG size */ +enum nix_vtag_size { +VTAGSIZE_T4 =0x0 , +VTAGSIZE_T8 =0x1 , +};#endif /* RVU_STRUCT_H */
Signature · 1 line
2.7.4
PATCH v2 10/17 octeontx2-af: Enable packet length and csum validation
In reply to [email protected]From: Sunil Goutham <[email protected]>
Config NPC layer info from KPU profile into protocol checker to identify outer L2/IPv4/TCP/UDP headers in a packet. And enable IPv4 checksum validation.
L3/L4 and L4 CSUM validation will be enabled by PF/VF drivers by configuring NIX_AF_LF(0..127)_RX_CFG via mbox i.e 'nix_lf_alloc_req->rx_cfg'
Also enable setting of NPC_RESULT_S[L2B] when an outer L2 broadcast address is detected. This will help in installing NPC MCAM rules for broadcast packets.
--- drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c | 14 ++++++++++++++ drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c | 14 ++++++++++++++ 2 files changed, 28 insertions(+)
drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c +14 -0
@@ -14,6 +14,7 @@#include "rvu_struct.h" #include "rvu_reg.h" #include "rvu.h" +#include "npc.h" #include "cgx.h" static int nix_update_bcast_mce_list (struct rvu *rvu,u16 pcifunc,bool add);
@@ -1630,6 +1631,19 @@ int rvu_nix_init(struct rvu *rvu) err =nix_setup_mcast (rvu, hw->nix0, blkaddr);if (err)return err; + +/* Config Outer L2, IP, TCP and UDP's NPC layer info. +* This helps HW protocol checker to identify headers +* and validate length and checksums. +*/ +rvu_write64 (rvu, blkaddr,NIX_AF_RX_DEF_OL2 , + (NPC_LID_LA <<8 ) | (NPC_LT_LA_ETHER <<4 ) |0x0F ); +rvu_write64 (rvu, blkaddr,NIX_AF_RX_DEF_OUDP , + (NPC_LID_LD <<8 ) | (NPC_LT_LD_UDP <<4 ) |0x0F ); +rvu_write64 (rvu, blkaddr,NIX_AF_RX_DEF_OTCP , + (NPC_LID_LD <<8 ) | (NPC_LT_LD_TCP <<4 ) |0x0F ); +rvu_write64 (rvu, blkaddr,NIX_AF_RX_DEF_OIP4 , + (NPC_LID_LC <<8 ) | (NPC_LT_LC_IP <<4 ) |0x0F ); }return 0 ; }
drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c +14 -0
@@ -220,6 +220,20 @@ int rvu_npc_init(struct rvu *rvu)/* Configure KPU profile */ npc_parser_profile_init (rvu, blkaddr); +/* Config Outer L2, IPv4's NPC layer info */ +rvu_write64 (rvu, blkaddr,NPC_AF_PCK_DEF_OL2 , + (NPC_LID_LA <<8 ) | (NPC_LT_LA_ETHER <<4 ) |0x0F ); +rvu_write64 (rvu, blkaddr,NPC_AF_PCK_DEF_OIP4 , + (NPC_LID_LC <<8 ) | (NPC_LT_LC_IP <<4 ) |0x0F ); + +/* Enable below for Rx pkts. +* - Outer IPv4 header checksum validation. +* - Detect outer L2 broadcast address and set NPC_RESULT_S[L2M]. +*/ +rvu_write64 (rvu, blkaddr,NPC_AF_PCK_CFG , +rvu_read64 (rvu, blkaddr,NPC_AF_PCK_CFG ) | +BIT_ULL (6 ) |BIT_ULL (2 )); +return 0 ; }
Signature · 1 line
2.7.4
PATCH v2 11/17 octeontx2-af: NPC MCAM and LDATA extract minimal configuration
In reply to [email protected]From: Sunil Goutham <[email protected]>
This patch adds some minimal configuration for NPC MCAM and LDATA extraction which is sufficient enough to install ucast/bcast/promiscuous forwarding rules. Below is the config done
- LDATA extraction config to extract DMAC from pkt to offset 64bit in MCAM search key.
- Set MCAM lookup keysize to 224bits
- Set MCAM TX miss action to UCAST_DEFAULT
- Set MCAM RX miss action to DROP
Also inorder to have guaranteed space in MCAM to install ucast forwarding rule for each of RVU PF/VF, reserved one MCAM entry for each of NIXLF for ucast rule. And two entries for each of RVU PF. One for bcast pkt replication and other for promiscuous mode which allows all pkts received on a HW CGX/LBK channel.
--- drivers/net/ethernet/marvell/octeontx2/af/common.h | 21 ++++ drivers/net/ethernet/marvell/octeontx2/af/rvu.h | 14 +++ .../net/ethernet/marvell/octeontx2/af/rvu_nix.c | 12 ++ .../net/ethernet/marvell/octeontx2/af/rvu_npc.c | 134 +++++++++++++++++++++ 4 files changed, 181 insertions(+)
drivers/net/ethernet/marvell/octeontx2/af/common.h +21 -0
@@ -143,6 +143,27 @@ enum nix_scheduler { NIX_TXSCH_LVL_CNT = 0x5, }; +/* NIX RX action operation*/ +#define NIX_RX_ACTIONOP_DROP (0x0ull) +#define NIX_RX_ACTIONOP_UCAST (0x1ull) +#define NIX_RX_ACTIONOP_UCAST_IPSEC (0x2ull) +#define NIX_RX_ACTIONOP_MCAST (0x3ull) +#define NIX_RX_ACTIONOP_RSS (0x4ull) + +/* NIX TX action operation*/ +#define NIX_TX_ACTIONOP_DROP (0x0ull) +#define NIX_TX_ACTIONOP_UCAST_DEFAULT (0x1ull) +#define NIX_TX_ACTIONOP_UCAST_CHAN (0x2ull) +#define NIX_TX_ACTIONOP_MCAST (0x3ull) +#define NIX_TX_ACTIONOP_DROP_VIOL (0x5ull) + +#define NPC_MCAM_KEY_X1 0 +#define NPC_MCAM_KEY_X2 1 +#define NPC_MCAM_KEY_X4 2 + +#define NIX_INTF_RX 0 +#define NIX_INTF_TX 1 +#define NIX_INTF_TYPE_CGX 0#define NIX_INTF_TYPE_LBK 1
drivers/net/ethernet/marvell/octeontx2/af/rvu.h +14 -0
@@ -73,6 +73,18 @@ struct nix_mce_list {int max; }; +struct npc_mcam { +spinlock_t lock;/* MCAM entries and counters update lock */ +u8 keysize;/* MCAM keysize 112/224/448 bits */ +u8 banks;/* Number of MCAM banks */ +u8 banks_per_entry;/* Number of keywords in key */ +u16 banksize;/* Number of MCAM entries in each bank */ +u16 total_entries;/* Total number of MCAM entries */ +u16 entries;/* Total minus reserved for NIX LFs */ +u16 nixlf_offset;/* Offset of nixlf rsvd uncast entries */ +u16 pf_offset;/* Offset of PF's rsvd bcast, promisc entries */ +}; +/* Structure for per RVU func info ie PF/VF */ struct rvu_pfvf {bool npalf;/* Only one NPALF per RVU_FUNC */
@@ -144,6 +156,7 @@ struct rvu_hwinfo {struct rvu_block block[BLK_COUNT ];/* Block info */ struct nix_hw *nix0;struct npc_pkind pkind; +struct npc_mcam mcam; };struct rvu {
@@ -297,6 +310,7 @@ int rvu_mbox_handler_NPA_LF_FREE(struct rvu *rvu, struct msg_req *req,/* NIX APIs */ int rvu_nix_init (struct rvu *rvu);void rvu_nix_freemem (struct rvu *rvu); +int rvu_get_nixlf_count (struct rvu *rvu);int rvu_mbox_handler_NIX_LF_ALLOC (struct rvu *rvu,struct nix_lf_alloc_req *req,struct nix_lf_alloc_rsp *rsp);
drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c +12 -0
@@ -55,6 +55,18 @@ struct mce {u16 pcifunc; }; +int rvu_get_nixlf_count (struct rvu *rvu) +{ +struct rvu_block *block; +int blkaddr; + + blkaddr =rvu_get_blkaddr (rvu,BLKTYPE_NIX ,0 ); +if (blkaddr <0 ) +return 0 ; + block = &rvu->hw->block[blkaddr]; +return block->lf.max; +} +static void nix_mce_list_init (struct nix_mce_list *list,int max) {INIT_HLIST_HEAD (&list->head);
drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c +134 -0
161 lines not on this page · raw message
Signature · 1 line
2.7.4
PATCH v2 12/17 octeontx2-af: Add LMAC channel info to NIXLF_ALLOC response
In reply to [email protected]From: Stanislaw Kardach <[email protected]>
Add LMAC channel info like Rx/Tx channel base and count to NIXLF_ALLOC mailbox message response. This info is used by NIXLF attached RVU PF/VF to configure SQ's default channel, TL3_TL2_LINKX_CFG and to install MCAM rules in NPC based on matching ingress channel number.
--- drivers/net/ethernet/marvell/octeontx2/af/common.h | 1 + drivers/net/ethernet/marvell/octeontx2/af/mbox.h | 4 ++++ drivers/net/ethernet/marvell/octeontx2/af/rvu.h | 5 +++++ drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c | 8 ++++++++ 4 files changed, 18 insertions(+)
drivers/net/ethernet/marvell/octeontx2/af/common.h +1 -0
@@ -169,6 +169,7 @@ enum nix_scheduler {#define MAX_LMAC_PKIND 12#define NIX_LINK_CGX_LMAC (a, b) (0 + 4 * (a) + (b)) +#define NIX_CHAN_CGX_LMAC_CHX (a, b, c) (0x800 + 0x100 * (a) + 0x10 * (b) + (c))/* NIX LSO format indices. * As of now TSO is the only one using, so statically assigning indices.
drivers/net/ethernet/marvell/octeontx2/af/mbox.h +4 -0
@@ -382,6 +382,10 @@ struct nix_lf_alloc_req {struct nix_lf_alloc_rsp {struct mbox_msghdr hdr;u16 sqb_size; +u16 rx_chan_base; +u16 tx_chan_base; +u8 rx_chan_cnt;/* total number of RX channels */ +u8 tx_chan_cnt;/* total number of TX channels */ u8 lso_tsov4_idx;u8 lso_tsov6_idx;u8 mac_addr[ETH_ALEN ];
drivers/net/ethernet/marvell/octeontx2/af/rvu.h +5 -0
@@ -118,6 +118,11 @@ struct rvu_pfvf {unsigned long *rq_bmap;unsigned long *cq_bmap; +u16 rx_chan_base; +u16 tx_chan_base; +u8 rx_chan_cnt;/* total number of RX channels */ +u8 tx_chan_cnt;/* total number of TX channels */ +u8 mac_addr[ETH_ALEN ];/* MAC address of this PF/VF */ /* Broadcast pkt replication info */
drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c +8 -0
@@ -140,6 +140,10 @@ static int nix_interface_init(struct rvu *rvu, u16 pcifunc, int type, int nixlf) "PF_Func 0x%x: Invalid pkind\n", pcifunc);return -EINVAL ; } + pfvf->rx_chan_base =NIX_CHAN_CGX_LMAC_CHX (cgx_id, lmac_id,0 ); + pfvf->tx_chan_base = pfvf->rx_chan_base; + pfvf->rx_chan_cnt =1 ; + pfvf->tx_chan_cnt =1 ;cgx_set_pkind (rvu_cgx_pdata (cgx_id, rvu), lmac_id, pkind);rvu_npc_set_pkind (rvu, pkind, pfvf);break ;
@@ -799,6 +803,10 @@ int rvu_mbox_handler_NIX_LF_ALLOC(struct rvu *rvu,/* set SQB size info */ cfg =rvu_read64 (rvu, blkaddr,NIX_AF_SQ_CONST ); rsp->sqb_size = (cfg >>34 ) &0xFFFF ; + rsp->rx_chan_base = pfvf->rx_chan_base; + rsp->tx_chan_base = pfvf->tx_chan_base; + rsp->rx_chan_cnt = pfvf->rx_chan_cnt; + rsp->tx_chan_cnt = pfvf->tx_chan_cnt; rsp->lso_tsov4_idx =NIX_LSO_FORMAT_IDX_TSOV4 ; rsp->lso_tsov6_idx =NIX_LSO_FORMAT_IDX_TSOV6 ;return rc;
Signature · 1 line
2.7.4
PATCH v2 13/17 octeontx2-af: Install ucast and bcast pkt forwarding rules
In reply to [email protected]From: Sunil Goutham <[email protected]>
Upon NIXLF_ALLOC install a unicast forwarding rule in NPC MCAM like below
- Match pkt DMAC with NIXLF attached PF/VF's MAC address.
- Ingress channel
- Action is UCAST
- Forward to PF_FUNC of this NIXLF
And broadcast pkt forwarding rule as
- Match L2B bit in MCAM search key
- Ingress channel
- Action is UCAST, for now, later it will be changed to MCAST.
Only PFs can install this rule
Upon NIXLF_FREE disable all MCAM entries in use by that NIXLF.
--- drivers/net/ethernet/marvell/octeontx2/af/npc.h | 19 ++ drivers/net/ethernet/marvell/octeontx2/af/rvu.h | 5 + .../net/ethernet/marvell/octeontx2/af/rvu_nix.c | 14 + .../net/ethernet/marvell/octeontx2/af/rvu_npc.c | 337 +++++++++++++++++++++ 4 files changed, 375 insertions(+)
drivers/net/ethernet/marvell/octeontx2/af/npc.h +19 -0
@@ -240,4 +240,23 @@ struct npc_kpu_pkind_cpi_def { u64 ena : 1; #endif }; + +struct nix_rx_action { +#if defined(__BIG_ENDIAN_BITFIELD) +u64 rsvd_63_61 :3 ; +u64 flow_key_alg :5 ; +u64 match_id :16 ; +u64 index :20 ; +u64 pf_func :16 ; +u64 op :4 ; +#else +u64 op :4 ; +u64 pf_func :16 ; +u64 index :20 ; +u64 match_id :16 ; +u64 flow_key_alg :5 ; +u64 rsvd_63_61 :3 ; +#endif +}; +#endif /* NPC_H */
drivers/net/ethernet/marvell/octeontx2/af/rvu.h +5 -0
@@ -347,4 +347,9 @@ int rvu_npc_init(struct rvu *rvu);void rvu_npc_freemem (struct rvu *rvu);int rvu_npc_get_pkind (struct rvu *rvu,u16 pf);void rvu_npc_set_pkind (struct rvu *rvu,int pkind,struct rvu_pfvf *pfvf); +void rvu_npc_install_ucast_entry (struct rvu *rvu,u16 pcifunc, +int nixlf,u64 chan,u8 *mac_addr); +void rvu_npc_install_bcast_match_entry (struct rvu *rvu,u16 pcifunc, +int nixlf,u64 chan); +void rvu_npc_disable_mcam_entries (struct rvu *rvu,u16 pcifunc,int nixlf);#endif /* RVU_H */
drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c +14 -0
@@ -151,13 +151,24 @@ static int nix_interface_init(struct rvu *rvu, u16 pcifunc, int type, int nixlf)break ; } +/* Add a UCAST forwarding rule in MCAM with this NIXLF attached +* RVU PF/VF's MAC address. +*/ +rvu_npc_install_ucast_entry (rvu, pcifunc, nixlf, + pfvf->rx_chan_base, pfvf->mac_addr); +/* Add this PF_FUNC to bcast pkt replication list */ err =nix_update_bcast_mce_list (rvu, pcifunc, true);if (err) {dev_err (rvu->dev,"Bcast list, failed to enable PF_FUNC 0x%x\n" , pcifunc); +return err; } + +rvu_npc_install_bcast_match_entry (rvu, pcifunc, + nixlf, pfvf->rx_chan_base); +return 0 ; }
@@ -172,6 +183,9 @@ static void nix_interface_deinit(struct rvu *rvu, u16 pcifunc, u8 nixlf)"Bcast list, failed to disable PF_FUNC 0x%x\n" , pcifunc); } + +/* Free and disable any MCAM entries used by this NIX LF */ +rvu_npc_disable_mcam_entries (rvu, pcifunc, nixlf); } static void nix_setup_lso_tso_l3(struct rvu *rvu, int blkaddr,
drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c +337 -0
349 lines not on this page · raw message
Signature · 1 line
2.7.4
PATCH v2 14/17 octeontx2-af: NIX Rx flowkey configuration for RSS
In reply to [email protected]From: Sunil Goutham <[email protected]>
Configure NIX RX flowkey algorithm configuration to support RSS (receive side scaling). Currently support for only L3/L4 2-tuple and 4-tuple hash of IPv4/v6/TCP/UDP/SCTP is added. HW supports upto 32 different flowkey algorithms which SW can define, this patch defines 9. NPC RX ACTION has to point to one of these flowkey indices for RSS to work.
The configuration is dependent on NPC parse result's layer info. So if NPC KPU profile changes suchthat LID/LTYPE values of above said protocols change then this configuration will most likely be effected.
--- drivers/net/ethernet/marvell/octeontx2/af/common.h | 22 ++++ .../net/ethernet/marvell/octeontx2/af/rvu_nix.c | 135 +++++++++++++++++++++ .../net/ethernet/marvell/octeontx2/af/rvu_struct.h | 30 +++++ 3 files changed, 187 insertions(+)
drivers/net/ethernet/marvell/octeontx2/af/common.h +22 -0
@@ -186,4 +186,26 @@ enum nix_scheduler {#define DEFAULT_RSS_CONTEXT_GROUP 0#define MAX_RSS_INDIR_TBL_SIZE 256/* 1 << Max adder bits */ +/* NIX flow tag, key type flags */ +#define FLOW_KEY_TYPE_PORT BIT(0) +#define FLOW_KEY_TYPE_IPV4 BIT(1) +#define FLOW_KEY_TYPE_IPV6 BIT(2) +#define FLOW_KEY_TYPE_TCP BIT(3) +#define FLOW_KEY_TYPE_UDP BIT(4) +#define FLOW_KEY_TYPE_SCTP BIT(5) + +/* NIX flow tag algorithm indices, max is 31 */ +enum { +FLOW_KEY_ALG_PORT , +FLOW_KEY_ALG_IP , +FLOW_KEY_ALG_TCP , +FLOW_KEY_ALG_UDP , +FLOW_KEY_ALG_SCTP , +FLOW_KEY_ALG_TCP_UDP , +FLOW_KEY_ALG_TCP_SCTP , +FLOW_KEY_ALG_UDP_SCTP , +FLOW_KEY_ALG_TCP_UDP_SCTP , +FLOW_KEY_ALG_MAX , +}; +#endif /* COMMON_H */
drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c +135 -0
147 lines not on this page · raw message
drivers/net/ethernet/marvell/octeontx2/af/rvu_struct.h +30 -0
@@ -879,6 +879,36 @@ struct nix_lso_format {#endif }; +struct nix_rx_flowkey_alg { +#if defined(__BIG_ENDIAN_BITFIELD) +u64 reserved_35_63 :29 ; +u64 ltype_match :4 ; +u64 ltype_mask :4 ; +u64 sel_chan :1 ; +u64 ena :1 ; +u64 reserved_24_24 :1 ; +u64 lid :3 ; +u64 bytesm1 :5 ; +u64 hdr_offset :8 ; +u64 fn_mask :1 ; +u64 ln_mask :1 ; +u64 key_offset :6 ; +#else +u64 key_offset :6 ; +u64 ln_mask :1 ; +u64 fn_mask :1 ; +u64 hdr_offset :8 ; +u64 bytesm1 :5 ; +u64 lid :3 ; +u64 reserved_24_24 :1 ; +u64 ena :1 ; +u64 sel_chan :1 ; +u64 ltype_mask :4 ; +u64 ltype_match :4 ; +u64 reserved_35_63 :29 ; +#endif +}; +/* NIX VTAG size */ enum nix_vtag_size {VTAGSIZE_T4 =0x0 ,
Signature · 1 line
2.7.4
PATCH v2 15/17 octeontx2-af: Support for changing RSS algorithm
In reply to [email protected]From: Sunil Goutham <[email protected]>
This patch adds support for a RVU PF/VF to change NIX Rx flowkey algorithm index in NPC RX RSS_ACTION.
eg: a ethtool command changing RSS algorithm for a netdev interface would trigger this change in NPC.
If PF/VF doesn't specify any MCAM entry index then default UCAST entry of the NIXLF attached to PF/VF will be updated with RSS_ACTION and flowkey index.
--- drivers/net/ethernet/marvell/octeontx2/af/mbox.h | 10 ++++- drivers/net/ethernet/marvell/octeontx2/af/rvu.h | 5 +++ .../net/ethernet/marvell/octeontx2/af/rvu_nix.c | 51 ++++++++++++++++++++++ .../net/ethernet/marvell/octeontx2/af/rvu_npc.c | 43 ++++++++++++++++++ 4 files changed, 108 insertions(+), 1 deletion(-)
drivers/net/ethernet/marvell/octeontx2/af/mbox.h +9 -1
@@ -157,7 +157,8 @@ M(NIX_TXSCH_ALLOC, 0x8004, nix_txsch_alloc_req, nix_txsch_alloc_rsp) \ M(NIX_TXSCH_FREE, 0x8005, nix_txsch_free_req, msg_rsp) \ M(NIX_TXSCHQ_CFG, 0x8006, nix_txschq_config, msg_rsp) \ M(NIX_STATS_RST, 0x8007, msg_req, msg_rsp) \ -M (NIX_VTAG_CFG ,0x8008 , nix_vtag_config, msg_rsp) +M(NIX_VTAG_CFG, 0x8008, nix_vtag_config, msg_rsp) \ +M (NIX_RSS_FLOWKEY_CFG ,0x8009 , nix_rss_flowkey_cfg, msg_rsp) /* Messages initiated by AF (range 0xC00 - 0xDFF) */#define MBOX_UP_CGX_MESSAGES \
@@ -499,4 +500,11 @@ struct nix_vtag_config { }; }; +struct nix_rss_flowkey_cfg { +struct mbox_msghdr hdr; +int mcam_index;/* MCAM entry index to modify */ +u32 flowkey_cfg;/* Flowkey types selected */ +u8 group;/* RSS context or group */ +}; +#endif /* MBOX_H */
drivers/net/ethernet/marvell/octeontx2/af/rvu.h +5 -0
@@ -341,6 +341,9 @@ int rvu_mbox_handler_NIX_STATS_RST(struct rvu *rvu, struct msg_req *req,int rvu_mbox_handler_NIX_VTAG_CFG (struct rvu *rvu,struct nix_vtag_config *req,struct msg_rsp *rsp); +int rvu_mbox_handler_NIX_RSS_FLOWKEY_CFG (struct rvu *rvu, +struct nix_rss_flowkey_cfg *req, +struct msg_rsp *rsp);/* NPC APIs */ int rvu_npc_init (struct rvu *rvu);
@@ -352,4 +355,6 @@ void rvu_npc_install_ucast_entry(struct rvu *rvu, u16 pcifunc,void rvu_npc_install_bcast_match_entry (struct rvu *rvu,u16 pcifunc,int nixlf,u64 chan);void rvu_npc_disable_mcam_entries (struct rvu *rvu,u16 pcifunc,int nixlf); +void rvu_npc_update_flowkey_alg_idx (struct rvu *rvu,u16 pcifunc,int nixlf, +int group,int alg_idx,int mcam_index);#endif /* RVU_H */
drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c +51 -0
57 lines not on this page · raw message
drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c +43 -0
49 lines not on this page · raw message
Signature · 1 line
2.7.4
PATCH v2 16/17 octeontx2-af: Support for setting MAC address
In reply to [email protected]From: Sunil Goutham <[email protected]>
Added a new mailbox message for a PF/VF to set/update it's NIXLF's MAC address. Also updates unicast NPC MCAM entry with this address as matching DMAC.
--- drivers/net/ethernet/marvell/octeontx2/af/mbox.h | 8 ++++++- drivers/net/ethernet/marvell/octeontx2/af/rvu.h | 3 +++ .../net/ethernet/marvell/octeontx2/af/rvu_nix.c | 25 ++++++++++++++++++++++ 3 files changed, 35 insertions(+), 1 deletion(-)
drivers/net/ethernet/marvell/octeontx2/af/mbox.h +7 -1
@@ -158,7 +158,8 @@ M(NIX_TXSCH_FREE, 0x8005, nix_txsch_free_req, msg_rsp) \ M(NIX_TXSCHQ_CFG, 0x8006, nix_txschq_config, msg_rsp) \ M(NIX_STATS_RST, 0x8007, msg_req, msg_rsp) \ M(NIX_VTAG_CFG, 0x8008, nix_vtag_config, msg_rsp) \ -M (NIX_RSS_FLOWKEY_CFG ,0x8009 , nix_rss_flowkey_cfg, msg_rsp) +M(NIX_RSS_FLOWKEY_CFG, 0x8009, nix_rss_flowkey_cfg, msg_rsp) \ +M (NIX_SET_MAC_ADDR ,0x800a , nix_set_mac_addr, msg_rsp) /* Messages initiated by AF (range 0xC00 - 0xDFF) */#define MBOX_UP_CGX_MESSAGES \
@@ -507,4 +508,9 @@ struct nix_rss_flowkey_cfg { u8 group; /* RSS context or group */ }; +struct nix_set_mac_addr { +struct mbox_msghdr hdr; +u8 mac_addr[ETH_ALEN ];/* MAC address to be set for this pcifunc */ +}; +#endif /* MBOX_H */
drivers/net/ethernet/marvell/octeontx2/af/rvu.h +3 -0
@@ -344,6 +344,9 @@ int rvu_mbox_handler_NIX_VTAG_CFG(struct rvu *rvu,int rvu_mbox_handler_NIX_RSS_FLOWKEY_CFG (struct rvu *rvu,struct nix_rss_flowkey_cfg *req,struct msg_rsp *rsp); +int rvu_mbox_handler_NIX_SET_MAC_ADDR (struct rvu *rvu, +struct nix_set_mac_addr *req, +struct msg_rsp *rsp);/* NPC APIs */ int rvu_npc_init (struct rvu *rvu);
drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c +25 -0
@@ -1720,6 +1720,31 @@ static void nix_rx_flowkey_alg_cfg(struct rvu *rvu, int blkaddr) } } +int rvu_mbox_handler_NIX_SET_MAC_ADDR (struct rvu *rvu, +struct nix_set_mac_addr *req, +struct msg_rsp *rsp) +{ +struct rvu_hwinfo *hw = rvu->hw; +u16 pcifunc = req->hdr.pcifunc; +struct rvu_pfvf *pfvf; +int blkaddr, nixlf; + + 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 ; + + nixlf =rvu_get_lf (rvu, &hw->block[blkaddr], pcifunc,0 ); +if (nixlf <0 ) +return NIX_AF_ERR_AF_LF_INVALID ; + +ether_addr_copy (pfvf->mac_addr, req->mac_addr); + +rvu_npc_install_ucast_entry (rvu, pcifunc, nixlf, + pfvf->rx_chan_base, req->mac_addr); +return 0 ; +} +static int nix_calibrate_x2p (struct rvu *rvu,int blkaddr) {int idx, err;
Signature · 1 line
2.7.4
PATCH v2 17/17 octeontx2-af: Support for NIXLF's UCAST/PROMISC/ALLMULTI modes
In reply to [email protected]From: Sunil Goutham <[email protected]>
By default NIXLF is set in UCAST mode. This patch adds a new mailbox message which when sent by a RVU PF changes this default mode. When promiscuous mode is needed, the reserved promisc entry for each of RVU PF is setup to match against ingress channel number only, so that all pkts on that channel are accepted and forwarded to the mode change requesting PF_FUNC's NIXLF.
PROMISC and ALLMULTI modes are supported only for PFs, for VFs only UCAST mode is supported.
--- drivers/net/ethernet/marvell/octeontx2/af/mbox.h | 11 ++++- drivers/net/ethernet/marvell/octeontx2/af/rvu.h | 5 ++ .../net/ethernet/marvell/octeontx2/af/rvu_nix.c | 33 +++++++++++++ .../net/ethernet/marvell/octeontx2/af/rvu_npc.c | 57 ++++++++++++++++++++++ 4 files changed, 105 insertions(+), 1 deletion(-)
drivers/net/ethernet/marvell/octeontx2/af/mbox.h +10 -1
@@ -159,7 +159,8 @@ M(NIX_TXSCHQ_CFG, 0x8006, nix_txschq_config, msg_rsp) \ M(NIX_STATS_RST, 0x8007, msg_req, msg_rsp) \ M(NIX_VTAG_CFG, 0x8008, nix_vtag_config, msg_rsp) \ M(NIX_RSS_FLOWKEY_CFG, 0x8009, nix_rss_flowkey_cfg, msg_rsp) \ -M (NIX_SET_MAC_ADDR ,0x800a , nix_set_mac_addr, msg_rsp) +M(NIX_SET_MAC_ADDR, 0x800a, nix_set_mac_addr, msg_rsp) \ +M (NIX_SET_RX_MODE ,0x800b , nix_rx_mode, msg_rsp) /* Messages initiated by AF (range 0xC00 - 0xDFF) */#define MBOX_UP_CGX_MESSAGES \
@@ -513,4 +514,12 @@ struct nix_set_mac_addr { u8 mac_addr[ETH_ALEN]; /* MAC address to be set for this pcifunc */ }; +struct nix_rx_mode { +struct mbox_msghdr hdr; +#define NIX_RX_MODE_UCAST BIT(0) +#define NIX_RX_MODE_PROMISC BIT(1) +#define NIX_RX_MODE_ALLMULTI BIT(2) +u16 mode; +}; +#endif /* MBOX_H */
drivers/net/ethernet/marvell/octeontx2/af/rvu.h +5 -0
@@ -347,6 +347,8 @@ int rvu_mbox_handler_NIX_RSS_FLOWKEY_CFG(struct rvu *rvu,int rvu_mbox_handler_NIX_SET_MAC_ADDR (struct rvu *rvu,struct nix_set_mac_addr *req,struct msg_rsp *rsp); +int rvu_mbox_handler_NIX_SET_RX_MODE (struct rvu *rvu,struct nix_rx_mode *req, +struct msg_rsp *rsp);/* NPC APIs */ int rvu_npc_init (struct rvu *rvu);
@@ -355,6 +357,9 @@ int rvu_npc_get_pkind(struct rvu *rvu, u16 pf);void rvu_npc_set_pkind (struct rvu *rvu,int pkind,struct rvu_pfvf *pfvf);void rvu_npc_install_ucast_entry (struct rvu *rvu,u16 pcifunc,int nixlf,u64 chan,u8 *mac_addr); +void rvu_npc_install_promisc_entry (struct rvu *rvu,u16 pcifunc, +int nixlf,u64 chan,bool allmulti); +void rvu_npc_disable_promisc_entry (struct rvu *rvu,u16 pcifunc,int nixlf);void rvu_npc_install_bcast_match_entry (struct rvu *rvu,u16 pcifunc,int nixlf,u64 chan);void rvu_npc_disable_mcam_entries (struct rvu *rvu,u16 pcifunc,int nixlf);
drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c +33 -0
@@ -1745,6 +1745,39 @@ int rvu_mbox_handler_NIX_SET_MAC_ADDR(struct rvu *rvu,return 0 ; } +int rvu_mbox_handler_NIX_SET_RX_MODE (struct rvu *rvu,struct nix_rx_mode *req, +struct msg_rsp *rsp) +{ +bool allmulti = false, disable_promisc = false; +struct rvu_hwinfo *hw = rvu->hw; +u16 pcifunc = req->hdr.pcifunc; +struct rvu_pfvf *pfvf; +int blkaddr, nixlf; + + 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 ; + + nixlf =rvu_get_lf (rvu, &hw->block[blkaddr], pcifunc,0 ); +if (nixlf <0 ) +return NIX_AF_ERR_AF_LF_INVALID ; + +if (req->mode &NIX_RX_MODE_PROMISC ) + allmulti = false; +else if (req->mode &NIX_RX_MODE_ALLMULTI ) + allmulti = true; +else + disable_promisc = true; + +if (disable_promisc) +rvu_npc_disable_promisc_entry (rvu, pcifunc, nixlf); +else +rvu_npc_install_promisc_entry (rvu, pcifunc, nixlf, + pfvf->rx_chan_base, allmulti); +return 0 ; +} +static int nix_calibrate_x2p (struct rvu *rvu,int blkaddr) {int idx, err;
drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c +57 -0
69 lines not on this page · raw message
Signature · 1 line
2.7.4
David Miller
maintainerFrom: [email protected]
Date: Mon, 22 Oct 2018 23:25:47 +0530
Quoted 36 lines
From: Sunil Goutham <[email protected]>
This patchset is a continuation to earlier submitted two patch series to add a new driver for Marvell's OcteonTX2 SOC's Resource virtualization unit (RVU) admin function driver.
1. octeontx2-af: Add RVU Admin Function driver
https://www.spinics.net/lists/netdev/msg528272.html
2. octeontx2-af: NPA and NIX blocks initialization
https://www.spinics.net/lists/netdev/msg529163.htmlThis patch series adds more NIX block configuration logic and additionally adds NPC block parser profile configuration. In brief below is what this series adds.
NIX block:
- Support for PF/VF to allocate/free transmit scheduler queues, maintenance and their configuration.
- Adds support for packet replication lists, only broadcast packets is covered for now.
- Defines few RSS flow algorithms for HW to distribute packets. This is not the hash algorithsm (i.e toeplitz or crc32), here SW defines what fields in packet should HW take and calculate the hash.
- Support for PF/VF to configure VTAG strip and capture capabilities.
- Reset NIXLF statastics.NPC block:
This block has multiple parser engines which support packet parsing at multiple layers and generates a parse result which is further used to generate a key. Based on packet field offsets in the key, SW can install packet forwarding rules.
This patch series adds
- Initial parser profile to be programmed into parser engines.
- Default forwarding rules to forward packets to different logical interfaces having a NIXLF attached.
- Support for promiscuous and multicast modes.
Quoted 4 lines
Changes from v1:
1 Fixed kernel build failure when compiled withBIG_ENDIANenabled.
- Reported byKbuildtest robot
2 Fixed a warning observed when kernel is built with -Wunused-but-set-variable
Series applied.
Quoted 39 lines · David Miller
From: [email protected]
Date: Mon, 22 Oct 2018 23:25:47 +0530Quoted 36 lines
From: Sunil Goutham <[email protected]>
This patchset is a continuation to earlier submitted two patch series to add a new driver for Marvell's OcteonTX2 SOC's Resource virtualization unit (RVU) admin function driver.
1. octeontx2-af: Add RVU Admin Function driver
https://www.spinics.net/lists/netdev/msg528272.html
2. octeontx2-af: NPA and NIX blocks initialization
https://www.spinics.net/lists/netdev/msg529163.htmlThis patch series adds more NIX block configuration logic and additionally adds NPC block parser profile configuration. In brief below is what this series adds.
NIX block:
- Support for PF/VF to allocate/free transmit scheduler queues, maintenance and their configuration.
- Adds support for packet replication lists, only broadcast packets is covered for now.
- Defines few RSS flow algorithms for HW to distribute packets. This is not the hash algorithsm (i.e toeplitz or crc32), here SW defines what fields in packet should HW take and calculate the hash.
- Support for PF/VF to configure VTAG strip and capture capabilities.
- Reset NIXLF statastics.NPC block:
This block has multiple parser engines which support packet parsing at multiple layers and generates a parse result which is further used to generate a key. Based on packet field offsets in the key, SW can install packet forwarding rules.
This patch series adds
- Initial parser profile to be programmed into parser engines.
- Default forwarding rules to forward packets to different logical interfaces having a NIXLF attached.
- Support for promiscuous and multicast modes.
Quoted 7 lines
Quoted 5 lines
Changes from v1:
1 Fixed kernel build failure when compiled withBIG_ENDIANenabled.
- Reported byKbuildtest robot
2 Fixed a warning observed when kernel is built with
-Wunused-but-set-variableSeries applied.
I see this has been applied, but I'd still like to understand better how the configuration interface is expected to work once the driver is complete.
In particular, so far the interfaces all assume that configuration is done through the mailbox between PCI devices, which could be done from a virtual machine kernel with access to PCI, or through the use of VFIO from a user application.
Is that the only method of configuring it that you support, or will there also be a devlink based interface or something like that to configure the aspects of a virtual device that should not be accessible to the VF itself?
Arnd
Quoted 57 lines · Arnd Bergmann
Quoted 39 lines · David Miller
From: [email protected]
Date: Mon, 22 Oct 2018 23:25:47 +0530Quoted 36 lines
From: Sunil Goutham <[email protected]>
This patchset is a continuation to earlier submitted two patch series to add a new driver for Marvell's OcteonTX2 SOC's Resource virtualization unit (RVU) admin function driver.
1. octeontx2-af: Add RVU Admin Function driver
https://www.spinics.net/lists/netdev/msg528272.html
2. octeontx2-af: NPA and NIX blocks initialization
https://www.spinics.net/lists/netdev/msg529163.htmlThis patch series adds more NIX block configuration logic and additionally adds NPC block parser profile configuration. In brief below is what this series adds.
NIX block:
- Support for PF/VF to allocate/free transmit scheduler queues, maintenance and their configuration.
- Adds support for packet replication lists, only broadcast packets is covered for now.
- Defines few RSS flow algorithms for HW to distribute packets. This is not the hash algorithsm (i.e toeplitz or crc32), here SW defines what fields in packet should HW take and calculate the hash.
- Support for PF/VF to configure VTAG strip and capture capabilities.
- Reset NIXLF statastics.NPC block:
This block has multiple parser engines which support packet parsing at multiple layers and generates a parse result which is further used to generate a key. Based on packet field offsets in the key, SW can install packet forwarding rules.
This patch series adds
- Initial parser profile to be programmed into parser engines.
- Default forwarding rules to forward packets to different logical interfaces having a NIXLF attached.
- Support for promiscuous and multicast modes.Quoted 7 lines
Quoted 5 lines
Changes from v1:
1 Fixed kernel build failure when compiled withBIG_ENDIANenabled.
- Reported byKbuildtest robot
2 Fixed a warning observed when kernel is built with
-Wunused-but-set-variableSeries applied.
I see this has been applied, but I'd still like to understand better how the configuration interface is expected to work once the driver is complete.
In particular, so far the interfaces all assume that configuration is done through the mailbox between PCI devices, which could be done from a virtual machine kernel with access to PCI, or through the use of VFIO from a user application.
Quoted 6 lines
Is that the only method of configuring it that you support, or will there also be a devlink based interface or something like that to configure the aspects of a virtual device that should not be accessible to the VF itself?
Arnd
As of now it's only mbox based configuration that is supported.
Thanks,
Sunil.
Quoted 11 lines · Sunil Kovvuri
Quoted 10 lines · Arnd Bergmann
I see this has been applied, but I'd still like to understand better how the
configuration interface is expected to work once the driver is complete.In particular, so far the interfaces all assume that configuration is done through the mailbox between PCI devices, which could be done from a virtual machine kernel with access to PCI, or through the use of VFIO from a user application.
Quoted 8 lines
Quoted 5 lines
Is that the only method of configuring it that you support, or will there also be a devlink based interface or something like that to configure the aspects of a virtual device that should not be accessible to the VF itself?
As of now it's only mbox based configuration that is supported.
Ok, thanks for the clarification.
Does this mean that you intend to have user space tools that use the mbox based interface on VFIO devices to perform configuration for virtual network devices, or just that the configuration interface is something that needs to be designed later?
I fear that setting a precedent of using the mbox for user-level configuration management would mean that we would have to treat each of these interfaces as an ABI, which in turn requires much deeper review as well as raising the fundamental question on how this should be done across drivers. The mailbox interface seem inherently nonportable to other hardware here, which is a significant downside.
Arnd
Quoted 7 lines
I fear that setting a precedent of using the mbox for user-level configuration management would mean that we would have to treat each of these interfaces as an ABI, which in turn requires much deeper review as well as raising the fundamental question on how this should be done across drivers. The mailbox interface seem inherently nonportable to other hardware here, which is a significant downside.
Hi Arnd
You might want to go look at the Freescale DPAA2. They also want to add an ioctl to pass binary blob commands to their firmware. The patches were re-posted recently.
https://lkml.org/lkml/2018/10/5/873
When this was first posted, i strongly argued against it. You also commented about this:
https://lkml.org/lkml/2018/3/24/29
We need to consistent here. I think it is a bad idea.
Andrew
Quoted 15 lines · Andrew Lunn
Quoted 8 lines
I fear that setting a precedent of using the mbox for user-level configuration management would mean that we would have to treat each of these interfaces as an ABI, which in turn requires much deeper review as well as raising the fundamental question on how this should be done across drivers. The mailbox interface seem inherently nonportable to other hardware here, which is a significant downside.
Hi Arnd
You might want to go look at the Freescale DPAA2. They also want to add an ioctl to pass binary blob commands to their firmware. The patches were re-posted recently.
Quoted 8 lines
https://lkml.org/lkml/2018/10/5/873
When this was first posted, i strongly argued against it. You also commented about this:
https://lkml.org/lkml/2018/3/24/29
We need to consistent here. I think it is a bad idea.
I agree, and this is exactly why I commented here. I just wanted to first ensure that it's not me misunderstanding the scope and intention of the interfaces here before I say it's a mistake.
Arnd
Quoted 20 lines · Arnd Bergmann
Quoted 18 lines · Sunil Kovvuri
Quoted 15 lines · Arnd Bergmann
I see this has been applied, but I'd still like to understand better how the
configuration interface is expected to work once the driver is complete.In particular, so far the interfaces all assume that configuration is done through the mailbox between PCI devices, which could be done from a virtual machine kernel with access to PCI, or through the use of VFIO from a user application.
Is that the only method of configuring it that you support, or will there also be a devlink based interface or something like that to configure the aspects of a virtual device that should not be accessible to the VF itself?
Quoted 9 lines
Quoted 1 line
As of now it's only mbox based configuration that is supported.
Ok, thanks for the clarification.
Does this mean that you intend to have user space tools that use the mbox based interface on VFIO devices to perform configuration for virtual network devices, or just that the configuration interface is something that needs to be designed later?
No there is no need for any userspace tools.
It's the virtual network device's driver which will send commands like resource allocation, configuration, stats retrieval to this AF device via mbox interface.
eg: A user using ethtool changes RSS settings for the network device, network device's driver receives the data, prepares a mailbox command sends it to this driver for configuring the same in HW.
Thanks,
Sunil.
Quoted 37 lines · Sunil Kovvuri
Quoted 20 lines · Arnd Bergmann
Quoted 18 lines · Sunil Kovvuri
Quoted 15 lines · Arnd Bergmann
I see this has been applied, but I'd still like to understand better how the
configuration interface is expected to work once the driver is complete.In particular, so far the interfaces all assume that configuration is done through the mailbox between PCI devices, which could be done from a virtual machine kernel with access to PCI, or through the use of VFIO from a user application.
Is that the only method of configuring it that you support, or will there also be a devlink based interface or something like that to configure the aspects of a virtual device that should not be accessible to the VF itself?
Quoted 9 lines
Quoted 1 line
As of now it's only mbox based configuration that is supported.
Ok, thanks for the clarification.
Does this mean that you intend to have user space tools that use the mbox based interface on VFIO devices to perform configuration for virtual network devices, or just that the configuration interface is something that needs to be designed later?
No there is no need for any userspace tools.
It's the virtual network device's driver which will send commands like resource allocation, configuration, stats retrieval to this AF device via mbox interface.
Quoted 6 lines
eg: A user using ethtool changes RSS settings for the network device, network device's driver receives the data, prepares a mailbox command sends it to this driver for configuring the same in HW.
Thanks,
Sunil.
To be more clear there is no mbox 'interface' as such.
Here PCI devices shares a memory region, one device prepares a command in this shared memory and writes into a doorbell kind of register which triggers an IRQ to other device. Which then takes the command processes it.
Thanks,
Sunil.
Quoted 15 lines · Sunil Kovvuri
Quoted 14 lines · Sunil Kovvuri
Quoted 12 lines · Arnd Bergmann
Quoted 4 lines · Sunil Kovvuri
On Fri, Oct 26, 2018 at 6:24 PM Arnd Bergmann <[email protected]> wrote:
As of now it's only mbox based configuration that is supported.
Ok, thanks for the clarification.
Does this mean that you intend to have user space tools that use the mbox based interface on VFIO devices to perform configuration for virtual network devices, or just that the configuration interface is something that needs to be designed later?
Quoted 8 lines
Quoted 8 lines
No there is no need for any userspace tools.
It's the virtual network device's driver which will send commands like resource allocation, configuration, stats retrieval to this AF device via mbox interface.eg: A user using ethtool changes RSS settings for the network device, network device's driver receives the data, prepares a mailbox command sends it to this driver for configuring the same in HW.
Ok, that part is mostly fine, as within a given host you can just have multiple network interfaces that you can each configure independently, and the mailbox interface for the most part is an implementation detail.
Doing the same in virtual machines means that the mailbox interface becomes an ABI between the driver in the guest and the driver in the host. This is still not too bad, in the worst case the guest might have to detect the version of the host that's running and support both an old and new version of the interface. There is reasonable hope that you don't need to revise the interface here; it's not much different from talking to firmware, and having both sides of the interface under the control of Linux may in fact be better.
Once the interface gets exposed to stuff like ODP or DPDK, it effectively becomes a user space interface, and that carries risk of being abused for passing lots of other stuff, so this is the point where we have to be very careful.
Aside from this, there is the stuff that Andrew mentioned, which is the most important: For anything that should /not/ be controlled by a network interface for itself, you still need an administrative interface. An example of this would be creating additional virtual functions, assigning bandwidth allocation between them, or limiting the data that can be transferred to and from a virtual function.
Can you explain what your plan is to handle those?
Quoted 4 lines
To be more clear there is no mbox 'interface' as such.
Here PCI devices shares a memory region, one device prepares a command in this shared memory and writes into a doorbell kind of register which triggers an IRQ to other device. Which then takes the command processes it.
Yes, this part was already clear to me.
Arnd
Quoted 30 lines · Arnd Bergmann
Quoted 15 lines · Sunil Kovvuri
Quoted 14 lines · Sunil Kovvuri
Quoted 12 lines · Arnd Bergmann
Quoted 4 lines · Sunil Kovvuri
On Fri, Oct 26, 2018 at 6:24 PM Arnd Bergmann <[email protected]> wrote:
As of now it's only mbox based configuration that is supported.
Ok, thanks for the clarification.
Does this mean that you intend to have user space tools that use the mbox based interface on VFIO devices to perform configuration for virtual network devices, or just that the configuration interface is something that needs to be designed later?
Quoted 8 lines
Quoted 8 lines
No there is no need for any userspace tools.
It's the virtual network device's driver which will send commands like resource allocation, configuration, stats retrieval to this AF device via mbox interface.eg: A user using ethtool changes RSS settings for the network device, network device's driver receives the data, prepares a mailbox command sends it to this driver for configuring the same in HW.
Ok, that part is mostly fine, as within a given host you can just have multiple network interfaces that you can each configure independently, and the mailbox interface for the most part is an implementation detail.
Quoted 8 lines
Doing the same in virtual machines means that the mailbox interface becomes an ABI between the driver in the guest and the driver in the host. This is still not too bad, in the worst case the guest might have to detect the version of the host that's running and support both an old and new version of the interface. There is reasonable hope that you don't need to revise the interface here; it's not much different from talking to firmware, and having both sides of the interface under the control of Linux may in fact be better.
Yes, except for minor changes i don't think base mechanism will change.
Quoted 6 lines
Once the interface gets exposed to stuff like ODP or DPDK, it effectively becomes a user space interface, and that carries risk of being abused for passing lots of other stuff, so this is the point where we have to be very careful.
Agreed.
Quoted 9 lines
Aside from this, there is the stuff that Andrew mentioned, which is the most important: For anything that should /not/ be controlled by a network interface for itself, you still need an administrative interface. An example of this would be creating additional virtual functions, assigning bandwidth allocation between them, or limiting the data that can be transferred to and from a virtual function.
Can you explain what your plan is to handle those?
This part is still under discussion, will get back on this. Currently we are looking at a way for a administrator to limit the amount of resources that can be attached / allocated to a virtual function. Allowing administrator
to limit data transfer or to give priorities etc is complex, we will look into that stuff
later on.
Thanks,
Sunil.
Quoted 10 lines · Sunil Kovvuri
Quoted 9 lines · Arnd Bergmann
Quoted 1 line · Sunil Kovvuri
On Fri, Oct 26, 2018 at 9:56 PM Sunil Kovvuri <[email protected]> wrote:
Aside from this, there is the stuff that Andrew mentioned, which is the most important: For anything that should /not/ be controlled by a network interface for itself, you still need an administrative interface. An example of this would be creating additional virtual functions, assigning bandwidth allocation between them, or limiting the data that can be transferred to and from a virtual function.
Quoted 4 lines
Quoted 2 lines
Can you explain what your plan is to handle those?
This part is still under discussion, will get back on this.
Ok, no worries.
Quoted 4 lines
Currently we are looking at a way for a administrator to limit the amount of resources that can be attached / allocated to a virtual function. Allowing administrator to limit data transfer or to give priorities etc is complex, we will look into that stuff later on.
Makes sense. When you get there, please have a look at how 'devlink' is used in the mlx4/5, bnxt, liquidio, and nfp drivers. As I understand it, that is what you need here, and you may be able to directly implement the same interface that they have defined.
Arnd
Quoted 1 line
No there is no need for any userspace tools.
Cool.
The problem with the Freescale architecture is that you seem to need to provision the hardware. Tell it how many instances of various things to create, and how to logically connect them together. They have a user space tool to do this, in an opaque way.
But it sounds like you don't need anything like this.
Andrew
David Miller
maintainerFrom: Arnd Bergmann <[email protected]>
Date: Fri, 26 Oct 2018 16:04:44 +0200
Quoted 7 lines
I fear that setting a precedent of using the mbox for user-level configuration management would mean that we would have to treat each of these interfaces as an ABI, which in turn requires much deeper review as well as raising the fundamental question on how this should be done across drivers. The mailbox interface seem inherently nonportable to other hardware here, which is a significant downside.
+1