Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/oce/oce_queue.c
Show All 39 Lines | |||||
#include "oce_if.h" | #include "oce_if.h" | ||||
/***************************************************** | /***************************************************** | ||||
* local queue functions | * local queue functions | ||||
*****************************************************/ | *****************************************************/ | ||||
static struct oce_wq *oce_wq_init(POCE_SOFTC sc, | static struct oce_wq *oce_wq_init(POCE_SOFTC sc, | ||||
uint32_t q_len, uint32_t wq_type); | uint32_t q_len, uint32_t wq_type, int idx); | ||||
static int oce_wq_create(struct oce_wq *wq, struct oce_eq *eq); | static int oce_wq_create(struct oce_wq *wq, struct oce_eq *eq); | ||||
static void oce_wq_free(struct oce_wq *wq); | static void oce_wq_free(struct oce_wq *wq); | ||||
static void oce_wq_del(struct oce_wq *wq); | static void oce_wq_del(struct oce_wq *wq); | ||||
static struct oce_rq *oce_rq_init(POCE_SOFTC sc, | static struct oce_rq *oce_rq_init(POCE_SOFTC sc, | ||||
uint32_t q_len, | uint32_t q_len, | ||||
uint32_t frag_size, | uint32_t frag_size, | ||||
uint32_t mtu, uint32_t rss); | uint32_t mtu, uint32_t rss); | ||||
static int oce_rq_create(struct oce_rq *rq, uint32_t if_id, struct oce_eq *eq); | static int oce_rq_create(struct oce_rq *rq, uint32_t if_id, struct oce_eq *eq); | ||||
Show All 32 Lines | oce_queue_init_all(POCE_SOFTC sc) | ||||
int rc = 0, i, vector; | int rc = 0, i, vector; | ||||
struct oce_wq *wq; | struct oce_wq *wq; | ||||
struct oce_rq *rq; | struct oce_rq *rq; | ||||
struct oce_aic_obj *aic; | struct oce_aic_obj *aic; | ||||
/* alloc TX/RX queues */ | /* alloc TX/RX queues */ | ||||
for_all_wq_queues(sc, wq, i) { | for_all_wq_queues(sc, wq, i) { | ||||
sc->wq[i] = oce_wq_init(sc, sc->tx_ring_size, | sc->wq[i] = oce_wq_init(sc, sc->tx_ring_size, | ||||
NIC_WQ_TYPE_STANDARD); | NIC_WQ_TYPE_STANDARD, i); | ||||
if (!sc->wq[i]) | if (!sc->wq[i]) | ||||
goto error; | goto error; | ||||
} | } | ||||
for_all_rq_queues(sc, rq, i) { | for_all_rq_queues(sc, rq, i) { | ||||
sc->rq[i] = oce_rq_init(sc, sc->rx_ring_size, sc->rq_frag_size, | sc->rq[i] = oce_rq_init(sc, sc->rx_ring_size, sc->rq_frag_size, | ||||
OCE_MAX_JUMBO_FRAME_SIZE, | OCE_MAX_JUMBO_FRAME_SIZE, | ||||
▲ Show 20 Lines • Show All 91 Lines • ▼ Show 20 Lines | |||||
/** | /** | ||||
* @brief Function to create a WQ for NIC Tx | * @brief Function to create a WQ for NIC Tx | ||||
* @param sc software handle to the device | * @param sc software handle to the device | ||||
* @param qlen number of entries in the queue | * @param qlen number of entries in the queue | ||||
* @param wq_type work queue type | * @param wq_type work queue type | ||||
* @returns the pointer to the WQ created or NULL on failure | * @returns the pointer to the WQ created or NULL on failure | ||||
*/ | */ | ||||
static struct | static struct | ||||
oce_wq *oce_wq_init(POCE_SOFTC sc, uint32_t q_len, uint32_t wq_type) | oce_wq *oce_wq_init(POCE_SOFTC sc, uint32_t q_len, uint32_t wq_type, int idx) | ||||
{ | { | ||||
struct oce_wq *wq; | struct oce_wq *wq; | ||||
int rc = 0, i; | int rc = 0, i; | ||||
/* q_len must be min 256 and max 2k */ | /* q_len must be min 256 and max 2k */ | ||||
if (q_len < 256 || q_len > 2048) { | if (q_len < 256 || q_len > 2048) { | ||||
device_printf(sc->dev, | device_printf(sc->dev, | ||||
"Invalid q length. Must be " | "Invalid q length. Must be " | ||||
Show All 39 Lines | if (!wq->ring) | ||||
goto free_wq; | goto free_wq; | ||||
LOCK_CREATE(&wq->tx_lock, "TX_lock"); | LOCK_CREATE(&wq->tx_lock, "TX_lock"); | ||||
#if __FreeBSD_version >= 800000 | #if __FreeBSD_version >= 800000 | ||||
/* Allocate buf ring for multiqueue*/ | /* Allocate buf ring for multiqueue*/ | ||||
wq->br = buf_ring_alloc(4096, M_DEVBUF, | wq->br = buf_ring_alloc(4096, M_DEVBUF, | ||||
M_WAITOK, &wq->tx_lock.mutex); | M_WAITOK, &wq->tx_lock.mutex, idx, sc->nwqs); | ||||
if (!wq->br) | if (!wq->br) | ||||
goto free_wq; | goto free_wq; | ||||
#endif | #endif | ||||
return wq; | return wq; | ||||
free_wq: | free_wq: | ||||
device_printf(sc->dev, "Create WQ failed\n"); | device_printf(sc->dev, "Create WQ failed\n"); | ||||
▲ Show 20 Lines • Show All 82 Lines • Show Last 20 Lines |