Add tc hardware offloads
Subsystems (4)
cover Add tc hardware offloads
This patch series adds support for tc hardware offloads.
Patch #1 adds support for offloading flows that matches IP tos and IP
protocol which will be used by tc hw offload support. Also added ethtool n-tuple filter to code to offload the flows matching the above fields.
Patch #2 adds tc flower hardware offload support on ingress traffic. Patch #3 adds TC flower offload stats.
Patch #4 adds tc TC_MATCHALL egress ratelimiting offload.
* tc flower hardware offload in PF driver
The driver parses the flow match fields and actions received from the tc subsystem and adds/delete MCAM rules for the same. Each flow contains set of match and action fields. If the action or fields are not supported, the rule cannot be offloaded to hardware. The tc uses same set of MCAM rules allocated for ethtool n-tuple filters. So, at a time only one entity can offload the flows to hardware, they're made mutually exclusive in the driver.
Following match and actions are supported.
Match: Eth dst_mac, EtherType, 802.1Q {vlan_id,vlan_prio}, vlan EtherType,
IP proto {tcp,udp,sctp,icmp,icmp6}, IPv4 tos, IPv4{dst_ip,src_ip}, L4 proto {dst_port|src_port number}.
Actions: drop, accept, vlan pop, redirect to another port on the device.
The Hardware stats are also supported. Currently only packet counter stats are updated.
* tc egress rate limiting support
Added TC-MATCHALL classifier offload with police action applied for all egress traffic on the specified interface.
Naveen Mamindlapalli (3):
octeontx2-pf: Add ip tos and ip proto icmp/icmpv6 flow offload support
octeontx2-pf: Add tc flower hardware offload on ingress traffic
octeontx2-pf: add tc flower stats handler for hw offloads
Sunil Goutham (1):
octeontx2-pf: TC_MATCHALL egress ratelimiting offload
drivers/net/ethernet/marvell/octeontx2/af/mbox.h | 14 + drivers/net/ethernet/marvell/octeontx2/af/npc.h | 2 + .../ethernet/marvell/octeontx2/af/rvu_debugfs.c | 2 +- .../net/ethernet/marvell/octeontx2/af/rvu_npc.c | 39 + .../net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c | 17 +- .../net/ethernet/marvell/octeontx2/nic/Makefile | 2 +- .../ethernet/marvell/octeontx2/nic/otx2_common.h | 20 + .../ethernet/marvell/octeontx2/nic/otx2_flows.c | 47 +- .../net/ethernet/marvell/octeontx2/nic/otx2_pf.c | 37 + .../net/ethernet/marvell/octeontx2/nic/otx2_reg.h | 1 + .../net/ethernet/marvell/octeontx2/nic/otx2_tc.c | 786 +++++++++++++++++++++ 11 files changed, 961 insertions(+), 6 deletions(-) create mode 100644 drivers/net/ethernet/marvell/octeontx2/nic/otx2_tc.c
Signature · 1 line
2.16.5
PATCH 1/4 octeontx2-pf: Add ip tos and ip proto icmp/icmpv6 flow offload support
Add support for programming the HW MCAM match key with IP tos, IP(v6) proto icmp/icmpv6, allowing flow offload rules to be installed using those fields. The NPC HW extracts layer type, which will be used as a matching criteria for different IP protocols.
The ethtool n-tuple filter logic has been updated to parse the IP tos and l4proto for HW offloading. l4proto tcp/udp/sctp/ah/esp/icmp are supported. See example usage below.
Ex: Redirect l4proto icmp to vf 0 queue 0
ethtool -U eth0 flow-type ip4 l4proto 1 action vf 0 queue 0
Ex: Redirect flow with ip tos 8 to vf 0 queue 0
ethtool -U eth0 flow-type ip4 tos 8 vf 0 queue 0
--- drivers/net/ethernet/marvell/octeontx2/af/npc.h | 2 ++ .../net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c | 17 +++++++-- .../ethernet/marvell/octeontx2/nic/otx2_flows.c | 42 ++++++++++++++++++++-- 3 files changed, 57 insertions(+), 4 deletions(-)
drivers/net/ethernet/marvell/octeontx2/af/npc.h +2 -0
@@ -167,6 +167,8 @@ enum key_fields {NPC_IPPROTO_SCTP ,NPC_IPPROTO_AH ,NPC_IPPROTO_ESP , +NPC_IPPROTO_ICMP , +NPC_IPPROTO_ICMP6 ,NPC_SPORT_TCP ,NPC_DPORT_TCP , NPC_SPORT_UDP,
drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c +15 -2
@@ -29,6 +29,8 @@ static const char * const npc_flow_names[] = { [NPC_IPPROTO_TCP] = "ip proto tcp", [NPC_IPPROTO_UDP] = "ip proto udp", [NPC_IPPROTO_SCTP] = "ip proto sctp", + [NPC_IPPROTO_ICMP] = "ip proto icmp", + [NPC_IPPROTO_ICMP6] = "ip proto icmp6", [NPC_IPPROTO_AH] = "ip proto AH", [NPC_IPPROTO_ESP] = "ip proto ESP", [NPC_SPORT_TCP] = "tcp source port",
@@ -427,6 +429,7 @@ do { \* packet header fields below. * Example: Source IP is 4 bytes and starts at 12th byte of IP header */ +NPC_SCAN_HDR (NPC_TOS ,NPC_LID_LC ,NPC_LT_LC_IP ,1 ,1 );NPC_SCAN_HDR (NPC_SIP_IPV4 ,NPC_LID_LC ,NPC_LT_LC_IP ,12 ,4 );NPC_SCAN_HDR (NPC_DIP_IPV4 ,NPC_LID_LC ,NPC_LT_LC_IP ,16 ,4 );NPC_SCAN_HDR (NPC_SIP_IPV6 ,NPC_LID_LC ,NPC_LT_LC_IP6 ,8 ,16 );
@@ -477,9 +480,12 @@ static void npc_set_features(struct rvu *rvu, int blkaddr, u8 intf)BIT_ULL (NPC_IPPROTO_SCTP ); } -/* for AH, check if corresponding layer type is present in the key */ -if (npc_check_field (rvu, blkaddr,NPC_LD , intf)) +/* for AH/ICMP/ICMPv6/, check if corresponding layer type is present in the key */ +if (npc_check_field (rvu, blkaddr,NPC_LD , intf)) { *features |=BIT_ULL (NPC_IPPROTO_AH ); + *features |=BIT_ULL (NPC_IPPROTO_ICMP ); + *features |=BIT_ULL (NPC_IPPROTO_ICMP6 ); + }/* for ESP, check if corresponding layer type is present in the key */ if (npc_check_field (rvu, blkaddr,NPC_LE , intf))
@@ -769,6 +775,12 @@ static void npc_update_flow(struct rvu *rvu, struct mcam_entry *entry,if (features &BIT_ULL (NPC_IPPROTO_SCTP ))npc_update_entry (rvu,NPC_LD , entry,NPC_LT_LD_SCTP ,0 , ~0ULL ,0 , intf); +if (features &BIT_ULL (NPC_IPPROTO_ICMP )) +npc_update_entry (rvu,NPC_LD , entry,NPC_LT_LD_ICMP , +0 , ~0ULL ,0 , intf); +if (features &BIT_ULL (NPC_IPPROTO_ICMP6 )) +npc_update_entry (rvu,NPC_LD , entry,NPC_LT_LD_ICMP6 , +0 , ~0ULL ,0 , intf);if (features &BIT_ULL (NPC_OUTER_VID )) npc_update_entry(rvu, NPC_LB, entry,
@@ -798,6 +810,7 @@ do { \NPC_WRITE_FLOW (NPC_SMAC , smac, smac_val,0 , smac_mask,0 );NPC_WRITE_FLOW (NPC_ETYPE , etype,ntohs (pkt->etype),0 ,ntohs (mask->etype),0 ); +NPC_WRITE_FLOW (NPC_TOS , tos, pkt->tos,0 , mask->tos,0 );NPC_WRITE_FLOW (NPC_SIP_IPV4 , ip4src,ntohl (pkt->ip4src),0 ,ntohl (mask->ip4src),0 ); NPC_WRITE_FLOW(NPC_DIP_IPV4, ip4dst, ntohl(pkt->ip4dst), 0,
drivers/net/ethernet/marvell/octeontx2/nic/otx2_flows.c +40 -2
62 lines not on this page · raw message
Signature · 1 line
2.16.5
PATCH 2/4 octeontx2-pf: Add tc flower hardware offload on ingress traffic
In reply to Naveen MamindlapalliThis patch adds support for tc flower hardware offload on ingress traffic. Since the tc-flower filter rules use the same set of MCAM rules as the n-tuple filters, the n-tuple filters and tc flower rules are mutually exclusive. When one of the feature is enabled using ethtool, the other feature is disabled in the driver. By default the driver enables n-tuple filters during initialization.
The following flow keys are supported.
-> Ethernet: dst_mac
-> L2 proto: all protocols
-> VLAN (802.1q): vlan_id/vlan_prio
-> IPv4: dst_ip/src_ip/ip_proto{tcp|udp|sctp|icmp}/ip_tos
-> IPv6: ip_proto{icmpv6}
-> L4(tcp/udp/sctp): dst_port/src_portThe following flow actions are supported.
-> drop
-> accept
-> redirect
-> vlan popThe flow action supports multiple actions when vlan pop is specified as the first action. The redirect action supports redirecting to the PF/VF of same PCI device. Redirecting to other PCI NIX devices is not supported.
Example #1: Add a tc filter rule to drop UDP traffic with dest port 80
# ethtool -K eth0 hw-tc-offload on
# tc qdisc add dev eth0 ingress
# tc filter add dev eth0 protocol ip parent ffff: flower ip_proto \
udp dst_port 80 action dropExample #2: Add a tc filter rule to redirect ingress traffic on eth0 with vlan id 3 to eth6 (ex: eth0 vf0) after stripping the vlan hdr.
# ethtool -K eth0 hw-tc-offload on
# tc qdisc add dev eth0 ingress
# tc filter add dev eth0 parent ffff: protocol 802.1Q flower \
vlan_id 3 vlan_ethtype ipv4 action vlan pop action mirred \
ingress redirect dev eth6Example #3: List the ingress filter rules
# tc -s filter show dev eth4 ingress
Example #4: Delete tc flower filter rule with handle 0x1
# tc filter del dev eth0 ingress protocol ip pref 49152 \
handle 1 flower--- .../ethernet/marvell/octeontx2/af/rvu_debugfs.c | 2 +- .../net/ethernet/marvell/octeontx2/nic/Makefile | 2 +- .../ethernet/marvell/octeontx2/nic/otx2_common.h | 19 + .../ethernet/marvell/octeontx2/nic/otx2_flows.c | 5 + .../net/ethernet/marvell/octeontx2/nic/otx2_pf.c | 37 ++ .../net/ethernet/marvell/octeontx2/nic/otx2_tc.c | 488 +++++++++++++++++++++ 6 files changed, 551 insertions(+), 2 deletions(-) create mode 100644 drivers/net/ethernet/marvell/octeontx2/nic/otx2_tc.c
drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c +1 -1
@@ -2002,7 +2002,7 @@ static void rvu_dbg_npc_mcam_show_flows(struct seq_file *s,seq_printf (s,"mask 0x%x\n" ,ntohs (rule->mask.etype));break ;case NPC_OUTER_VID : -seq_printf (s,"%d " ,ntohs (rule->packet.vlan_tci)); +seq_printf (s,"0x%x " ,ntohs (rule->packet.vlan_tci));seq_printf (s,"mask 0x%x\n" ,ntohs (rule->mask.vlan_tci));break ;
drivers/net/ethernet/marvell/octeontx2/nic/Makefile +1 -1
@@ -7,7 +7,7 @@ obj-$(CONFIG_OCTEONTX2_PF) += rvu_nicpf.o obj-$(CONFIG_OCTEONTX2_VF) += rvu_nicvf.o rvu_nicpf-y := otx2_pf.o otx2_common.o otx2_txrx.o otx2_ethtool.o \ - otx2_ptp.o otx2_flows.o cn10k.o + otx2_ptp.o otx2_flows.o otx2_tc.o cn10k.o rvu_nicvf-y := otx2_vf.o ccflags-y += -I$(srctree)/drivers/net/ethernet/marvell/octeontx2/af
drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h +19 -0
@@ -18,6 +18,7 @@#include <linux/ptp_clock_kernel.h> #include <linux/timecounter.h> #include <linux/soc/marvell/octeontx2/asm.h> +#include <net/pkt_cls.h> #include <mbox.h> #include <npc.h>
@@ -264,6 +265,7 @@ struct otx2_flow_config {#define OTX2_MAX_NTUPLE_FLOWS 32#define OTX2_MAX_UNICAST_FLOWS 8#define OTX2_MAX_VLAN_FLOWS 1 +#define OTX2_MAX_TC_FLOWS OTX2_MAX_NTUPLE_FLOWS#define OTX2_MCAM_COUNT (OTX2_MAX_NTUPLE_FLOWS + \ OTX2_MAX_UNICAST_FLOWS + \ OTX2_MAX_VLAN_FLOWS)
@@ -274,10 +276,20 @@ struct otx2_flow_config {#define OTX2_PER_VF_VLAN_FLOWS 2/* rx+tx per VF */ #define OTX2_VF_VLAN_RX_INDEX 0#define OTX2_VF_VLAN_TX_INDEX 1 +u32 tc_flower_offset;u32 ntuple_max_flows; +u32 tc_max_flows;struct list_head flow_list; }; +struct otx2_tc_info { +/* hash table to store TC offloaded flows */ +struct rhashtable flow_table; +struct rhashtable_params flow_ht_params; + DECLARE_BITMAP(tc_entries_bitmap, OTX2_MAX_TC_FLOWS); +unsigned long num_entries; +}; +struct dev_hw_ops {int (*sq_aq_init)(void *dev,u16 qidx,u16 sqb_aura); void (*sqe_flush)(void *dev, struct otx2_snd_queue *sq,
@@ -305,6 +317,7 @@ struct otx2_nic {#define OTX2_FLAG_PF_SHUTDOWN BIT_ULL(8)#define OTX2_FLAG_RX_PAUSE_ENABLED BIT_ULL(9)#define OTX2_FLAG_TX_PAUSE_ENABLED BIT_ULL(10) +#define OTX2_FLAG_TC_FLOWER_SUPPORT BIT_ULL(11)u64 flags;struct otx2_qset qset;
@@ -347,6 +360,7 @@ struct otx2_nic {struct hwtstamp_config tstamp;struct otx2_flow_config *flow_cfg; +struct otx2_tc_info tc_info; };static inline bool is_otx2_lbkvf (struct pci_dev *pdev)
@@ -802,4 +816,9 @@ int otx2_add_macfilter(struct net_device *netdev, const u8 *mac);int otx2_enable_rxvlan (struct otx2_nic *pf,bool enable);int otx2_install_rxvlan_offload_flow (struct otx2_nic *pfvf);u16 otx2_get_max_mtu (struct otx2_nic *pfvf); +/* tc support */ +int otx2_init_tc (struct otx2_nic *nic); +void otx2_shutdown_tc (struct otx2_nic *nic); +int otx2_setup_tc (struct net_device *netdev,enum tc_setup_type type, +void *type_data);#endif /* OTX2_COMMON_H */
drivers/net/ethernet/marvell/octeontx2/nic/otx2_flows.c +5 -0
@@ -57,10 +57,13 @@ int otx2_alloc_mcam_entries(struct otx2_nic *pfvf) flow_cfg->ntuple_max_flows = rsp->count; flow_cfg->ntuple_offset =0 ; pfvf->flags |=OTX2_FLAG_NTUPLE_SUPPORT ; + flow_cfg->tc_max_flows = flow_cfg->ntuple_max_flows; + pfvf->flags |=OTX2_FLAG_TC_FLOWER_SUPPORT ; }else { flow_cfg->vf_vlan_offset =0 ; flow_cfg->ntuple_offset = flow_cfg->vf_vlan_offset + vf_vlan_max_flows; + flow_cfg->tc_flower_offset = flow_cfg->ntuple_offset; flow_cfg->unicast_offset = flow_cfg->ntuple_offset +OTX2_MAX_NTUPLE_FLOWS ; flow_cfg->rx_vlan_offset = flow_cfg->unicast_offset +
@@ -69,6 +72,7 @@ int otx2_alloc_mcam_entries(struct otx2_nic *pfvf) pfvf->flags |=OTX2_FLAG_UCAST_FLTR_SUPPORT ; pfvf->flags |=OTX2_FLAG_RX_VLAN_SUPPORT ; pfvf->flags |=OTX2_FLAG_VF_VLAN_SUPPORT ; + pfvf->flags |=OTX2_FLAG_TC_FLOWER_SUPPORT ; }for (i =0 ; i < rsp->count; i++)
@@ -93,6 +97,7 @@ int otx2_mcam_flow_init(struct otx2_nic *pf)INIT_LIST_HEAD (&pf->flow_cfg->flow_list); pf->flow_cfg->ntuple_max_flows =OTX2_MAX_NTUPLE_FLOWS ; + pf->flow_cfg->tc_max_flows = pf->flow_cfg->ntuple_max_flows; err =otx2_alloc_mcam_entries (pf);if (err)
drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c +37 -0
@@ -1760,6 +1760,24 @@ static netdev_tx_t otx2_xmit(struct sk_buff *skb, struct net_device *netdev)return NETDEV_TX_OK ; } +static netdev_features_t otx2_fix_features (struct net_device *dev, +netdev_features_t features) +{ +/* check if n-tuple filters are ON */ +if ((features &NETIF_F_HW_TC ) && (dev->features &NETIF_F_NTUPLE )) { +netdev_info (dev,"Disabling n-tuple filters\n" ); + features &= ~NETIF_F_NTUPLE ; + } + +/* check if tc hw offload is ON */ +if ((features &NETIF_F_NTUPLE ) && (dev->features &NETIF_F_HW_TC )) { +netdev_info (dev,"Disabling TC hardware offload\n" ); + features &= ~NETIF_F_HW_TC ; + } + +return features; +} +static void otx2_set_rx_mode (struct net_device *netdev) {struct otx2_nic *pf =netdev_priv (netdev);
@@ -1822,6 +1840,12 @@ static int otx2_set_features(struct net_device *netdev,if ((changed &NETIF_F_NTUPLE ) && !ntuple)otx2_destroy_ntuple_flows (pf); +if ((netdev->features &NETIF_F_HW_TC ) > (features &NETIF_F_HW_TC ) && + pf->tc_info.num_entries) { +netdev_err (netdev,"Can't disable TC hardware offload while flows are active\n" ); +return -EBUSY ; + } +return 0 ; }
@@ -2220,6 +2244,7 @@ static const struct net_device_ops otx2_netdev_ops = { .ndo_open = otx2_open, .ndo_stop = otx2_stop, .ndo_start_xmit = otx2_xmit, + .ndo_fix_features = otx2_fix_features, .ndo_set_mac_address = otx2_set_mac_address, .ndo_change_mtu = otx2_change_mtu, .ndo_set_rx_mode = otx2_set_rx_mode,
@@ -2230,6 +2255,7 @@ static const struct net_device_ops otx2_netdev_ops = { .ndo_set_vf_mac = otx2_set_vf_mac, .ndo_set_vf_vlan = otx2_set_vf_vlan, .ndo_get_vf_config = otx2_get_vf_config, + .ndo_setup_tc = otx2_setup_tc, };static int otx2_wq_init (struct otx2_nic *pf)
@@ -2449,6 +2475,10 @@ static int otx2_probe(struct pci_dev *pdev, const struct pci_device_id *id)NETIF_F_HW_VLAN_STAG_RX ; netdev->features |= netdev->hw_features; +/* HW supports tc offload but mutually exclusive with n-tuple filters */ +if (pf->flags &OTX2_FLAG_TC_FLOWER_SUPPORT ) + netdev->hw_features |=NETIF_F_HW_TC ; + netdev->gso_max_segs =OTX2_MAX_GSO_SEGS ; netdev->watchdog_timeo =OTX2_TX_TIMEOUT ;
@@ -2470,6 +2500,10 @@ static int otx2_probe(struct pci_dev *pdev, const struct pci_device_id *id)otx2_set_ethtool_ops (netdev); + err =otx2_init_tc (pf); +if (err) + goto err_mcam_flow_del; +/* Enable link notifications */ otx2_cgx_config_linkevents (pf, true);
@@ -2479,6 +2513,8 @@ static int otx2_probe(struct pci_dev *pdev, const struct pci_device_id *id)return 0 ; +err_mcam_flow_del: +otx2_mcam_flow_del (pf); err_unreg_netdev:unregister_netdev (netdev); err_del_mcam_entries:
@@ -2646,6 +2682,7 @@ static void otx2_remove(struct pci_dev *pdev)otx2_ptp_destroy (pf);otx2_mcam_flow_del (pf); +otx2_shutdown_tc (pf);otx2_detach_resources (&pf->mbox);if (pf->hw.lmt_base)iounmap (pf->hw.lmt_base);
drivers/net/ethernet/marvell/octeontx2/nic/otx2_tc.c new file +488 -0
488 lines not on this page · raw message
Signature · 1 line
2.16.5
PATCH 3/4 octeontx2-pf: add tc flower stats handler for hw offloads
In reply to Naveen MamindlapalliAdd support to get the stats for tc flower flows that are offloaded to hardware. To support this feature, added a new AF mbox handler which returns the MCAM entry stats for a flow that has hardware stat counter enabled.
--- drivers/net/ethernet/marvell/octeontx2/af/mbox.h | 14 +++++ .../net/ethernet/marvell/octeontx2/af/rvu_npc.c | 39 ++++++++++++ .../net/ethernet/marvell/octeontx2/nic/otx2_tc.c | 70 +++++++++++++++++++++- 3 files changed, 122 insertions(+), 1 deletion(-)
drivers/net/ethernet/marvell/octeontx2/af/mbox.h +14 -0
@@ -216,6 +216,9 @@ M(NPC_MCAM_READ_ENTRY, 0x600f, npc_mcam_read_entry, \ npc_mcam_read_entry_rsp) \ M(NPC_MCAM_READ_BASE_RULE, 0x6011, npc_read_base_steer_rule, \ msg_req, npc_mcam_read_base_rule_rsp) \ +M(NPC_MCAM_GET_STATS, 0x6012, npc_mcam_entry_stats, \ + npc_mcam_get_stats_req, \ + npc_mcam_get_stats_rsp) \ /* NIX mbox IDs (range 0x8000 - 0xFFFF) */ \ M(NIX_LF_ALLOC, 0x8000, nix_lf_alloc, \ nix_lf_alloc_req, nix_lf_alloc_rsp) \
@@ -1195,6 +1198,17 @@ struct npc_mcam_read_base_rule_rsp {struct mcam_entry entry; }; +struct npc_mcam_get_stats_req { +struct mbox_msghdr hdr; +u16 entry;/* mcam entry */ +}; + +struct npc_mcam_get_stats_rsp { +struct mbox_msghdr hdr; +u64 stat;/* counter stats */ +u8 stat_ena;/* enabled */ +}; +enum ptp_op {PTP_OP_ADJFINE =0 ,PTP_OP_GET_CLOCK =1 ,
drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c +39 -0
@@ -2806,3 +2806,42 @@ int rvu_mbox_handler_npc_read_base_steer_rule(struct rvu *rvu, out:return rc; } + +int rvu_mbox_handler_npc_mcam_entry_stats (struct rvu *rvu, +struct npc_mcam_get_stats_req *req, +struct npc_mcam_get_stats_rsp *rsp) +{ +struct npc_mcam *mcam = &rvu->hw->mcam; +u16 index, cntr; +int blkaddr; +u64 regval; +u32 bank; + + blkaddr =rvu_get_blkaddr (rvu,BLKTYPE_NPC ,0 ); +if (blkaddr <0 ) +return NPC_MCAM_INVALID_REQ ; + +mutex_lock (&mcam->lock); + + index = req->entry & (mcam->banksize -1 ); + bank =npc_get_bank (mcam, req->entry); + +/* read MCAM entry STAT_ACT register */ + regval =rvu_read64 (rvu, blkaddr,NPC_AF_MCAMEX_BANKX_STAT_ACT (index, bank)); + +if (!(regval &BIT_ULL (9 ))) { + rsp->stat_ena =0 ; +mutex_unlock (&mcam->lock); +return 0 ; + } + + cntr = regval &0x1FF ; + + rsp->stat_ena =1 ; + rsp->stat =rvu_read64 (rvu, blkaddr,NPC_AF_MATCH_STATX (cntr)); + rsp->stat &=BIT_ULL (48 ) -1 ; + +mutex_unlock (&mcam->lock); + +return 0 ; +}
drivers/net/ethernet/marvell/octeontx2/nic/otx2_tc.c +69 -1
94 lines not on this page · raw message
Signature · 1 line
2.16.5
PATCH 4/4 octeontx2-pf: TC_MATCHALL egress ratelimiting offload
In reply to Naveen MamindlapalliFrom: Sunil Goutham <[email protected]>
Add TC_MATCHALL egress ratelimiting offload support with POLICE action for entire traffic going out of the interface.
Eg: To ratelimit egress traffic to 100Mbps
$ ethtool -K eth0 hw-tc-offload on
$ tc qdisc add dev eth0 clsact
$ tc filter add dev eth0 egress matchall skip_sw \
action police rate 100Mbit burst 16KbitHW supports a max burst size of ~128KB.
Only one ratelimiting filter can be installed at a time.
--- .../ethernet/marvell/octeontx2/nic/otx2_common.h | 1 + .../net/ethernet/marvell/octeontx2/nic/otx2_reg.h | 1 + .../net/ethernet/marvell/octeontx2/nic/otx2_tc.c | 238 ++++++++++++++++++++- 3 files changed, 236 insertions(+), 4 deletions(-)
drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h +1 -0
@@ -318,6 +318,7 @@ struct otx2_nic {#define OTX2_FLAG_RX_PAUSE_ENABLED BIT_ULL(9)#define OTX2_FLAG_TX_PAUSE_ENABLED BIT_ULL(10)#define OTX2_FLAG_TC_FLOWER_SUPPORT BIT_ULL(11) +#define OTX2_FLAG_TC_MATCHALL_EGRESS_ENABLED BIT_ULL(12)u64 flags;struct otx2_qset qset;
drivers/net/ethernet/marvell/octeontx2/nic/otx2_reg.h +1 -0
@@ -152,6 +152,7 @@#define NIX_AF_TL3X_SCHEDULE (a) (0x1000 | (a) << 16)#define NIX_AF_TL4X_PARENT (a) (0x1288 | (a) << 16)#define NIX_AF_TL4X_SCHEDULE (a) (0x1200 | (a) << 16) +#define NIX_AF_TL4X_PIR (a) (0x1230 | (a) << 16)#define NIX_AF_MDQX_SCHEDULE (a) (0x1400 | (a) << 16)#define NIX_AF_MDQX_PARENT (a) (0x1480 | (a) << 16)#define NIX_AF_TL3_TL2X_LINKX_CFG (a, b) (0x1700 | (a) << 16 | (b) << 3)
drivers/net/ethernet/marvell/octeontx2/nic/otx2_tc.c +234 -4
274 lines not on this page · raw message
Signature · 1 line
2.16.5
This series was applied to netdev/net-next.git (refs/heads/master):
Hello:
This series was applied to netdev/net-next.git (refs/heads/master):
Quoted 11 lines · On Thu, 18 Mar 2021 15:32:11 +0530 you wrote:
This patch series adds support for tc hardware offloads.
Patch #1 adds support for offloading flows that matches IP tos and IP
protocol which will be used by tc hw offload support. Also added ethtool n-tuple filter to code to offload the flows matching the above fields.
Patch #2 adds tc flower hardware offload support on ingress traffic. Patch #3 adds TC flower offload stats.
Patch #4 adds tcTC_MATCHALLegress ratelimiting offload.[...]
Here is the summary with links:
- [net-next,1/4] octeontx2-pf: Add ip tos and ip proto icmp/icmpv6 flow offload support
https://git.kernel.org/netdev/net-next/c/2b9cef667902 - [net-next,2/4] octeontx2-pf: Add tc flower hardware offload on ingress traffic https://git.kernel.org/netdev/net-next/c/1d4d9e42c240 - [net-next,3/4] octeontx2-pf: add tc flower stats handler for hw offloads https://git.kernel.org/netdev/net-next/c/d8ce30e0cf76 - [net-next,4/4] octeontx2-pf: TC_MATCHALL egress ratelimiting offload https://git.kernel.org/netdev/net-next/c/e638a83f167e
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html