From 1aacc3d388d3aa9b4fdefcaa111ef177f39ad57f Mon Sep 17 00:00:00 2001 From: Andrew Rybchenko Date: Tue, 13 Oct 2020 14:45:50 +0100 Subject: [PATCH] net/sfc: support user mark and flag Rx for EF100 Flow rules may be used mark packets. Support delivery of mark/flag values to user in mbuf fields. Signed-off-by: Andrew Rybchenko --- drivers/net/sfc/sfc_ef100_rx.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/drivers/net/sfc/sfc_ef100_rx.c b/drivers/net/sfc/sfc_ef100_rx.c index 6fb78b6e68..0623f6e574 100644 --- a/drivers/net/sfc/sfc_ef100_rx.c +++ b/drivers/net/sfc/sfc_ef100_rx.c @@ -57,6 +57,7 @@ struct sfc_ef100_rxq { #define SFC_EF100_RXQ_NOT_RUNNING 0x2 #define SFC_EF100_RXQ_EXCEPTION 0x4 #define SFC_EF100_RXQ_RSS_HASH 0x10 +#define SFC_EF100_RXQ_USER_MARK 0x20 unsigned int ptr_mask; unsigned int evq_phase_bit_shift; unsigned int ready_pkts; @@ -351,8 +352,10 @@ static const efx_rx_prefix_layout_t sfc_ef100_rx_prefix_layout = { SFC_EF100_RX_PREFIX_FIELD(LENGTH, B_FALSE), SFC_EF100_RX_PREFIX_FIELD(RSS_HASH_VALID, B_FALSE), + SFC_EF100_RX_PREFIX_FIELD(USER_FLAG, B_FALSE), SFC_EF100_RX_PREFIX_FIELD(CLASS, B_FALSE), SFC_EF100_RX_PREFIX_FIELD(RSS_HASH, B_FALSE), + SFC_EF100_RX_PREFIX_FIELD(USER_MARK, B_FALSE), #undef SFC_EF100_RX_PREFIX_FIELD } @@ -388,6 +391,14 @@ sfc_ef100_rx_prefix_to_offloads(const struct sfc_ef100_rxq *rxq, ESF_GZ_RX_PREFIX_RSS_HASH); } + if ((rxq->flags & SFC_EF100_RXQ_USER_MARK) && + EFX_TEST_OWORD_BIT(rx_prefix[0], ESF_GZ_RX_PREFIX_USER_FLAG_LBN)) { + ol_flags |= PKT_RX_FDIR_ID; + /* EFX_OWORD_FIELD converts little-endian to CPU */ + m->hash.fdir.hi = EFX_OWORD_FIELD(rx_prefix[0], + ESF_GZ_RX_PREFIX_USER_MARK); + } + m->ol_flags = ol_flags; return true; } @@ -760,6 +771,13 @@ sfc_ef100_rx_qstart(struct sfc_dp_rxq *dp_rxq, unsigned int evq_read_ptr, else rxq->flags &= ~SFC_EF100_RXQ_RSS_HASH; + if ((unsup_rx_prefix_fields & + ((1U << EFX_RX_PREFIX_FIELD_USER_FLAG) | + (1U << EFX_RX_PREFIX_FIELD_USER_MARK))) == 0) + rxq->flags |= SFC_EF100_RXQ_USER_MARK; + else + rxq->flags &= ~SFC_EF100_RXQ_USER_MARK; + rxq->prefix_size = pinfo->erpl_length; rxq->rearm_data = sfc_ef100_mk_mbuf_rearm_data(rxq->dp.dpq.port_id, rxq->prefix_size); -- 2.20.1