2018-01-08 13:35:35 +00:00
|
|
|
/* SPDX-License-Identifier: BSD-3-Clause
|
2017-03-16 12:41:08 +00:00
|
|
|
*
|
2018-01-08 13:35:35 +00:00
|
|
|
* Copyright (c) 2016-2018 Solarflare Communications Inc.
|
2016-11-29 16:19:15 +00:00
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* This software was jointly developed between OKTET Labs (under contract
|
|
|
|
* for Solarflare) and Solarflare Communications, Inc.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _SFC_RX_H
|
|
|
|
#define _SFC_RX_H
|
|
|
|
|
2016-11-29 16:19:17 +00:00
|
|
|
#include <rte_mbuf.h>
|
|
|
|
#include <rte_mempool.h>
|
2018-01-22 00:16:22 +00:00
|
|
|
#include <rte_ethdev_driver.h>
|
2016-11-29 16:19:17 +00:00
|
|
|
|
|
|
|
#include "efx.h"
|
|
|
|
|
2017-03-20 10:15:10 +00:00
|
|
|
#include "sfc_dp_rx.h"
|
|
|
|
|
2016-11-29 16:19:15 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
struct sfc_adapter;
|
2016-11-29 16:19:17 +00:00
|
|
|
struct sfc_evq;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Software Rx descriptor information associated with hardware Rx
|
|
|
|
* descriptor.
|
|
|
|
*/
|
2017-03-20 10:15:10 +00:00
|
|
|
struct sfc_efx_rx_sw_desc {
|
2016-11-29 16:19:17 +00:00
|
|
|
struct rte_mbuf *mbuf;
|
|
|
|
unsigned int flags;
|
|
|
|
unsigned int size;
|
|
|
|
};
|
|
|
|
|
|
|
|
/** Receive queue state bits */
|
|
|
|
enum sfc_rxq_state_bit {
|
|
|
|
SFC_RXQ_INITIALIZED_BIT = 0,
|
|
|
|
#define SFC_RXQ_INITIALIZED (1 << SFC_RXQ_INITIALIZED_BIT)
|
2016-11-29 16:19:20 +00:00
|
|
|
SFC_RXQ_STARTED_BIT,
|
|
|
|
#define SFC_RXQ_STARTED (1 << SFC_RXQ_STARTED_BIT)
|
|
|
|
SFC_RXQ_FLUSHING_BIT,
|
|
|
|
#define SFC_RXQ_FLUSHING (1 << SFC_RXQ_FLUSHING_BIT)
|
|
|
|
SFC_RXQ_FLUSHED_BIT,
|
|
|
|
#define SFC_RXQ_FLUSHED (1 << SFC_RXQ_FLUSHED_BIT)
|
|
|
|
SFC_RXQ_FLUSH_FAILED_BIT,
|
|
|
|
#define SFC_RXQ_FLUSH_FAILED (1 << SFC_RXQ_FLUSH_FAILED_BIT)
|
2016-11-29 16:19:17 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
2017-03-20 10:15:10 +00:00
|
|
|
* Receive queue control information.
|
2016-11-29 16:19:17 +00:00
|
|
|
* Allocated on the socket specified on the queue setup.
|
|
|
|
*/
|
|
|
|
struct sfc_rxq {
|
|
|
|
struct sfc_evq *evq;
|
|
|
|
efx_rxq_t *common;
|
|
|
|
efsys_mem_t mem;
|
|
|
|
unsigned int hw_index;
|
2018-04-19 11:36:55 +00:00
|
|
|
uint16_t buf_size;
|
2016-11-29 16:19:17 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static inline unsigned int
|
|
|
|
sfc_rxq_sw_index_by_hw_index(unsigned int hw_index)
|
|
|
|
{
|
|
|
|
return hw_index;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline unsigned int
|
|
|
|
sfc_rxq_sw_index(const struct sfc_rxq *rxq)
|
|
|
|
{
|
|
|
|
return sfc_rxq_sw_index_by_hw_index(rxq->hw_index);
|
|
|
|
}
|
2016-11-29 16:19:15 +00:00
|
|
|
|
2017-03-20 10:15:10 +00:00
|
|
|
struct sfc_rxq *sfc_rxq_by_dp_rxq(const struct sfc_dp_rxq *dp_rxq);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Receive queue information used on libefx-based data path.
|
|
|
|
* Allocated on the socket specified on the queue setup.
|
|
|
|
*/
|
|
|
|
struct sfc_efx_rxq {
|
|
|
|
/* Used on data path */
|
|
|
|
struct sfc_evq *evq;
|
|
|
|
unsigned int flags;
|
|
|
|
#define SFC_EFX_RXQ_FLAG_STARTED 0x1
|
|
|
|
#define SFC_EFX_RXQ_FLAG_RUNNING 0x2
|
|
|
|
#define SFC_EFX_RXQ_FLAG_RSS_HASH 0x4
|
|
|
|
unsigned int ptr_mask;
|
|
|
|
unsigned int pending;
|
|
|
|
unsigned int completed;
|
|
|
|
uint16_t batch_max;
|
|
|
|
uint16_t prefix_size;
|
|
|
|
struct sfc_efx_rx_sw_desc *sw_desc;
|
|
|
|
|
|
|
|
/* Used on refill */
|
|
|
|
unsigned int added;
|
|
|
|
unsigned int pushed;
|
2018-01-09 20:24:52 +00:00
|
|
|
unsigned int max_fill_level;
|
2017-03-20 10:15:10 +00:00
|
|
|
unsigned int refill_threshold;
|
|
|
|
uint16_t buf_size;
|
|
|
|
struct rte_mempool *refill_mb_pool;
|
|
|
|
efx_rxq_t *common;
|
|
|
|
|
|
|
|
/* Datapath receive queue anchor */
|
|
|
|
struct sfc_dp_rxq dp;
|
|
|
|
};
|
|
|
|
|
|
|
|
static inline struct sfc_efx_rxq *
|
|
|
|
sfc_efx_rxq_by_dp_rxq(struct sfc_dp_rxq *dp_rxq)
|
|
|
|
{
|
|
|
|
return container_of(dp_rxq, struct sfc_efx_rxq, dp);
|
|
|
|
}
|
|
|
|
|
2016-11-29 16:19:15 +00:00
|
|
|
/**
|
|
|
|
* Receive queue information used during setup/release only.
|
|
|
|
* Allocated on the same socket as adapter data.
|
|
|
|
*/
|
|
|
|
struct sfc_rxq_info {
|
2019-02-07 12:17:33 +00:00
|
|
|
unsigned int state;
|
2016-11-29 16:19:15 +00:00
|
|
|
unsigned int max_entries;
|
2016-11-29 16:19:17 +00:00
|
|
|
unsigned int entries;
|
|
|
|
efx_rxq_type_t type;
|
2017-12-24 10:46:35 +00:00
|
|
|
unsigned int type_flags;
|
2016-11-29 16:19:17 +00:00
|
|
|
struct sfc_rxq *rxq;
|
2019-02-07 12:17:34 +00:00
|
|
|
struct sfc_dp_rxq *dp;
|
2016-12-15 12:51:11 +00:00
|
|
|
boolean_t deferred_start;
|
|
|
|
boolean_t deferred_started;
|
2019-02-07 12:17:27 +00:00
|
|
|
unsigned int refill_threshold;
|
|
|
|
struct rte_mempool *refill_mb_pool;
|
2016-11-29 16:19:15 +00:00
|
|
|
};
|
|
|
|
|
2019-02-07 12:17:33 +00:00
|
|
|
struct sfc_rxq_info *sfc_rxq_info_by_dp_rxq(const struct sfc_dp_rxq *dp_rxq);
|
|
|
|
|
2017-03-31 10:22:19 +00:00
|
|
|
int sfc_rx_configure(struct sfc_adapter *sa);
|
|
|
|
void sfc_rx_close(struct sfc_adapter *sa);
|
2016-11-29 16:19:20 +00:00
|
|
|
int sfc_rx_start(struct sfc_adapter *sa);
|
|
|
|
void sfc_rx_stop(struct sfc_adapter *sa);
|
2016-11-29 16:19:15 +00:00
|
|
|
|
2016-11-29 16:19:17 +00:00
|
|
|
int sfc_rx_qinit(struct sfc_adapter *sa, unsigned int rx_queue_id,
|
|
|
|
uint16_t nb_rx_desc, unsigned int socket_id,
|
|
|
|
const struct rte_eth_rxconf *rx_conf,
|
|
|
|
struct rte_mempool *mb_pool);
|
|
|
|
void sfc_rx_qfini(struct sfc_adapter *sa, unsigned int sw_index);
|
2016-11-29 16:19:20 +00:00
|
|
|
int sfc_rx_qstart(struct sfc_adapter *sa, unsigned int sw_index);
|
|
|
|
void sfc_rx_qstop(struct sfc_adapter *sa, unsigned int sw_index);
|
|
|
|
|
2018-01-18 09:44:28 +00:00
|
|
|
uint64_t sfc_rx_get_dev_offload_caps(struct sfc_adapter *sa);
|
2018-01-18 09:44:29 +00:00
|
|
|
uint64_t sfc_rx_get_queue_offload_caps(struct sfc_adapter *sa);
|
2018-01-18 09:44:28 +00:00
|
|
|
|
2019-02-07 12:17:33 +00:00
|
|
|
void sfc_rx_qflush_done(struct sfc_rxq_info *rxq_info);
|
|
|
|
void sfc_rx_qflush_failed(struct sfc_rxq_info *rxq_info);
|
2016-11-29 16:19:17 +00:00
|
|
|
|
2018-04-25 17:51:44 +00:00
|
|
|
int sfc_rx_hash_init(struct sfc_adapter *sa);
|
|
|
|
void sfc_rx_hash_fini(struct sfc_adapter *sa);
|
|
|
|
int sfc_rx_hf_rte_to_efx(struct sfc_adapter *sa, uint64_t rte,
|
|
|
|
efx_rx_hash_type_t *efx);
|
|
|
|
uint64_t sfc_rx_hf_efx_to_rte(struct sfc_adapter *sa,
|
|
|
|
efx_rx_hash_type_t efx);
|
2016-12-15 12:51:17 +00:00
|
|
|
|
2016-11-29 16:19:15 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#endif /* _SFC_RX_H */
|