octeontx2-pf: Add support for offload tc with skbedit mark action
Subsystems (4)
Geetha sowjanya
maintainerPATCH 1/1 octeontx2-pf: Add support for offload tc with skbedit mark action
Support offloading of skbedit mark action.
For example, to mark with 0x0008, with dest ip 60.60.60.2 on eth2 interface:
# tc qdisc add dev eth2 ingress
# tc filter add dev eth2 ingress protocol ip flower \
dst_ip 60.60.60.2 action skbedit mark 0x0008 skip_sw--- .../net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c | 2 ++ .../ethernet/marvell/octeontx2/nic/otx2_common.h | 2 ++ .../net/ethernet/marvell/octeontx2/nic/otx2_tc.c | 13 +++++++++++++ .../net/ethernet/marvell/octeontx2/nic/otx2_txrx.c | 3 +++ .../net/ethernet/marvell/octeontx2/nic/otx2_txrx.h | 3 +++ 5 files changed, 23 insertions(+)
drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c +2 -0
@@ -1183,6 +1183,8 @@ static int npc_update_rx_entry(struct rvu *rvu, struct rvu_pfvf *pfvf, action.pf_func = target; action.op =NIX_RX_ACTIONOP_UCAST ; } +if (req->match_id) + action.match_id = req->match_id; } entry->action = *(u64 *)&action;
drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h +2 -0
@@ -363,6 +363,7 @@ struct otx2_flow_config {struct list_head flow_list;u32 dmacflt_max_flows;u16 max_flows; +u16 mark_flows;struct list_head flow_list_tc;bool ntuple; };
@@ -465,6 +466,7 @@ struct otx2_nic {#define OTX2_FLAG_DMACFLTR_SUPPORT BIT_ULL(14)#define OTX2_FLAG_PTP_ONESTEP_SYNC BIT_ULL(15)#define OTX2_FLAG_ADPTV_INT_COAL_ENABLED BIT_ULL(16) +#define OTX2_FLAG_TC_MARK_ENABLED BIT_ULL(17)u64 flags;u64 *cq_op_addr;
drivers/net/ethernet/marvell/octeontx2/nic/otx2_tc.c +13 -0
@@ -511,7 +511,15 @@ static int otx2_tc_parse_actions(struct otx2_nic *nic, nr_police++;break ;case FLOW_ACTION_MARK : +if (act->mark & ~OTX2_RX_MATCH_ID_MASK ) { +NL_SET_ERR_MSG_MOD (extack,"Bad flow mark, only 16 bit supported" ); +return -EOPNOTSUPP ; + } mark = act->mark; + req->match_id = mark &0xFFFFULL ; + req->op =NIX_RX_ACTION_DEFAULT ; + nic->flags |=OTX2_FLAG_TC_MARK_ENABLED ; + nic->flow_cfg->mark_flows++;break ;case FLOW_ACTION_RX_QUEUE_MAPPING :
@@ -1173,6 +1181,11 @@ static int otx2_tc_del_flow(struct otx2_nic *nic,return -EINVAL ; } +/* Disable TC MARK flag if they are no rules with skbedit mark action */ +if (flow_node->req.match_id) +if (!(--flow_cfg->mark_flows)) + nic->flags &= ~OTX2_FLAG_TC_MARK_ENABLED ; +if (flow_node->is_act_police) {__clear_bit (flow_node->rq, &nic->rq_bmap);
drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c +3 -0
@@ -380,6 +380,9 @@ static void otx2_rcv_pkt_handler(struct otx2_nic *pfvf,if (pfvf->netdev->features &NETIF_F_RXCSUM ) skb->ip_summed =CHECKSUM_UNNECESSARY ; +if (pfvf->flags &OTX2_FLAG_TC_MARK_ENABLED ) + skb->mark = parse->match_id; +skb_mark_for_recycle (skb);napi_gro_frags (napi);
drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.h +3 -0
@@ -62,6 +62,9 @@#define CQ_OP_STAT_OP_ERR 63#define CQ_OP_STAT_CQ_ERR 46 +/* Packet mark mask */ +#define OTX2_RX_MATCH_ID_MASK 0x0000ffff +struct queue_stats {u64 bytes;u64 pkts;
Signature · 1 line
2.25.1
Paolo Abeni
maintainerQuoted 36 lines · Geetha sowjanya
Support offloading of skbedit mark action.
For example, to mark with
0x0008, with dest ip 60.60.60.2 on eth2 interface:# tc qdisc add dev eth2 ingress # tc filter add dev eth2 ingress protocol ip flower \ dst_ip 60.60.60.2 action skbedit mark 0x0008 skip_swSigned-off-by Geetha sowjanya <[email protected]>--- .../net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c | 2 ++ .../ethernet/marvell/octeontx2/nic/otx2_common.h | 2 ++ .../net/ethernet/marvell/octeontx2/nic/otx2_tc.c | 13 +++++++++++++ .../net/ethernet/marvell/octeontx2/nic/otx2_txrx.c | 3 +++ .../net/ethernet/marvell/octeontx2/nic/otx2_txrx.h | 3 +++ 5 files changed, 23 insertions(+)drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c +2
-0@@ -1183,6 +1183,8 @@ static int npc_update_rx_entry(struct rvu *rvu, struct rvu_pfvf *pfvf, action.pf_func = target; action.op =NIX_RX_ACTIONOP_UCAST ; } +if (req->match_id) + action.match_id = req->match_id; } entry->action = *(u64 *)&action;drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h +0
-0
drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h struct otx2_flow_config { · line 366
Quoted 4 lines
drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h +1
-0@@ -363,6 +363,7 @@ struct otx2_flow_config {struct list_head flow_list;u32 dmacflt_max_flows;u16 max_flows; +u16 mark_flows;
Since the above fields is used as (reference) counter for the OTX2_FLAG_TC_MARK_ENABLED bit, what about using a refcount_t, so you gain sanity checks for free?
Thanks!
Paolo
Geethasowjanya Akula
maintainerHi Paolo,
Quoted 44 lines
-----Original Message-----
From: Paolo Abeni <[email protected]>
Sent: Tuesday, April 9, 2024 5:37 PM
To: Geethasowjanya Akula <[email protected]>; [email protected]; [email protected]
Cc: [email protected]; [email protected]; [email protected]; Sunil Kovvuri Goutham <[email protected]>; Subbaraya Sundeep Bhatta <[email protected]>; Hariprasad Kelam <[email protected]>
Subject: [EXTERNAL] Re: [net-next PATCH] octeontx2-pf: Add support for offload tc with skbedit mark action
----------------------------------------------------------------------drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c static int npc_update_rx_entry(struct rvu *rvu,
Quoted 24 lines · Geetha sowjanya
Support offloading of skbedit mark action.
For example, to mark with
0x0008, with dest ip 60.60.60.2 on eth2 interface:# tc qdisc add dev eth2 ingress # tc filter add dev eth2 ingress protocol ip flower \ dst_ip 60.60.60.2 action skbedit mark 0x0008 skip_swSigned-off-by Geetha sowjanya <[email protected]>--- .../net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c | 2 ++ .../ethernet/marvell/octeontx2/nic/otx2_common.h | 2 ++ .../net/ethernet/marvell/octeontx2/nic/otx2_tc.c | 13 +++++++++++++ .../net/ethernet/marvell/octeontx2/nic/otx2_txrx.c | 3 +++ .../net/ethernet/marvell/octeontx2/nic/otx2_txrx.h | 3 +++ 5 files changed, 23 insertions(+)drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c +0
-0@@ -1183,6 +1183,8 @@ static int npc_update_rx_entry(struct rvu *rvu,struct
rvu_pfvf*pfvf,Quoted 7 lines
drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c +2
-0action.pf_func = target; action.op =NIX_RX_ACTIONOP_UCAST ; } +if (req->match_id) + action.match_id = req->match_id; }
Quoted 16 lines
drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h struct otx2_flow_config { · line 366
Quoted 11 lines
drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c +0
-0entry->action = *(u64 *)&action;drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h +1
-0@@ -363,6 +363,7 @@ struct otx2_flow_config {struct list_head flow_list;u32 dmacflt_max_flows;u16 max_flows; +u16 mark_flows;Since the above fields is used as (reference) counter for the
OTX2_FLAG_TC_MARK_ENABLEDbit, what about using arefcount_t, so you gain sanity checks for free?
Ok, will submit v2 with suggested change.
Thank you.
Geetha.
Quoted 3 lines
Thanks!
Paolo