cxgbe: add support to offload flows via rte_flow
cover cxgbe: add support to offload flows via rte_flow
This series add basic support to offload flows to Chelsio T5/T6 NICs via rte_flow API. Chelsio NICs can support wildcard (maskfull) filters and exact (maskless) filters. Filters can be created in two regions available on Chelsio NICs. The smaller LE-TCAM region can support both maskfull and maskless filters; whereas, the larger HASH region can support only maskless filters. This series adds support for LE-TCAM region. Support for HASH region will be added in subsequent series.
This series adds support for:
<match item>: IPv4, IPv6, TCP, and UDP.
<action>: Drop, Queue, and Count.
Support for more match items and actions will be added in subsequent series.
Patch 1 queries firmware for available filtering resources in the underlying device and adds table to manage these resources.
Patch 2 introduces rte_flow skeleton and implementes validate operation.
Patch 3 exports control queue needed for communicating filter create/delete requests with firmware.
Patch 4 adds firmware API to create filter work requests for creating/deleting filters and implements flow create operation.
Patch 5 adds flow destroy operation.
Patch 6 adds flow query operation to get filter hit and byte counts.
Patch 7 adds flow flush operation to delete all filters under specified port.
Thanks,
Rahul
Shagun Agrawal (7):
net/cxgbe: query firmware for filter resources net/cxgbe: parse and validate flows
net/cxgbe: add control queue to communicate filter requests net/cxgbe: implement flow create operation net/cxgbe: implement flow destroy operation net/cxgbe: implement flow query operation net/cxgbe: implement flow flush operation
doc/guides/nics/cxgbe.rst | 1 + doc/guides/nics/features/cxgbe.ini | 1 + doc/guides/rel_notes/release_18_08.rst | 5 + drivers/net/cxgbe/Makefile | 2 + drivers/net/cxgbe/base/adapter.h | 63 +++ drivers/net/cxgbe/base/common.h | 17 + drivers/net/cxgbe/base/t4_hw.c | 234 +++++++++++ drivers/net/cxgbe/base/t4_hw.h | 4 + drivers/net/cxgbe/base/t4_msg.h | 22 + drivers/net/cxgbe/base/t4_regs.h | 16 + drivers/net/cxgbe/base/t4fw_interface.h | 221 ++++++++++ drivers/net/cxgbe/cxgbe.h | 3 + drivers/net/cxgbe/cxgbe_ethdev.c | 5 + drivers/net/cxgbe/cxgbe_filter.c | 609 +++++++++++++++++++++++++++ drivers/net/cxgbe/cxgbe_filter.h | 226 ++++++++++ drivers/net/cxgbe/cxgbe_flow.c | 702 ++++++++++++++++++++++++++++++++ drivers/net/cxgbe/cxgbe_flow.h | 42 ++ drivers/net/cxgbe/cxgbe_main.c | 184 +++++++++ drivers/net/cxgbe/cxgbe_ofld.h | 27 ++ drivers/net/cxgbe/sge.c | 197 ++++++++- 20 files changed, 2580 insertions(+), 1 deletion(-) create mode 100644 drivers/net/cxgbe/cxgbe_filter.c create mode 100644 drivers/net/cxgbe/cxgbe_filter.h create mode 100644 drivers/net/cxgbe/cxgbe_flow.c create mode 100644 drivers/net/cxgbe/cxgbe_flow.h create mode 100644 drivers/net/cxgbe/cxgbe_ofld.h
Signature · 1 line
2.14.1
PATCH 1/7 net/cxgbe: query firmware for filter resources
From: Shagun Agrawal <[email protected]>
Fetch available filter resources from firmware and allocate table for book-keeping and managing filters in hardware. Also define the hardware filter specification (ch_filter_specification) used to describe each filter rule.
--- drivers/net/cxgbe/base/adapter.h | 4 ++ drivers/net/cxgbe/base/t4fw_interface.h | 6 ++ drivers/net/cxgbe/cxgbe_filter.h | 97 +++++++++++++++++++++++++++++ drivers/net/cxgbe/cxgbe_main.c | 106 ++++++++++++++++++++++++++++++++ drivers/net/cxgbe/cxgbe_ofld.h | 27 ++++++++ 5 files changed, 240 insertions(+) create mode 100644 drivers/net/cxgbe/cxgbe_filter.h create mode 100644 drivers/net/cxgbe/cxgbe_ofld.h
drivers/net/cxgbe/base/adapter.h +4 -0
@@ -11,9 +11,11 @@#include <rte_bus_pci.h> #include <rte_mbuf.h> #include <rte_io.h> +#include <rte_ethdev.h> #include "cxgbe_compat.h" #include "t4_regs_values.h" +#include "cxgbe_ofld.h" enum {MAX_ETH_QSETS =64 ,/* # of Ethernet Tx/Rx queue sets */
@@ -306,6 +308,8 @@ struct adapter {unsigned int vpd_flag;int use_unpacked_mode;/* unpacked rx mode state */ + +struct tid_info tids;/* Info used to access TID related tables */ };/**
drivers/net/cxgbe/base/t4fw_interface.h +6 -0
@@ -489,6 +489,10 @@ enum fw_params_mnem {enum fw_params_param_dev {FW_PARAMS_PARAM_DEV_CCLK =0x00 ,/* chip core clock in khz */ FW_PARAMS_PARAM_DEV_PORTVEC =0x01 ,/* the port vector */ +FW_PARAMS_PARAM_DEV_NTID =0x02 ,/* reads the number of TIDs +* allocated by the device's +* Lookup Engine +*/ FW_PARAMS_PARAM_DEV_FWREV =0x0B ,/* fw version */ FW_PARAMS_PARAM_DEV_TPREV =0x0C ,/* tp version */ FW_PARAMS_PARAM_DEV_ULPTX_MEMWRITE_DSGL =0x17 ,
@@ -498,6 +502,8 @@ enum fw_params_param_dev {* physical and virtual function parameters */ enum fw_params_param_pfvf { +FW_PARAMS_PARAM_PFVF_FILTER_START =0x05 , +FW_PARAMS_PARAM_PFVF_FILTER_END =0x06 ,FW_PARAMS_PARAM_PFVF_CPLFW4MSG_ENCAP =0x31 ,FW_PARAMS_PARAM_PFVF_PORT_CAPS32 =0x3A };
drivers/net/cxgbe/cxgbe_filter.h new file +97 -0
97 lines not on this page · raw message
drivers/net/cxgbe/cxgbe_main.c +106 -0
142 lines not on this page · raw message
drivers/net/cxgbe/cxgbe_ofld.h new file +27 -0
@@ -0,0 +1,27 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2014-2018 Chelsio Communications. +* All rights reserved. +*/ + +#ifndef _CXGBE_OFLD_H_ +#define _CXGBE_OFLD_H_ + +#include <rte_bitmap.h> + +#include "cxgbe_filter.h" + +/* +* Holds the size, base address, free list start, etc of filter TID. +* The tables themselves are allocated dynamically. +*/ +struct tid_info { +void **tid_tab; +unsigned int ntids; +struct filter_entry *ftid_tab;/* Normal filters */ +struct rte_bitmap *ftid_bmap; +uint8_t *ftid_bmap_array; +unsigned int nftids; +unsigned int ftid_base; +rte_spinlock_t ftid_lock; +}; +#endif /* _CXGBE_OFLD_H_ */
Signature · 1 line
2.14.1
PATCH 2/7 net/cxgbe: parse and validate flows
In reply to Rahul LakkireddyFrom: Shagun Agrawal <[email protected]>
Introduce rte_flow skeleton and implement validate operation.
Parse and convert <item>, <action>, <attributes> into hardware specification. Perform validation, including basic sanity tests and underlying device's supported filter capability checks.
Currently add support for:
<item>: IPv4, IPv6, TCP, and UDP.
<action>: Drop, Queue, and Count.
Also add sanity checks to ensure filters are created at specified index in LE-TCAM region. The index in LE-TCAM region indicates the filter rule's priority with index 0 having the highest priority. If no index is specified, filters are created at closest available free index.
--- doc/guides/nics/cxgbe.rst | 1 + doc/guides/nics/features/cxgbe.ini | 1 + doc/guides/rel_notes/release_18_08.rst | 5 + drivers/net/cxgbe/Makefile | 2 + drivers/net/cxgbe/base/adapter.h | 22 ++ drivers/net/cxgbe/cxgbe_ethdev.c | 2 + drivers/net/cxgbe/cxgbe_filter.c | 77 ++++++ drivers/net/cxgbe/cxgbe_filter.h | 91 +++++++ drivers/net/cxgbe/cxgbe_flow.c | 473 +++++++++++++++++++++++++++++++++ drivers/net/cxgbe/cxgbe_flow.h | 38 +++ 10 files changed, 712 insertions(+) create mode 100644 drivers/net/cxgbe/cxgbe_filter.c create mode 100644 drivers/net/cxgbe/cxgbe_flow.c create mode 100644 drivers/net/cxgbe/cxgbe_flow.h
doc/guides/nics/cxgbe.rst +1 -0
@@ -30,6 +30,7 @@ CXGBE and CXGBEVF PMD has support for: - All multicast mode - Port hardware statistics - Jumbo frames +- Flow API Limitations -----------
doc/guides/nics/features/cxgbe.ini +1 -0
@@ -16,6 +16,7 @@ Allmulticast mode = Y RSS hash = Y RSS key update = Y Flow control = Y +Flow API = Y CRC offload = Y VLAN offload = Y L3 checksum offload = Y
doc/guides/rel_notes/release_18_08.rst +5 -0
@@ -41,6 +41,11 @@ New Features Also, make sure to start the actual text at the margin. ========================================================= +* **Added Flow API support for CXGBE PMD.** + + Flow API support has been added to CXGBE Poll Mode Driver to offload + flows to Chelsio T5/T6 NICs. + API Changes -----------
drivers/net/cxgbe/Makefile +2 -0
@@ -49,6 +49,8 @@ SRCS-$(CONFIG_RTE_LIBRTE_CXGBE_PMD) += cxgbevf_ethdev.c SRCS-$(CONFIG_RTE_LIBRTE_CXGBE_PMD) += cxgbe_main.c SRCS-$(CONFIG_RTE_LIBRTE_CXGBE_PMD) += cxgbevf_main.c SRCS-$(CONFIG_RTE_LIBRTE_CXGBE_PMD) += sge.c +SRCS-$(CONFIG_RTE_LIBRTE_CXGBE_PMD) += cxgbe_filter.c +SRCS-$(CONFIG_RTE_LIBRTE_CXGBE_PMD) += cxgbe_flow.c SRCS-$(CONFIG_RTE_LIBRTE_CXGBE_PMD) += t4_hw.c SRCS-$(CONFIG_RTE_LIBRTE_CXGBE_PMD) += t4vf_hw.c
drivers/net/cxgbe/base/adapter.h +22 -0
@@ -312,6 +312,17 @@ struct adapter {struct tid_info tids;/* Info used to access TID related tables */ }; +/** +* ethdev2pinfo - return the port_info structure associated with a rte_eth_dev +* @dev: the rte_eth_dev +* +* Return the struct port_info associated with a rte_eth_dev +*/ +static inline struct port_info *ethdev2pinfo (const struct rte_eth_dev *dev) +{ +return (struct port_info *)dev->data->dev_private; +} +/** * adap2pinfo - return the port_info of a port * @adap: the adapter
@@ -324,6 +335,17 @@ static inline struct port_info *adap2pinfo(const struct adapter *adap, int idx)return adap->port[idx]; } +/** +* ethdev2adap - return the adapter structure associated with a rte_eth_dev +* @dev: the rte_eth_dev +* +* Return the struct adapter associated with a rte_eth_dev +*/ +static inline struct adapter *ethdev2adap (const struct rte_eth_dev *dev) +{ +return ethdev2pinfo (dev)->adapter; +} +#define CXGBE_PCI_REG (reg) rte_read32(reg)static inline uint64_t cxgbe_read_addr64 (volatile void *addr)
drivers/net/cxgbe/cxgbe_ethdev.c +2 -0
@@ -36,6 +36,7 @@#include "cxgbe.h" #include "cxgbe_pfvf.h" +#include "cxgbe_flow.h" /* * Macros needed to support the PCI Device ID Table ...
@@ -1036,6 +1037,7 @@ static const struct eth_dev_ops cxgbe_eth_dev_ops = { .rx_queue_start = cxgbe_dev_rx_queue_start, .rx_queue_stop = cxgbe_dev_rx_queue_stop, .rx_queue_release = cxgbe_dev_rx_queue_release, + .filter_ctrl = cxgbe_dev_filter_ctrl, .stats_get = cxgbe_dev_stats_get, .stats_reset = cxgbe_dev_stats_reset, .flow_ctrl_get = cxgbe_flow_ctrl_get,
drivers/net/cxgbe/cxgbe_filter.c new file +77 -0
77 lines not on this page · raw message
drivers/net/cxgbe/cxgbe_filter.h +91 -0
112 lines not on this page · raw message
drivers/net/cxgbe/cxgbe_flow.c new file +473 -0
473 lines not on this page · raw message
drivers/net/cxgbe/cxgbe_flow.h new file +38 -0
@@ -0,0 +1,38 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2014-2018 Chelsio Communications. +* All rights reserved. +*/ +#ifndef _CXGBE_FLOW_H_ +#define _CXGBE_FLOW_H_ + +#include <rte_flow_driver.h> +#include "cxgbe_filter.h" + +struct chrte_fparse { +int (*fptr)(const void *mask,/* currently supported mask */ +const struct rte_flow_item *item,/* user input */ +struct ch_filter_specification *fs,/* where to parse */ +struct rte_flow_error *e); +const void *dmask;/* Specify what is supported by chelsio by default*/ +}; + +struct rte_flow { +struct filter_entry *f; +struct ch_filter_specification fs;/* temp, to create filter */ +struct chrte_fparse *item_parser; +/* +* filter_entry doesn't store user priority. +* Post creation of filter this will indicate the +* flow index (fidx) for both hash and tcam filters +*/ +unsigned int fidx; +struct rte_eth_dev *dev; +}; + +int +cxgbe_dev_filter_ctrl (struct rte_eth_dev *dev, +enum rte_filter_type filter_type, +enum rte_filter_op filter_op, +void *arg); + +#endif /* _CXGBE_FLOW_H_ */
Signature · 1 line
2.14.1
PATCH 3/7 net/cxgbe: add control queue to communicate filter requests
In reply to Rahul LakkireddyFrom: Shagun Agrawal <[email protected]>
Add control queue to communicate filter creation/deletion requests with firmware. This API will be used by subsequent patches.
--- drivers/net/cxgbe/base/adapter.h | 15 +++ drivers/net/cxgbe/base/common.h | 2 + drivers/net/cxgbe/base/t4_hw.c | 25 ++++ drivers/net/cxgbe/base/t4fw_interface.h | 70 ++++++++++++ drivers/net/cxgbe/cxgbe.h | 1 + drivers/net/cxgbe/cxgbe_ethdev.c | 3 + drivers/net/cxgbe/cxgbe_main.c | 41 +++++++ drivers/net/cxgbe/sge.c | 197 +++++++++++++++++++++++++++++++- 8 files changed, 353 insertions(+), 1 deletion(-)
drivers/net/cxgbe/base/adapter.h +15 -0
@@ -19,6 +19,7 @@enum {MAX_ETH_QSETS =64 ,/* # of Ethernet Tx/Rx queue sets */ +MAX_CTRL_QUEUES =NCHAN ,/* # of control Tx queues */ };struct adapter ;
@@ -256,10 +257,20 @@ struct sge_eth_txq { /* state for an SGE Ethernet Tx queue */unsigned int flags;/* flags for state of the queue */ } __rte_cache_aligned; +struct sge_ctrl_txq {/* State for an SGE control Tx queue */ +struct sge_txq q;/* txq */ +struct adapter *adapter;/* adapter associated with this queue */ +rte_spinlock_t ctrlq_lock;/* control queue lock */ +u8 full;/* the Tx ring is full */ +u64 txp;/* number of transmits */ +struct rte_mempool *mb_pool;/* mempool to generate ctrl pkts */ +} __rte_cache_aligned; +struct sge {struct sge_eth_txq ethtxq[MAX_ETH_QSETS ];struct sge_eth_rxq ethrxq[MAX_ETH_QSETS ]; struct sge_rspq fw_evtq __rte_cache_aligned; +struct sge_ctrl_txq ctrlq[MAX_CTRL_QUEUES ];u16 max_ethqsets;/* # of available Ethernet queue sets */ u32 stat_len;/* length of status page at ring end */
@@ -720,6 +731,7 @@ void t4_sge_tx_monitor_start(struct adapter *adap);void t4_sge_tx_monitor_stop (struct adapter *adap);int t4_eth_xmit (struct sge_eth_txq *txq,struct rte_mbuf *mbuf,uint16_t nb_pkts); +int t4_mgmt_tx (struct sge_ctrl_txq *txq,struct rte_mbuf *mbuf);int t4_ethrx_handler (struct sge_rspq *q,const __be64 *rsp,const struct pkt_gl *gl);int t4_sge_init (struct adapter *adap);
@@ -727,6 +739,9 @@ int t4vf_sge_init(struct adapter *adap);int t4_sge_alloc_eth_txq (struct adapter *adap,struct sge_eth_txq *txq,struct rte_eth_dev *eth_dev,uint16_t queue_id,unsigned int iqid,int socket_id); +int t4_sge_alloc_ctrl_txq (struct adapter *adap,struct sge_ctrl_txq *txq, +struct rte_eth_dev *eth_dev,uint16_t queue_id, +unsigned int iqid,int socket_id); int t4_sge_alloc_rxq(struct adapter *adap, struct sge_rspq *rspq, bool fwevtq, struct rte_eth_dev *eth_dev, int intr_idx, struct sge_fl *fl, rspq_handler_t handler,
drivers/net/cxgbe/base/common.h +2 -0
@@ -378,6 +378,8 @@ int t4_iq_free(struct adapter *adap, unsigned int mbox, unsigned int pf, unsigned int fl0id, unsigned int fl1id);int t4_eth_eq_free (struct adapter *adap,unsigned int mbox,unsigned int pf,unsigned int vf,unsigned int eqid); +int t4_ctrl_eq_free (struct adapter *adap,unsigned int mbox,unsigned int pf, +unsigned int vf,unsigned int eqid);static inline unsigned int core_ticks_per_usec (const struct adapter *adap) {
drivers/net/cxgbe/base/t4_hw.c +25 -0
@@ -4490,6 +4490,31 @@ static void t4_handle_get_port_info(struct port_info *pi, const __be64 *rpl) } } +/** +* t4_ctrl_eq_free - free a control egress queue +* @adap: the adapter +* @mbox: mailbox to use for the FW command +* @pf: the PF owning the queue +* @vf: the VF owning the queue +* @eqid: egress queue id +* +* Frees a control egress queue. +*/ +int t4_ctrl_eq_free (struct adapter *adap,unsigned int mbox,unsigned int pf, +unsigned int vf,unsigned int eqid) +{ +struct fw_eq_ctrl_cmd c; + +memset (&c,0 ,sizeof (c)); + c.op_to_vfn =cpu_to_be32 (V_FW_CMD_OP (FW_EQ_CTRL_CMD ) | +F_FW_CMD_REQUEST |F_FW_CMD_EXEC | +V_FW_EQ_CTRL_CMD_PFN (pf) | +V_FW_EQ_CTRL_CMD_VFN (vf)); + c.alloc_to_len16 =cpu_to_be32 (F_FW_EQ_CTRL_CMD_FREE |FW_LEN16 (c)); + c.cmpliqid_eqid =cpu_to_be32 (V_FW_EQ_CTRL_CMD_EQID (eqid)); +return t4_wr_mbox (adap, mbox, &c,sizeof (c),NULL ); +} +/** * t4_handle_fw_rpl - process a FW reply message * @adap: the adapter
drivers/net/cxgbe/base/t4fw_interface.h +70 -0
82 lines not on this page · raw message
drivers/net/cxgbe/cxgbe.h +1 -0
@@ -42,6 +42,7 @@ int link_start(struct port_info *pi);void init_rspq (struct adapter *adap,struct sge_rspq *q,unsigned int us,unsigned int cnt,unsigned int size,unsigned int iqe_size);int setup_sge_fwevtq (struct adapter *adapter); +int setup_sge_ctrl_txq (struct adapter *adapter);void cfg_queues (struct rte_eth_dev *eth_dev);int cfg_queue_count (struct rte_eth_dev *eth_dev);int init_rss (struct adapter *adap);
drivers/net/cxgbe/cxgbe_ethdev.c +3 -0
@@ -365,6 +365,9 @@ int cxgbe_dev_configure(struct rte_eth_dev *eth_dev)if (err)return err; adapter->flags |=FW_QUEUE_BOUND ; + err =setup_sge_ctrl_txq (adapter); +if (err) +return err; } err =cfg_queue_count (eth_dev);
drivers/net/cxgbe/cxgbe_main.c +41 -0
47 lines not on this page · raw message
drivers/net/cxgbe/sge.c +196 -1
227 lines not on this page · raw message
Signature · 1 line
2.14.1
PATCH 5/7 net/cxgbe: implement flow destroy operation
In reply to Rahul LakkireddyFrom: Shagun Agrawal <[email protected]>
Add API to construct delete filter work request to remove filter at specified index in LE-TCAM (maskfull) region.
--- drivers/net/cxgbe/cxgbe_filter.c | 114 +++++++++++++++++++++++++++++++++++++++ drivers/net/cxgbe/cxgbe_filter.h | 3 ++ drivers/net/cxgbe/cxgbe_flow.c | 53 +++++++++++++++++- 3 files changed, 169 insertions(+), 1 deletion(-)
drivers/net/cxgbe/cxgbe_filter.c +114 -0
@@ -134,6 +134,60 @@ void clear_filter(struct filter_entry *f)memset (f,0 ,sizeof (*f)); } +/** +* t4_mk_filtdelwr - create a delete filter WR +* @ftid: the filter ID +* @wr: the filter work request to populate +* @qid: ingress queue to receive the delete notification +* +* Creates a filter work request to delete the supplied filter. If @qid is +* negative the delete notification is suppressed. +*/ +static void t4_mk_filtdelwr (unsigned int ftid,struct fw_filter_wr *wr,int qid) +{ +memset (wr,0 ,sizeof (*wr)); + wr->op_pkd =cpu_to_be32 (V_FW_WR_OP (FW_FILTER_WR )); + wr->len16_pkd =cpu_to_be32 (V_FW_WR_LEN16 (sizeof (*wr) /16 )); + wr->tid_to_iq =cpu_to_be32 (V_FW_FILTER_WR_TID (ftid) | +V_FW_FILTER_WR_NOREPLY (qid <0 )); + wr->del_filter_to_l2tix =cpu_to_be32 (F_FW_FILTER_WR_DEL_FILTER ); +if (qid >=0 ) + wr->rx_chan_rx_rpl_iq = +cpu_to_be16 (V_FW_FILTER_WR_RX_RPL_IQ (qid)); +} + +/** +* Create FW work request to delete the filter at a specified index +*/ +static int del_filter_wr (struct rte_eth_dev *dev,unsigned int fidx) +{ +struct adapter *adapter =ethdev2adap (dev); +struct filter_entry *f = &adapter->tids.ftid_tab[fidx]; +struct rte_mbuf *mbuf; +struct fw_filter_wr *fwr; +struct sge_ctrl_txq *ctrlq; +unsigned int port_id =ethdev2pinfo (dev)->port_id; + + ctrlq = &adapter->sge.ctrlq[port_id]; + mbuf =rte_pktmbuf_alloc (ctrlq->mb_pool); +if (!mbuf) +return -ENOMEM ; + + mbuf->data_len =sizeof (*fwr); + mbuf->pkt_len = mbuf->data_len; + + fwr = rte_pktmbuf_mtod(mbuf, struct fw_filter_wr *); +t4_mk_filtdelwr (f->tid, fwr, adapter->sge.fw_evtq.abs_id); + +/* +* Mark the filter as "pending" and ship off the Filter Work Request. +* When we get the Work Request Reply we'll clear the pending status. +*/ + f->pending =1 ; +t4_mgmt_tx (ctrlq, mbuf); +return 0 ; +} +int set_filter_wr (struct rte_eth_dev *dev,unsigned int fidx) {struct adapter *adapter =ethdev2adap (dev);
@@ -244,6 +298,58 @@ static void cxgbe_clear_ftid(struct tid_info *t, int fidx, int family)t4_os_unlock (&t->ftid_lock); } +/** +* Check a delete filter request for validity and send it to the hardware. +* Return 0 on success, an error number otherwise. We attach any provided +* filter operation context to the internal filter specification in order to +* facilitate signaling completion of the operation. +*/ +int cxgbe_del_filter (struct rte_eth_dev *dev,unsigned int filter_id, +struct ch_filter_specification *fs, +struct filter_ctx *ctx) +{ +struct port_info *pi = (struct port_info *)(dev->data->dev_private); +struct adapter *adapter = pi->adapter; +struct filter_entry *f; +int ret; + +if (filter_id >= adapter->tids.nftids) +return -ERANGE ; + + ret =is_filter_set (&adapter->tids, filter_id, fs->type); +if (!ret) { +dev_warn (adap,"%s: could not find filter entry: %u\n" , + __func__, filter_id); +return -EINVAL ; + } + + f = &adapter->tids.ftid_tab[filter_id]; + ret =writable_filter (f); +if (ret) +return ret; + +if (f->valid) { + f->ctx = ctx; +cxgbe_clear_ftid (&adapter->tids, + f->tid - adapter->tids.ftid_base, + f->fs.type ?FILTER_TYPE_IPV6 : +FILTER_TYPE_IPV4 ); +return del_filter_wr (dev, filter_id); + } + +/* +* If the caller has passed in a Completion Context then we need to +* mark it as a successful completion so they don't stall waiting +* for it. +*/ +if (ctx) { + ctx->result =0 ; +t4_complete (&ctx->completion); + } + +return 0 ; +} +/** * Check a Chelsio Filter Request for validity, convert it into our internal * format and send it to the hardware. Return 0 on success, an error number
@@ -415,6 +521,14 @@ void filter_rpl(struct adapter *adap, const struct cpl_set_tcb_rpl *rpl) ctx->tid = f->tid; ctx->result =0 ; } + }else if (ret ==FW_FILTER_WR_FLT_DELETED ) { +/* +* Clear the filter when we get confirmation from the +* hardware that the filter has been deleted. +*/ +clear_filter (f); +if (ctx) + ctx->result =0 ; }else {/* * Something went wrong. Issue a warning about the
drivers/net/cxgbe/cxgbe_filter.h +3 -0
@@ -215,6 +215,9 @@ int writable_filter(struct filter_entry *f);int cxgbe_set_filter (struct rte_eth_dev *dev,unsigned int filter_id,struct ch_filter_specification *fs,struct filter_ctx *ctx); +int cxgbe_del_filter (struct rte_eth_dev *dev,unsigned int filter_id, +struct ch_filter_specification *fs, +struct filter_ctx *ctx);int cxgbe_alloc_ftid (struct adapter *adap,unsigned int family);int validate_filter (struct adapter *adap,struct ch_filter_specification *fs);#endif /* _CXGBE_FILTER_H_ */
drivers/net/cxgbe/cxgbe_flow.c +52 -1
65 lines not on this page · raw message
Signature · 1 line
2.14.1
PATCH 4/7 net/cxgbe: implement flow create operation
In reply to Rahul LakkireddyFrom: Shagun Agrawal <[email protected]>
Define filter work request API used to construct filter operations to be communicated with firmware. These requests are sent via control queue and completions come asynchronously in firmware event queue.
Implement flow create operation to create filters in LE-TCAM (maskfull) region at specified index.
--- drivers/net/cxgbe/base/adapter.h | 21 ++ drivers/net/cxgbe/base/t4_msg.h | 22 ++ drivers/net/cxgbe/base/t4fw_interface.h | 145 +++++++++++++ drivers/net/cxgbe/cxgbe.h | 2 + drivers/net/cxgbe/cxgbe_filter.c | 356 ++++++++++++++++++++++++++++++++ drivers/net/cxgbe/cxgbe_filter.h | 32 +++ drivers/net/cxgbe/cxgbe_flow.c | 82 +++++++- drivers/net/cxgbe/cxgbe_flow.h | 4 + drivers/net/cxgbe/cxgbe_main.c | 36 ++++ 9 files changed, 699 insertions(+), 1 deletion(-)
drivers/net/cxgbe/base/adapter.h +21 -0
@@ -717,6 +717,27 @@ static inline void t4_os_atomic_list_del(struct mbox_entry *entry,t4_os_unlock (lock); } +/** +* t4_init_completion - initialize completion +* @c: the completion context +*/ +static inline void t4_init_completion (struct t4_completion *c) +{ + c->done =0 ; +t4_os_lock_init (&c->lock); +} + +/** +* t4_complete - set completion as done +* @c: the completion context +*/ +static inline void t4_complete (struct t4_completion *c) +{ +t4_os_lock (&c->lock); + c->done =1 ; +t4_os_unlock (&c->lock); +} +void *t4_alloc_mem (size_t size);void t4_free_mem (void *addr);#define t4_os_alloc (_size) t4_alloc_mem((_size))
drivers/net/cxgbe/base/t4_msg.h +22 -0
@@ -7,6 +7,7 @@#define T4_MSG_H enum { +CPL_SET_TCB_RPL =0x3A ,CPL_SGE_EGR_UPDATE =0xA5 ,CPL_FW4_MSG =0xC0 ,CPL_FW6_MSG =0xE0 ,
@@ -25,6 +26,13 @@ union opcode_tid {__u8 opcode; }; +#define G_TID (x) ((x) & 0xFFFFFF) + +#define OPCODE_TID (cmd) ((cmd)->ot.opcode_tid) + +/* extract the TID from a CPL command */ +#define GET_TID (cmd) (G_TID(be32_to_cpu(OPCODE_TID(cmd)))) +struct rss_header {__u8 opcode;#if RTE_BYTE_ORDER ==RTE_LITTLE_ENDIAN
@@ -66,6 +74,20 @@ struct work_request_hdr {#define WR_HDR_SIZE 0#endif +#define S_COOKIE 5 +#define M_COOKIE 0x7 +#define V_COOKIE (x) ((x) << S_COOKIE) +#define G_COOKIE (x) (((x) >> S_COOKIE) & M_COOKIE) + +struct cpl_set_tcb_rpl { +RSS_HDR + union opcode_tid ot; +__be16 rsvd; +__u8 cookie; +__u8 status; +__be64 oldval; +}; +struct cpl_tx_data {union opcode_tid ot;__be32 len;
drivers/net/cxgbe/base/t4fw_interface.h +145 -0
157 lines not on this page · raw message
drivers/net/cxgbe/cxgbe.h +2 -0
@@ -38,6 +38,8 @@ void cxgbe_close(struct adapter *adapter);void cxgbe_stats_get (struct port_info *pi,struct port_stats *stats);void cxgbevf_stats_get (struct port_info *pi,struct port_stats *stats);void cxgbe_stats_reset (struct port_info *pi); +int cxgbe_poll_for_completion (struct sge_rspq *q,unsigned int us, +unsigned int cnt,struct t4_completion *c);int link_start (struct port_info *pi);void init_rspq (struct adapter *adap,struct sge_rspq *q,unsigned int us,unsigned int cnt,unsigned int size,unsigned int iqe_size);
drivers/net/cxgbe/cxgbe_filter.c +356 -0
365 lines not on this page · raw message
drivers/net/cxgbe/cxgbe_filter.h +32 -0
@@ -112,14 +112,39 @@ enum filter_type { FILTER_TYPE_IPV6, }; +struct t4_completion { +unsigned int done;/* completion done (0 - No, 1 - Yes) */ +rte_spinlock_t lock;/* completion lock */ +}; + +/* +* Filter operation context to allow callers to wait for +* an asynchronous completion. +*/ +struct filter_ctx { +struct t4_completion completion;/* completion rendezvous */ +int result;/* result of operation */ +u32 tid;/* to store tid of hash filter */ +}; +/* * Host shadow copy of ingress filter entry. This is in host native format * and doesn't match the ordering or bit order, etc. of the hardware or the * firmware command. */ struct filter_entry { +/* +* Administrative fields for filter. +*/ +u32 valid:1 ;/* filter allocated and valid */ +u32 locked:1 ;/* filter is administratively locked */ +u32 pending:1 ;/* filter action is pending FW reply */ +struct filter_ctx *ctx;/* caller's completion hook */ struct rte_eth_dev *dev;/* Port's rte eth device */ +/* This will store the actual tid */ +u32 tid; +/* * The filter itself. */
@@ -183,6 +208,13 @@ cxgbe_bitmap_find_free_region(struct rte_bitmap *bmap, unsigned int size, }bool is_filter_set (struct tid_info *,int fidx,int family); +void filter_rpl (struct adapter *adap,const struct cpl_set_tcb_rpl *rpl); +void clear_filter (struct filter_entry *f); +int set_filter_wr (struct rte_eth_dev *dev,unsigned int fidx); +int writable_filter (struct filter_entry *f); +int cxgbe_set_filter (struct rte_eth_dev *dev,unsigned int filter_id, +struct ch_filter_specification *fs, +struct filter_ctx *ctx);int cxgbe_alloc_ftid (struct adapter *adap,unsigned int family);int validate_filter (struct adapter *adap,struct ch_filter_specification *fs);#endif /* _CXGBE_FILTER_H_ */
drivers/net/cxgbe/cxgbe_flow.c +81 -1
94 lines not on this page · raw message
drivers/net/cxgbe/cxgbe_flow.h +4 -0
@@ -7,6 +7,10 @@#include <rte_flow_driver.h> #include "cxgbe_filter.h" +#include "cxgbe.h" + +#define CXGBE_FLOW_POLL_US 10 +#define CXGBE_FLOW_POLL_CNT 10struct chrte_fparse { int (*fptr)(const void *mask, /* currently supported mask */
drivers/net/cxgbe/cxgbe_main.c +36 -0
@@ -86,6 +86,10 @@ static int fwevtq_handler(struct sge_rspq *q, const __be64 *rsp,const struct cpl_fw6_msg *msg = (const void *)rsp;t4_handle_fw_rpl (q->adapter, msg->data); + }else if (opcode ==CPL_SET_TCB_RPL ) { +const struct cpl_set_tcb_rpl *p = (const void *)rsp; + +filter_rpl (q->adapter, p); }else {dev_err (adapter,"unexpected CPL %#x on FW event queue\n" , opcode);
@@ -135,6 +139,38 @@ int setup_sge_ctrl_txq(struct adapter *adapter)return err; } +/** +* cxgbe_poll_for_completion: Poll rxq for completion +* @q: rxq to poll +* @us: microseconds to delay +* @cnt: number of times to poll +* @c: completion to check for 'done' status +* +* Polls the rxq for reples until completion is done or the count +* expires. +*/ +int cxgbe_poll_for_completion (struct sge_rspq *q,unsigned int us, +unsigned int cnt,struct t4_completion *c) +{ +unsigned int i; +unsigned int work_done, budget =4 ; + +if (!c) +return -EINVAL ; + +for (i =0 ; i < cnt; i++) { +cxgbe_poll (q,NULL , budget, &work_done); +t4_os_lock (&c->lock); +if (c->done) { +t4_os_unlock (&c->lock); +return 0 ; + } +t4_os_unlock (&c->lock); +udelay (us); + } +return -ETIMEDOUT ; +} +int setup_sge_fwevtq (struct adapter *adapter) {struct sge *s = &adapter->sge;
Signature · 1 line
2.14.1
PATCH 6/7 net/cxgbe: implement flow query operation
In reply to Rahul LakkireddyFrom: Shagun Agrawal <[email protected]>
Add API to query filter hit and byte counts from hardware.
--- drivers/net/cxgbe/base/adapter.h | 1 + drivers/net/cxgbe/base/common.h | 15 +++ drivers/net/cxgbe/base/t4_hw.c | 209 +++++++++++++++++++++++++++++++++++++++ drivers/net/cxgbe/base/t4_hw.h | 4 + drivers/net/cxgbe/base/t4_regs.h | 16 +++ drivers/net/cxgbe/cxgbe_filter.c | 62 ++++++++++++ drivers/net/cxgbe/cxgbe_filter.h | 2 + drivers/net/cxgbe/cxgbe_flow.c | 62 +++++++++++- drivers/net/cxgbe/cxgbe_main.c | 1 + 9 files changed, 371 insertions(+), 1 deletion(-)
drivers/net/cxgbe/base/adapter.h +1 -0
@@ -319,6 +319,7 @@ struct adapter {unsigned int vpd_flag;int use_unpacked_mode;/* unpacked rx mode state */ +rte_spinlock_t win0_lock;struct tid_info tids;/* Info used to access TID related tables */ };
drivers/net/cxgbe/base/common.h +15 -0
@@ -18,6 +18,9 @@ extern "C" {#define CXGBE_PAGE_SIZE RTE_PGSIZE_4K +#define T4_MEMORY_WRITE 0 +#define T4_MEMORY_READ 1 +enum {MAX_NPORTS =4 ,/* max # of ports */ };
@@ -47,6 +50,8 @@ enum cc_fec { FEC_BASER_RS = 1 << 2, /* BaseR/Reed-Solomon */ }; +enum {MEM_EDC0 ,MEM_EDC1 ,MEM_MC ,MEM_MC0 =MEM_MC ,MEM_MC1 }; +struct port_stats {u64 tx_octets;/* total # of octets in good frames */ u64 tx_frames;/* all good frames */
@@ -502,5 +507,15 @@ void t4_get_regs(struct adapter *adap, void *buf, size_t buf_size);int t4_seeprom_read (struct adapter *adapter,u32 addr,u32 *data);int t4_seeprom_write (struct adapter *adapter,u32 addr,u32 data);int t4_seeprom_wp (struct adapter *adapter,int enable); +int t4_memory_rw_addr (struct adapter *adap,int win, +u32 addr,u32 len,void *hbuf,int dir); +int t4_memory_rw_mtype (struct adapter *adap,int win,int mtype,u32 maddr, +u32 len,void *hbuf,int dir); +static inline int t4_memory_rw (struct adapter *adap,int win, +int mtype,u32 maddr,u32 len, +void *hbuf,int dir) +{ +return t4_memory_rw_mtype (adap, win, mtype, maddr, len, hbuf, dir); +}fw_port_cap32_t fwcaps16_to_caps32 (fw_port_cap16_t caps16);#endif /* __CHELSIO_COMMON_H */
drivers/net/cxgbe/base/t4_hw.c +209 -0
212 lines not on this page · raw message
drivers/net/cxgbe/base/t4_hw.h +4 -0
@@ -42,6 +42,10 @@ enum { SGE_MAX_WR_NDESC = SGE_MAX_WR_LEN / SGE_EQ_IDXSIZE, }; +enum { +TCB_SIZE =128 ,/* TCB size */ +}; +struct sge_qstat {/* data written to SGE queue status entries */ __be32 qid;__be16 cidx;
drivers/net/cxgbe/base/t4_regs.h +16 -0
@@ -458,6 +458,7 @@#define F_CRXPKTENC V_CRXPKTENC(1U)#define TP_BASE_ADDR 0x7d00 +#define A_TP_CMM_TCB_BASE 0x7d10#define A_TP_TIMER_RESOLUTION 0x7d90
@@ -574,6 +575,21 @@#define S_RM_OVLAN 9#define V_RM_OVLAN (x) ((x) << S_RM_OVLAN) +/* registers for module MA */ +#define A_MA_EDRAM0_BAR 0x77c0 + +#define S_EDRAM0_SIZE 0 +#define M_EDRAM0_SIZE 0xfffU +#define V_EDRAM0_SIZE (x) ((x) << S_EDRAM0_SIZE) +#define G_EDRAM0_SIZE (x) (((x) >> S_EDRAM0_SIZE) & M_EDRAM0_SIZE) + +#define A_MA_EXT_MEMORY0_BAR 0x77c8 + +#define S_EXT_MEM0_SIZE 0 +#define M_EXT_MEM0_SIZE 0xfffU +#define V_EXT_MEM0_SIZE (x) ((x) << S_EXT_MEM0_SIZE) +#define G_EXT_MEM0_SIZE (x) (((x) >> S_EXT_MEM0_SIZE) & M_EXT_MEM0_SIZE) +/* registers for module MPS */ #define MPS_BASE_ADDR 0x9000#define T4VF_MPS_BASE_ADDR 0x0100
drivers/net/cxgbe/cxgbe_filter.c +62 -0
65 lines not on this page · raw message
drivers/net/cxgbe/cxgbe_filter.h +2 -0
@@ -220,4 +220,6 @@ int cxgbe_del_filter(struct rte_eth_dev *dev, unsigned int filter_id, struct filter_ctx *ctx);int cxgbe_alloc_ftid (struct adapter *adap,unsigned int family);int validate_filter (struct adapter *adap,struct ch_filter_specification *fs); +int cxgbe_get_filter_count (struct adapter *adapter,unsigned int fidx, +u64 *c,bool get_byte);#endif /* _CXGBE_FILTER_H_ */
drivers/net/cxgbe/cxgbe_flow.c +61 -1
74 lines not on this page · raw message
drivers/net/cxgbe/cxgbe_main.c +1 -0
@@ -1527,6 +1527,7 @@ int cxgbe_probe(struct adapter *adapter)t4_os_lock_init (&adapter->mbox_lock);TAILQ_INIT (&adapter->mbox_list); +t4_os_lock_init (&adapter->win0_lock); err =t4_prep_adapter (adapter);if (err)
Signature · 1 line
2.14.1
PATCH 7/7 net/cxgbe: implement flow flush operation
In reply to Rahul LakkireddyFrom: Shagun Agrawal <[email protected]>
Add API to flush all the filters under specified port.
--- drivers/net/cxgbe/cxgbe_filter.h | 1 + drivers/net/cxgbe/cxgbe_flow.c | 40 +++++++++++++++++++++++++++++++++++++++- 2 files changed, 40 insertions(+), 1 deletion(-)
drivers/net/cxgbe/cxgbe_filter.h +1 -0
@@ -141,6 +141,7 @@ struct filter_entry { u32 pending:1; /* filter action is pending FW reply */struct filter_ctx *ctx;/* caller's completion hook */ struct rte_eth_dev *dev;/* Port's rte eth device */ +void *private;/* For use by apps using filter_entry */ /* This will store the actual tid */ u32 tid;
drivers/net/cxgbe/cxgbe_flow.c +39 -1
@@ -468,6 +468,8 @@ cxgbe_flow_create(struct rte_eth_dev *dev,return NULL ; } + flow->f->private = flow;/* Will be used during flush */ +return flow; }
@@ -632,11 +634,47 @@ cxgbe_flow_validate(struct rte_eth_dev *dev,return 0 ; } +/* +* @ret : > 0 filter destroyed succsesfully +* < 0 error destroying filter +* == 1 filter not active / not found +*/ +static int +cxgbe_check_n_destroy (struct filter_entry *f,struct rte_eth_dev *dev, +struct rte_flow_error *e) +{ +if (f && (f->valid || f->pending) && + f->dev == dev &&/* Only if user has asked for this port */ + f->private)/* We (rte_flow) created this filter */ +return cxgbe_flow_destroy (dev, (struct rte_flow *)f->private, + e); +return 1 ; +} + +static int cxgbe_flow_flush (struct rte_eth_dev *dev,struct rte_flow_error *e) +{ +struct adapter *adap =ethdev2adap (dev); +unsigned int i; +int ret =0 ; + +if (adap->tids.ftid_tab) { +struct filter_entry *f = &adap->tids.ftid_tab[0 ]; + +for (i =0 ; i < adap->tids.nftids; i++, f++) { + ret =cxgbe_check_n_destroy (f, dev, e); +if (ret <0 ) + goto out; + } + } +out: +return ret >=0 ?0 : ret; +} +static const struct rte_flow_ops cxgbe_flow_ops = { .validate = cxgbe_flow_validate, .create = cxgbe_flow_create, .destroy = cxgbe_flow_destroy, - .flush =NULL , + .flush = cxgbe_flow_flush, .query = cxgbe_flow_query, .isolate =NULL , };
Signature · 1 line
2.14.1
Re: [PATCH 1/7] net/cxgbe: query firmware for filter resources
In reply to Rahul Lakkireddydrivers/net/cxgbe/cxgbe_filter.h line 5
Quoted 11 lines · Rahul Lakkireddy
drivers/net/cxgbe/cxgbe_filter.h new file +5
-0@@ -0,0 +1,97 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2014-2018 Chelsio Communications. +* All rights reserved. +*/ +
Hi Rahul,
This is a new file and copyright starts from 2014, is this intentional?
And @Thomas, @Hemant, are we allowed to have copyright start date in the past for new files?
Thanks,
ferruh
Quoted 38 lines · Rahul Lakkireddy
This series add basic support to offload flows to Chelsio T5/T6 NICs via
rte_flowAPI. Chelsio NICs can support wildcard (maskfull) filters and exact (maskless) filters. Filters can be created in two regions available on Chelsio NICs. The smaller LE-TCAM region can support both maskfull and maskless filters; whereas, the larger HASH region can support only maskless filters. This series adds support for LE-TCAM region. Support for HASH region will be added in subsequent series.This series adds support for:
<match item>: IPv4, IPv6, TCP, and UDP.
<action>: Drop, Queue, and Count.Support for more match items and actions will be added in subsequent series.
Patch 1 queries firmware for available filtering resources in the underlying device and adds table to manage these resources.
Patch 2 introduces
rte_flowskeleton and implementes validate operation.Patch 3 exports control queue needed for communicating filter create/delete requests with firmware.
Patch 4 adds firmware API to create filter work requests for creating/deleting filters and implements flow create operation.
Patch 5 adds flow destroy operation.
Patch 6 adds flow query operation to get filter hit and byte counts.
Patch 7 adds flow flush operation to delete all filters under specified port.
Thanks,
Rahul
Quoted 8 lines
Shagun Agrawal (7):
net/cxgbe: query firmware for filter resources net/cxgbe: parse and validate flows
net/cxgbe: add control queue to communicate filter requests net/cxgbe: implement flow create operation net/cxgbe: implement flow destroy operation net/cxgbe: implement flow query operation net/cxgbe: implement flow flush operation
Series applied to dpdk-next-net/master, thanks.
(I have asked a question about copyright start year, based on answer an update may require, which can be squashed into this set.)
Re: [PATCH 1/7] net/cxgbe: query firmware for filter resources
In reply to Ferruh Yigit13/06/2018 18:41, Ferruh Yigit:
Quoted 15 lines · Rahul Lakkireddy
drivers/net/cxgbe/cxgbe_filter.h line 5
Quoted 11 lines
drivers/net/cxgbe/cxgbe_filter.h new file +5
-0@@ -0,0 +1,97 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2014-2018 Chelsio Communications. +* All rights reserved. +*/ +Hi Rahul,
Quoted 4 lines
This is a new file and copyright starts from 2014, is this intentional?
And @Thomas, @Hemant, are we allowed to have copyright start date in the past for new files?
I prefer having accurate copyright year because it is a quick hint about how old the file is.
But I think there is no strong legal consequence.
Re: [PATCH 1/7] net/cxgbe: query firmware for filter resources
Quoted 20 lines · Thomas Monjalon
13/06/2018 18:41, Ferruh Yigit:
Quoted 15 lines · Rahul Lakkireddy
drivers/net/cxgbe/cxgbe_filter.h line 5
Quoted 11 lines
drivers/net/cxgbe/cxgbe_filter.h new file +5
-0@@ -0,0 +1,97 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2014-2018 Chelsio Communications. +* All rights reserved. +*/ +Hi Rahul,
Quoted 8 lines
Quoted 4 lines
This is a new file and copyright starts from 2014, is this intentional?
And @Thomas, @Hemant, are we allowed to have copyright start date in the past for new files?
I prefer having accurate copyright year because it is a quick hint about how old the file is.
But I think there is no strong legal consequence.
I would guess if you have the wrong year and that year was before/after it was created then you will have a problem proving it was valid in a given year. Not having a real date can cause some problems if we ever have a conflict or law suit. We should always update the copyright when we modify a file and the correct date when it is created.
Regards,
Keith
Re: [PATCH 1/7] net/cxgbe: query firmware for filter resources
In reply to Ferruh YigitHi Ferruh,
drivers/net/cxgbe/cxgbe_filter.h line 5
Quoted 12 lines · Rahul Lakkireddy
drivers/net/cxgbe/cxgbe_filter.h new file +5
-0@@ -0,0 +1,97 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2014-2018 Chelsio Communications. +* All rights reserved. +*/ +
Hi Rahul,
This is a new file and copyright starts from 2014, is this intentional?
And @Thomas, @Hemant, are we allowed to have copyright start date in the past for new files?
[Hemant] It is good to ask the submitter to re-check on the copyright year. But they can decide which copyright year they want to put on the files.
Typically copyright start can be when the part of the code originated/written first time irrespective of submission to DPDK.
Some companies also requires that you keep on updating the copyright year when you are changing the code. While others think that git history is sufficient to keep that track, you need not to update the copyright year.
Regards,
Hemant