2020-01-27 18:35:16 +05:30
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
|
|
|
/* Marvell OcteonTx2 RVU Ethernet driver
|
|
|
|
*
|
|
|
|
* Copyright (C) 2020 Marvell International Ltd.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License version 2 as
|
|
|
|
* published by the Free Software Foundation.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/interrupt.h>
|
|
|
|
#include <linux/pci.h>
|
|
|
|
|
|
|
|
#include "otx2_reg.h"
|
|
|
|
#include "otx2_common.h"
|
2020-01-27 18:35:17 +05:30
|
|
|
#include "otx2_struct.h"
|
|
|
|
|
2020-01-27 18:35:18 +05:30
|
|
|
dma_addr_t otx2_alloc_rbuf(struct otx2_nic *pfvf, struct otx2_pool *pool,
|
|
|
|
gfp_t gfp)
|
|
|
|
{
|
|
|
|
dma_addr_t iova;
|
|
|
|
|
|
|
|
/* Check if request can be accommodated in previous allocated page */
|
|
|
|
if (pool->page && ((pool->page_offset + pool->rbsize) <=
|
|
|
|
(PAGE_SIZE << pool->rbpage_order))) {
|
|
|
|
pool->pageref++;
|
|
|
|
goto ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
otx2_get_page(pool);
|
|
|
|
|
|
|
|
/* Allocate a new page */
|
|
|
|
pool->page = alloc_pages(gfp | __GFP_COMP | __GFP_NOWARN,
|
|
|
|
pool->rbpage_order);
|
|
|
|
if (unlikely(!pool->page))
|
|
|
|
return -ENOMEM;
|
|
|
|
|
|
|
|
pool->page_offset = 0;
|
|
|
|
ret:
|
|
|
|
iova = (u64)otx2_dma_map_page(pfvf, pool->page, pool->page_offset,
|
|
|
|
pool->rbsize, DMA_FROM_DEVICE);
|
|
|
|
if (!iova) {
|
|
|
|
if (!pool->page_offset)
|
|
|
|
__free_pages(pool->page, pool->rbpage_order);
|
|
|
|
pool->page = NULL;
|
|
|
|
return -ENOMEM;
|
|
|
|
}
|
|
|
|
pool->page_offset += pool->rbsize;
|
|
|
|
return iova;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int otx2_get_link(struct otx2_nic *pfvf)
|
|
|
|
{
|
|
|
|
int link = 0;
|
|
|
|
u16 map;
|
|
|
|
|
|
|
|
/* cgx lmac link */
|
|
|
|
if (pfvf->hw.tx_chan_base >= CGX_CHAN_BASE) {
|
|
|
|
map = pfvf->hw.tx_chan_base & 0x7FF;
|
|
|
|
link = 4 * ((map >> 8) & 0xF) + ((map >> 4) & 0xF);
|
|
|
|
}
|
|
|
|
/* LBK channel */
|
|
|
|
if (pfvf->hw.tx_chan_base < SDP_CHAN_BASE)
|
|
|
|
link = 12;
|
|
|
|
|
|
|
|
return link;
|
|
|
|
}
|
|
|
|
|
|
|
|
int otx2_txschq_config(struct otx2_nic *pfvf, int lvl)
|
|
|
|
{
|
|
|
|
struct otx2_hw *hw = &pfvf->hw;
|
|
|
|
struct nix_txschq_config *req;
|
|
|
|
u64 schq, parent;
|
|
|
|
|
|
|
|
req = otx2_mbox_alloc_msg_nix_txschq_cfg(&pfvf->mbox);
|
|
|
|
if (!req)
|
|
|
|
return -ENOMEM;
|
|
|
|
|
|
|
|
req->lvl = lvl;
|
|
|
|
req->num_regs = 1;
|
|
|
|
|
|
|
|
schq = hw->txschq_list[lvl][0];
|
|
|
|
/* Set topology e.t.c configuration */
|
|
|
|
if (lvl == NIX_TXSCH_LVL_SMQ) {
|
|
|
|
req->reg[0] = NIX_AF_SMQX_CFG(schq);
|
|
|
|
req->regval[0] |= (0x20ULL << 51) | (0x80ULL << 39) |
|
|
|
|
(0x2ULL << 36);
|
|
|
|
req->num_regs++;
|
|
|
|
/* MDQ config */
|
|
|
|
parent = hw->txschq_list[NIX_TXSCH_LVL_TL4][0];
|
|
|
|
req->reg[1] = NIX_AF_MDQX_PARENT(schq);
|
|
|
|
req->regval[1] = parent << 16;
|
|
|
|
req->num_regs++;
|
|
|
|
/* Set DWRR quantum */
|
|
|
|
req->reg[2] = NIX_AF_MDQX_SCHEDULE(schq);
|
|
|
|
req->regval[2] = DFLT_RR_QTM;
|
|
|
|
} else if (lvl == NIX_TXSCH_LVL_TL4) {
|
|
|
|
parent = hw->txschq_list[NIX_TXSCH_LVL_TL3][0];
|
|
|
|
req->reg[0] = NIX_AF_TL4X_PARENT(schq);
|
|
|
|
req->regval[0] = parent << 16;
|
|
|
|
req->num_regs++;
|
|
|
|
req->reg[1] = NIX_AF_TL4X_SCHEDULE(schq);
|
|
|
|
req->regval[1] = DFLT_RR_QTM;
|
|
|
|
} else if (lvl == NIX_TXSCH_LVL_TL3) {
|
|
|
|
parent = hw->txschq_list[NIX_TXSCH_LVL_TL2][0];
|
|
|
|
req->reg[0] = NIX_AF_TL3X_PARENT(schq);
|
|
|
|
req->regval[0] = parent << 16;
|
|
|
|
req->num_regs++;
|
|
|
|
req->reg[1] = NIX_AF_TL3X_SCHEDULE(schq);
|
|
|
|
req->regval[1] = DFLT_RR_QTM;
|
|
|
|
} else if (lvl == NIX_TXSCH_LVL_TL2) {
|
|
|
|
parent = hw->txschq_list[NIX_TXSCH_LVL_TL1][0];
|
|
|
|
req->reg[0] = NIX_AF_TL2X_PARENT(schq);
|
|
|
|
req->regval[0] = parent << 16;
|
|
|
|
|
|
|
|
req->num_regs++;
|
|
|
|
req->reg[1] = NIX_AF_TL2X_SCHEDULE(schq);
|
|
|
|
req->regval[1] = TXSCH_TL1_DFLT_RR_PRIO << 24 | DFLT_RR_QTM;
|
|
|
|
|
|
|
|
req->num_regs++;
|
|
|
|
req->reg[2] = NIX_AF_TL3_TL2X_LINKX_CFG(schq,
|
|
|
|
otx2_get_link(pfvf));
|
|
|
|
/* Enable this queue and backpressure */
|
|
|
|
req->regval[2] = BIT_ULL(13) | BIT_ULL(12);
|
|
|
|
|
|
|
|
} else if (lvl == NIX_TXSCH_LVL_TL1) {
|
|
|
|
/* Default config for TL1.
|
|
|
|
* For VF this is always ignored.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* Set DWRR quantum */
|
|
|
|
req->reg[0] = NIX_AF_TL1X_SCHEDULE(schq);
|
|
|
|
req->regval[0] = TXSCH_TL1_DFLT_RR_QTM;
|
|
|
|
|
|
|
|
req->num_regs++;
|
|
|
|
req->reg[1] = NIX_AF_TL1X_TOPOLOGY(schq);
|
|
|
|
req->regval[1] = (TXSCH_TL1_DFLT_RR_PRIO << 1);
|
|
|
|
|
|
|
|
req->num_regs++;
|
|
|
|
req->reg[2] = NIX_AF_TL1X_CIR(schq);
|
|
|
|
req->regval[2] = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
return otx2_sync_mbox_msg(&pfvf->mbox);
|
|
|
|
}
|
|
|
|
|
|
|
|
int otx2_txsch_alloc(struct otx2_nic *pfvf)
|
|
|
|
{
|
|
|
|
struct nix_txsch_alloc_req *req;
|
|
|
|
int lvl;
|
|
|
|
|
|
|
|
/* Get memory to put this msg */
|
|
|
|
req = otx2_mbox_alloc_msg_nix_txsch_alloc(&pfvf->mbox);
|
|
|
|
if (!req)
|
|
|
|
return -ENOMEM;
|
|
|
|
|
|
|
|
/* Request one schq per level */
|
|
|
|
for (lvl = 0; lvl < NIX_TXSCH_LVL_CNT; lvl++)
|
|
|
|
req->schq[lvl] = 1;
|
|
|
|
|
|
|
|
return otx2_sync_mbox_msg(&pfvf->mbox);
|
|
|
|
}
|
|
|
|
|
|
|
|
int otx2_txschq_stop(struct otx2_nic *pfvf)
|
|
|
|
{
|
|
|
|
struct nix_txsch_free_req *free_req;
|
|
|
|
int lvl, schq, err;
|
|
|
|
|
|
|
|
otx2_mbox_lock(&pfvf->mbox);
|
|
|
|
/* Free the transmit schedulers */
|
|
|
|
free_req = otx2_mbox_alloc_msg_nix_txsch_free(&pfvf->mbox);
|
|
|
|
if (!free_req) {
|
|
|
|
otx2_mbox_unlock(&pfvf->mbox);
|
|
|
|
return -ENOMEM;
|
|
|
|
}
|
|
|
|
|
|
|
|
free_req->flags = TXSCHQ_FREE_ALL;
|
|
|
|
err = otx2_sync_mbox_msg(&pfvf->mbox);
|
|
|
|
otx2_mbox_unlock(&pfvf->mbox);
|
|
|
|
|
|
|
|
/* Clear the txschq list */
|
|
|
|
for (lvl = 0; lvl < NIX_TXSCH_LVL_CNT; lvl++) {
|
|
|
|
for (schq = 0; schq < MAX_TXSCHQ_PER_FUNC; schq++)
|
|
|
|
pfvf->hw.txschq_list[lvl][schq] = 0;
|
|
|
|
}
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
|
|
|
void otx2_sqb_flush(struct otx2_nic *pfvf)
|
|
|
|
{
|
|
|
|
int qidx, sqe_tail, sqe_head;
|
|
|
|
u64 incr, *ptr, val;
|
|
|
|
|
|
|
|
ptr = (u64 *)otx2_get_regaddr(pfvf, NIX_LF_SQ_OP_STATUS);
|
|
|
|
for (qidx = 0; qidx < pfvf->hw.tx_queues; qidx++) {
|
|
|
|
incr = (u64)qidx << 32;
|
|
|
|
while (1) {
|
|
|
|
val = otx2_atomic64_add(incr, ptr);
|
|
|
|
sqe_head = (val >> 20) & 0x3F;
|
|
|
|
sqe_tail = (val >> 28) & 0x3F;
|
|
|
|
if (sqe_head == sqe_tail)
|
|
|
|
break;
|
|
|
|
usleep_range(1, 3);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* RED and drop levels of CQ on packet reception.
|
|
|
|
* For CQ level is measure of emptiness ( 0x0 = full, 255 = empty).
|
|
|
|
*/
|
|
|
|
#define RQ_PASS_LVL_CQ(skid, qsize) ((((skid) + 16) * 256) / (qsize))
|
|
|
|
#define RQ_DROP_LVL_CQ(skid, qsize) (((skid) * 256) / (qsize))
|
|
|
|
|
|
|
|
/* RED and drop levels of AURA for packet reception.
|
|
|
|
* For AURA level is measure of fullness (0x0 = empty, 255 = full).
|
|
|
|
* Eg: For RQ length 1K, for pass/drop level 204/230.
|
|
|
|
* RED accepts pkts if free pointers > 102 & <= 205.
|
|
|
|
* Drops pkts if free pointers < 102.
|
|
|
|
*/
|
|
|
|
#define RQ_PASS_LVL_AURA (255 - ((95 * 256) / 100)) /* RED when 95% is full */
|
|
|
|
#define RQ_DROP_LVL_AURA (255 - ((99 * 256) / 100)) /* Drop when 99% is full */
|
|
|
|
|
|
|
|
/* Send skid of 2000 packets required for CQ size of 4K CQEs. */
|
|
|
|
#define SEND_CQ_SKID 2000
|
|
|
|
|
|
|
|
static int otx2_rq_init(struct otx2_nic *pfvf, u16 qidx, u16 lpb_aura)
|
|
|
|
{
|
|
|
|
struct otx2_qset *qset = &pfvf->qset;
|
|
|
|
struct nix_aq_enq_req *aq;
|
|
|
|
|
|
|
|
/* Get memory to put this msg */
|
|
|
|
aq = otx2_mbox_alloc_msg_nix_aq_enq(&pfvf->mbox);
|
|
|
|
if (!aq)
|
|
|
|
return -ENOMEM;
|
|
|
|
|
|
|
|
aq->rq.cq = qidx;
|
|
|
|
aq->rq.ena = 1;
|
|
|
|
aq->rq.pb_caching = 1;
|
|
|
|
aq->rq.lpb_aura = lpb_aura; /* Use large packet buffer aura */
|
|
|
|
aq->rq.lpb_sizem1 = (DMA_BUFFER_LEN(pfvf->rbsize) / 8) - 1;
|
|
|
|
aq->rq.xqe_imm_size = 0; /* Copying of packet to CQE not needed */
|
|
|
|
aq->rq.flow_tagw = 32; /* Copy full 32bit flow_tag to CQE header */
|
|
|
|
aq->rq.lpb_drop_ena = 1; /* Enable RED dropping for AURA */
|
|
|
|
aq->rq.xqe_drop_ena = 1; /* Enable RED dropping for CQ/SSO */
|
|
|
|
aq->rq.xqe_pass = RQ_PASS_LVL_CQ(pfvf->hw.rq_skid, qset->rqe_cnt);
|
|
|
|
aq->rq.xqe_drop = RQ_DROP_LVL_CQ(pfvf->hw.rq_skid, qset->rqe_cnt);
|
|
|
|
aq->rq.lpb_aura_pass = RQ_PASS_LVL_AURA;
|
|
|
|
aq->rq.lpb_aura_drop = RQ_DROP_LVL_AURA;
|
|
|
|
|
|
|
|
/* Fill AQ info */
|
|
|
|
aq->qidx = qidx;
|
|
|
|
aq->ctype = NIX_AQ_CTYPE_RQ;
|
|
|
|
aq->op = NIX_AQ_INSTOP_INIT;
|
|
|
|
|
|
|
|
return otx2_sync_mbox_msg(&pfvf->mbox);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int otx2_sq_init(struct otx2_nic *pfvf, u16 qidx, u16 sqb_aura)
|
|
|
|
{
|
|
|
|
struct otx2_qset *qset = &pfvf->qset;
|
|
|
|
struct otx2_snd_queue *sq;
|
|
|
|
struct nix_aq_enq_req *aq;
|
|
|
|
struct otx2_pool *pool;
|
|
|
|
int err;
|
|
|
|
|
|
|
|
pool = &pfvf->qset.pool[sqb_aura];
|
|
|
|
sq = &qset->sq[qidx];
|
|
|
|
sq->sqe_size = NIX_SQESZ_W16 ? 64 : 128;
|
|
|
|
sq->sqe_cnt = qset->sqe_cnt;
|
|
|
|
|
|
|
|
err = qmem_alloc(pfvf->dev, &sq->sqe, 1, sq->sqe_size);
|
|
|
|
if (err)
|
|
|
|
return err;
|
|
|
|
|
|
|
|
sq->sqe_base = sq->sqe->base;
|
|
|
|
|
|
|
|
sq->sqe_per_sqb = (pfvf->hw.sqb_size / sq->sqe_size) - 1;
|
|
|
|
sq->num_sqbs = (qset->sqe_cnt + sq->sqe_per_sqb) / sq->sqe_per_sqb;
|
|
|
|
sq->aura_id = sqb_aura;
|
|
|
|
sq->aura_fc_addr = pool->fc_addr->base;
|
|
|
|
sq->lmt_addr = (__force u64 *)(pfvf->reg_base + LMT_LF_LMTLINEX(qidx));
|
|
|
|
sq->io_addr = (__force u64)otx2_get_regaddr(pfvf, NIX_LF_OP_SENDX(0));
|
|
|
|
|
|
|
|
/* Get memory to put this msg */
|
|
|
|
aq = otx2_mbox_alloc_msg_nix_aq_enq(&pfvf->mbox);
|
|
|
|
if (!aq)
|
|
|
|
return -ENOMEM;
|
|
|
|
|
|
|
|
aq->sq.cq = pfvf->hw.rx_queues + qidx;
|
|
|
|
aq->sq.max_sqe_size = NIX_MAXSQESZ_W16; /* 128 byte */
|
|
|
|
aq->sq.cq_ena = 1;
|
|
|
|
aq->sq.ena = 1;
|
|
|
|
/* Only one SMQ is allocated, map all SQ's to that SMQ */
|
|
|
|
aq->sq.smq = pfvf->hw.txschq_list[NIX_TXSCH_LVL_SMQ][0];
|
|
|
|
aq->sq.smq_rr_quantum = DFLT_RR_QTM;
|
|
|
|
aq->sq.default_chan = pfvf->hw.tx_chan_base;
|
|
|
|
aq->sq.sqe_stype = NIX_STYPE_STF; /* Cache SQB */
|
|
|
|
aq->sq.sqb_aura = sqb_aura;
|
|
|
|
/* Due pipelining impact minimum 2000 unused SQ CQE's
|
|
|
|
* need to maintain to avoid CQ overflow.
|
|
|
|
*/
|
|
|
|
aq->sq.cq_limit = ((SEND_CQ_SKID * 256) / (sq->sqe_cnt));
|
|
|
|
|
|
|
|
/* Fill AQ info */
|
|
|
|
aq->qidx = qidx;
|
|
|
|
aq->ctype = NIX_AQ_CTYPE_SQ;
|
|
|
|
aq->op = NIX_AQ_INSTOP_INIT;
|
|
|
|
|
|
|
|
return otx2_sync_mbox_msg(&pfvf->mbox);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int otx2_cq_init(struct otx2_nic *pfvf, u16 qidx)
|
|
|
|
{
|
|
|
|
struct otx2_qset *qset = &pfvf->qset;
|
|
|
|
struct nix_aq_enq_req *aq;
|
|
|
|
struct otx2_cq_queue *cq;
|
|
|
|
int err, pool_id;
|
|
|
|
|
|
|
|
cq = &qset->cq[qidx];
|
|
|
|
cq->cq_idx = qidx;
|
|
|
|
if (qidx < pfvf->hw.rx_queues) {
|
|
|
|
cq->cq_type = CQ_RX;
|
|
|
|
cq->cqe_cnt = qset->rqe_cnt;
|
|
|
|
} else {
|
|
|
|
cq->cq_type = CQ_TX;
|
|
|
|
cq->cqe_cnt = qset->sqe_cnt;
|
|
|
|
}
|
|
|
|
cq->cqe_size = pfvf->qset.xqe_size;
|
|
|
|
|
|
|
|
/* Allocate memory for CQEs */
|
|
|
|
err = qmem_alloc(pfvf->dev, &cq->cqe, cq->cqe_cnt, cq->cqe_size);
|
|
|
|
if (err)
|
|
|
|
return err;
|
|
|
|
|
|
|
|
/* Save CQE CPU base for faster reference */
|
|
|
|
cq->cqe_base = cq->cqe->base;
|
|
|
|
/* In case where all RQs auras point to single pool,
|
|
|
|
* all CQs receive buffer pool also point to same pool.
|
|
|
|
*/
|
|
|
|
pool_id = ((cq->cq_type == CQ_RX) &&
|
|
|
|
(pfvf->hw.rqpool_cnt != pfvf->hw.rx_queues)) ? 0 : qidx;
|
|
|
|
cq->rbpool = &qset->pool[pool_id];
|
|
|
|
|
|
|
|
/* Get memory to put this msg */
|
|
|
|
aq = otx2_mbox_alloc_msg_nix_aq_enq(&pfvf->mbox);
|
|
|
|
if (!aq)
|
|
|
|
return -ENOMEM;
|
|
|
|
|
|
|
|
aq->cq.ena = 1;
|
|
|
|
aq->cq.qsize = Q_SIZE(cq->cqe_cnt, 4);
|
|
|
|
aq->cq.caching = 1;
|
|
|
|
aq->cq.base = cq->cqe->iova;
|
|
|
|
aq->cq.avg_level = 255;
|
|
|
|
|
|
|
|
if (qidx < pfvf->hw.rx_queues) {
|
|
|
|
aq->cq.drop = RQ_DROP_LVL_CQ(pfvf->hw.rq_skid, cq->cqe_cnt);
|
|
|
|
aq->cq.drop_ena = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Fill AQ info */
|
|
|
|
aq->qidx = qidx;
|
|
|
|
aq->ctype = NIX_AQ_CTYPE_CQ;
|
|
|
|
aq->op = NIX_AQ_INSTOP_INIT;
|
|
|
|
|
|
|
|
return otx2_sync_mbox_msg(&pfvf->mbox);
|
|
|
|
}
|
|
|
|
|
|
|
|
int otx2_config_nix_queues(struct otx2_nic *pfvf)
|
|
|
|
{
|
|
|
|
int qidx, err;
|
|
|
|
|
|
|
|
/* Initialize RX queues */
|
|
|
|
for (qidx = 0; qidx < pfvf->hw.rx_queues; qidx++) {
|
|
|
|
u16 lpb_aura = otx2_get_pool_idx(pfvf, AURA_NIX_RQ, qidx);
|
|
|
|
|
|
|
|
err = otx2_rq_init(pfvf, qidx, lpb_aura);
|
|
|
|
if (err)
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Initialize TX queues */
|
|
|
|
for (qidx = 0; qidx < pfvf->hw.tx_queues; qidx++) {
|
|
|
|
u16 sqb_aura = otx2_get_pool_idx(pfvf, AURA_NIX_SQ, qidx);
|
|
|
|
|
|
|
|
err = otx2_sq_init(pfvf, qidx, sqb_aura);
|
|
|
|
if (err)
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Initialize completion queues */
|
|
|
|
for (qidx = 0; qidx < pfvf->qset.cq_cnt; qidx++) {
|
|
|
|
err = otx2_cq_init(pfvf, qidx);
|
|
|
|
if (err)
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2020-01-27 18:35:17 +05:30
|
|
|
int otx2_config_nix(struct otx2_nic *pfvf)
|
|
|
|
{
|
|
|
|
struct nix_lf_alloc_req *nixlf;
|
|
|
|
struct nix_lf_alloc_rsp *rsp;
|
|
|
|
int err;
|
|
|
|
|
|
|
|
pfvf->qset.xqe_size = NIX_XQESZ_W16 ? 128 : 512;
|
|
|
|
|
|
|
|
/* Get memory to put this msg */
|
|
|
|
nixlf = otx2_mbox_alloc_msg_nix_lf_alloc(&pfvf->mbox);
|
|
|
|
if (!nixlf)
|
|
|
|
return -ENOMEM;
|
|
|
|
|
|
|
|
/* Set RQ/SQ/CQ counts */
|
|
|
|
nixlf->rq_cnt = pfvf->hw.rx_queues;
|
|
|
|
nixlf->sq_cnt = pfvf->hw.tx_queues;
|
|
|
|
nixlf->cq_cnt = pfvf->qset.cq_cnt;
|
|
|
|
nixlf->xqe_sz = NIX_XQESZ_W16;
|
|
|
|
/* We don't know absolute NPA LF idx attached.
|
|
|
|
* AF will replace 'RVU_DEFAULT_PF_FUNC' with
|
|
|
|
* NPA LF attached to this RVU PF/VF.
|
|
|
|
*/
|
|
|
|
nixlf->npa_func = RVU_DEFAULT_PF_FUNC;
|
|
|
|
/* Disable alignment pad, enable L2 length check,
|
|
|
|
* enable L4 TCP/UDP checksum verification.
|
|
|
|
*/
|
|
|
|
nixlf->rx_cfg = BIT_ULL(33) | BIT_ULL(35) | BIT_ULL(37);
|
|
|
|
|
|
|
|
err = otx2_sync_mbox_msg(&pfvf->mbox);
|
|
|
|
if (err)
|
|
|
|
return err;
|
|
|
|
|
|
|
|
rsp = (struct nix_lf_alloc_rsp *)otx2_mbox_get_rsp(&pfvf->mbox.mbox, 0,
|
|
|
|
&nixlf->hdr);
|
|
|
|
if (IS_ERR(rsp))
|
|
|
|
return PTR_ERR(rsp);
|
|
|
|
|
|
|
|
if (rsp->qints < 1)
|
|
|
|
return -ENXIO;
|
|
|
|
|
|
|
|
return rsp->hdr.rc;
|
|
|
|
}
|
|
|
|
|
2020-01-27 18:35:18 +05:30
|
|
|
void otx2_sq_free_sqbs(struct otx2_nic *pfvf)
|
|
|
|
{
|
|
|
|
struct otx2_qset *qset = &pfvf->qset;
|
|
|
|
struct otx2_hw *hw = &pfvf->hw;
|
|
|
|
struct otx2_snd_queue *sq;
|
|
|
|
int sqb, qidx;
|
|
|
|
u64 iova, pa;
|
|
|
|
|
|
|
|
for (qidx = 0; qidx < hw->tx_queues; qidx++) {
|
|
|
|
sq = &qset->sq[qidx];
|
|
|
|
if (!sq->sqb_ptrs)
|
|
|
|
continue;
|
|
|
|
for (sqb = 0; sqb < sq->sqb_count; sqb++) {
|
|
|
|
if (!sq->sqb_ptrs[sqb])
|
|
|
|
continue;
|
|
|
|
iova = sq->sqb_ptrs[sqb];
|
|
|
|
pa = otx2_iova_to_phys(pfvf->iommu_domain, iova);
|
|
|
|
dma_unmap_page_attrs(pfvf->dev, iova, hw->sqb_size,
|
|
|
|
DMA_FROM_DEVICE,
|
|
|
|
DMA_ATTR_SKIP_CPU_SYNC);
|
|
|
|
put_page(virt_to_page(phys_to_virt(pa)));
|
|
|
|
}
|
|
|
|
sq->sqb_count = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void otx2_free_aura_ptr(struct otx2_nic *pfvf, int type)
|
|
|
|
{
|
|
|
|
int pool_id, pool_start = 0, pool_end = 0, size = 0;
|
|
|
|
u64 iova, pa;
|
|
|
|
|
|
|
|
if (type == AURA_NIX_SQ) {
|
|
|
|
pool_start = otx2_get_pool_idx(pfvf, type, 0);
|
|
|
|
pool_end = pool_start + pfvf->hw.sqpool_cnt;
|
|
|
|
size = pfvf->hw.sqb_size;
|
|
|
|
}
|
|
|
|
if (type == AURA_NIX_RQ) {
|
|
|
|
pool_start = otx2_get_pool_idx(pfvf, type, 0);
|
|
|
|
pool_end = pfvf->hw.rqpool_cnt;
|
|
|
|
size = pfvf->rbsize;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Free SQB and RQB pointers from the aura pool */
|
|
|
|
for (pool_id = pool_start; pool_id < pool_end; pool_id++) {
|
|
|
|
iova = otx2_aura_allocptr(pfvf, pool_id);
|
|
|
|
while (iova) {
|
|
|
|
if (type == AURA_NIX_RQ)
|
|
|
|
iova -= OTX2_HEAD_ROOM;
|
|
|
|
|
|
|
|
pa = otx2_iova_to_phys(pfvf->iommu_domain, iova);
|
|
|
|
dma_unmap_page_attrs(pfvf->dev, iova, size,
|
|
|
|
DMA_FROM_DEVICE,
|
|
|
|
DMA_ATTR_SKIP_CPU_SYNC);
|
|
|
|
put_page(virt_to_page(phys_to_virt(pa)));
|
|
|
|
iova = otx2_aura_allocptr(pfvf, pool_id);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void otx2_aura_pool_free(struct otx2_nic *pfvf)
|
|
|
|
{
|
|
|
|
struct otx2_pool *pool;
|
|
|
|
int pool_id;
|
|
|
|
|
|
|
|
if (!pfvf->qset.pool)
|
|
|
|
return;
|
|
|
|
|
|
|
|
for (pool_id = 0; pool_id < pfvf->hw.pool_cnt; pool_id++) {
|
|
|
|
pool = &pfvf->qset.pool[pool_id];
|
|
|
|
qmem_free(pfvf->dev, pool->stack);
|
|
|
|
qmem_free(pfvf->dev, pool->fc_addr);
|
|
|
|
}
|
|
|
|
devm_kfree(pfvf->dev, pfvf->qset.pool);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int otx2_aura_init(struct otx2_nic *pfvf, int aura_id,
|
|
|
|
int pool_id, int numptrs)
|
|
|
|
{
|
|
|
|
struct npa_aq_enq_req *aq;
|
|
|
|
struct otx2_pool *pool;
|
|
|
|
int err;
|
|
|
|
|
|
|
|
pool = &pfvf->qset.pool[pool_id];
|
|
|
|
|
|
|
|
/* Allocate memory for HW to update Aura count.
|
|
|
|
* Alloc one cache line, so that it fits all FC_STYPE modes.
|
|
|
|
*/
|
|
|
|
if (!pool->fc_addr) {
|
|
|
|
err = qmem_alloc(pfvf->dev, &pool->fc_addr, 1, OTX2_ALIGN);
|
|
|
|
if (err)
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Initialize this aura's context via AF */
|
|
|
|
aq = otx2_mbox_alloc_msg_npa_aq_enq(&pfvf->mbox);
|
|
|
|
if (!aq) {
|
|
|
|
/* Shared mbox memory buffer is full, flush it and retry */
|
|
|
|
err = otx2_sync_mbox_msg(&pfvf->mbox);
|
|
|
|
if (err)
|
|
|
|
return err;
|
|
|
|
aq = otx2_mbox_alloc_msg_npa_aq_enq(&pfvf->mbox);
|
|
|
|
if (!aq)
|
|
|
|
return -ENOMEM;
|
|
|
|
}
|
|
|
|
|
|
|
|
aq->aura_id = aura_id;
|
|
|
|
/* Will be filled by AF with correct pool context address */
|
|
|
|
aq->aura.pool_addr = pool_id;
|
|
|
|
aq->aura.pool_caching = 1;
|
|
|
|
aq->aura.shift = ilog2(numptrs) - 8;
|
|
|
|
aq->aura.count = numptrs;
|
|
|
|
aq->aura.limit = numptrs;
|
|
|
|
aq->aura.avg_level = 255;
|
|
|
|
aq->aura.ena = 1;
|
|
|
|
aq->aura.fc_ena = 1;
|
|
|
|
aq->aura.fc_addr = pool->fc_addr->iova;
|
|
|
|
aq->aura.fc_hyst_bits = 0; /* Store count on all updates */
|
|
|
|
|
|
|
|
/* Fill AQ info */
|
|
|
|
aq->ctype = NPA_AQ_CTYPE_AURA;
|
|
|
|
aq->op = NPA_AQ_INSTOP_INIT;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int otx2_pool_init(struct otx2_nic *pfvf, u16 pool_id,
|
|
|
|
int stack_pages, int numptrs, int buf_size)
|
|
|
|
{
|
|
|
|
struct npa_aq_enq_req *aq;
|
|
|
|
struct otx2_pool *pool;
|
|
|
|
int err;
|
|
|
|
|
|
|
|
pool = &pfvf->qset.pool[pool_id];
|
|
|
|
/* Alloc memory for stack which is used to store buffer pointers */
|
|
|
|
err = qmem_alloc(pfvf->dev, &pool->stack,
|
|
|
|
stack_pages, pfvf->hw.stack_pg_bytes);
|
|
|
|
if (err)
|
|
|
|
return err;
|
|
|
|
|
|
|
|
pool->rbsize = buf_size;
|
|
|
|
pool->rbpage_order = get_order(buf_size);
|
|
|
|
|
|
|
|
/* Initialize this pool's context via AF */
|
|
|
|
aq = otx2_mbox_alloc_msg_npa_aq_enq(&pfvf->mbox);
|
|
|
|
if (!aq) {
|
|
|
|
/* Shared mbox memory buffer is full, flush it and retry */
|
|
|
|
err = otx2_sync_mbox_msg(&pfvf->mbox);
|
|
|
|
if (err) {
|
|
|
|
qmem_free(pfvf->dev, pool->stack);
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
aq = otx2_mbox_alloc_msg_npa_aq_enq(&pfvf->mbox);
|
|
|
|
if (!aq) {
|
|
|
|
qmem_free(pfvf->dev, pool->stack);
|
|
|
|
return -ENOMEM;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
aq->aura_id = pool_id;
|
|
|
|
aq->pool.stack_base = pool->stack->iova;
|
|
|
|
aq->pool.stack_caching = 1;
|
|
|
|
aq->pool.ena = 1;
|
|
|
|
aq->pool.buf_size = buf_size / 128;
|
|
|
|
aq->pool.stack_max_pages = stack_pages;
|
|
|
|
aq->pool.shift = ilog2(numptrs) - 8;
|
|
|
|
aq->pool.ptr_start = 0;
|
|
|
|
aq->pool.ptr_end = ~0ULL;
|
|
|
|
|
|
|
|
/* Fill AQ info */
|
|
|
|
aq->ctype = NPA_AQ_CTYPE_POOL;
|
|
|
|
aq->op = NPA_AQ_INSTOP_INIT;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int otx2_sq_aura_pool_init(struct otx2_nic *pfvf)
|
|
|
|
{
|
|
|
|
int qidx, pool_id, stack_pages, num_sqbs;
|
|
|
|
struct otx2_qset *qset = &pfvf->qset;
|
|
|
|
struct otx2_hw *hw = &pfvf->hw;
|
|
|
|
struct otx2_snd_queue *sq;
|
|
|
|
struct otx2_pool *pool;
|
|
|
|
int err, ptr;
|
|
|
|
s64 bufptr;
|
|
|
|
|
|
|
|
/* Calculate number of SQBs needed.
|
|
|
|
*
|
|
|
|
* For a 128byte SQE, and 4K size SQB, 31 SQEs will fit in one SQB.
|
|
|
|
* Last SQE is used for pointing to next SQB.
|
|
|
|
*/
|
|
|
|
num_sqbs = (hw->sqb_size / 128) - 1;
|
|
|
|
num_sqbs = (qset->sqe_cnt + num_sqbs) / num_sqbs;
|
|
|
|
|
|
|
|
/* Get no of stack pages needed */
|
|
|
|
stack_pages =
|
|
|
|
(num_sqbs + hw->stack_pg_ptrs - 1) / hw->stack_pg_ptrs;
|
|
|
|
|
|
|
|
for (qidx = 0; qidx < hw->tx_queues; qidx++) {
|
|
|
|
pool_id = otx2_get_pool_idx(pfvf, AURA_NIX_SQ, qidx);
|
|
|
|
/* Initialize aura context */
|
|
|
|
err = otx2_aura_init(pfvf, pool_id, pool_id, num_sqbs);
|
|
|
|
if (err)
|
|
|
|
goto fail;
|
|
|
|
|
|
|
|
/* Initialize pool context */
|
|
|
|
err = otx2_pool_init(pfvf, pool_id, stack_pages,
|
|
|
|
num_sqbs, hw->sqb_size);
|
|
|
|
if (err)
|
|
|
|
goto fail;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Flush accumulated messages */
|
|
|
|
err = otx2_sync_mbox_msg(&pfvf->mbox);
|
|
|
|
if (err)
|
|
|
|
goto fail;
|
|
|
|
|
|
|
|
/* Allocate pointers and free them to aura/pool */
|
|
|
|
for (qidx = 0; qidx < hw->tx_queues; qidx++) {
|
|
|
|
pool_id = otx2_get_pool_idx(pfvf, AURA_NIX_SQ, qidx);
|
|
|
|
pool = &pfvf->qset.pool[pool_id];
|
|
|
|
|
|
|
|
sq = &qset->sq[qidx];
|
|
|
|
sq->sqb_count = 0;
|
|
|
|
sq->sqb_ptrs = kcalloc(num_sqbs, sizeof(u64 *), GFP_KERNEL);
|
|
|
|
if (!sq->sqb_ptrs)
|
|
|
|
return -ENOMEM;
|
|
|
|
|
|
|
|
for (ptr = 0; ptr < num_sqbs; ptr++) {
|
|
|
|
bufptr = otx2_alloc_rbuf(pfvf, pool, GFP_KERNEL);
|
|
|
|
if (bufptr <= 0)
|
|
|
|
return bufptr;
|
|
|
|
otx2_aura_freeptr(pfvf, pool_id, bufptr);
|
|
|
|
sq->sqb_ptrs[sq->sqb_count++] = (u64)bufptr;
|
|
|
|
}
|
|
|
|
otx2_get_page(pool);
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
fail:
|
|
|
|
otx2_mbox_reset(&pfvf->mbox.mbox, 0);
|
|
|
|
otx2_aura_pool_free(pfvf);
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
|
|
|
int otx2_rq_aura_pool_init(struct otx2_nic *pfvf)
|
|
|
|
{
|
|
|
|
struct otx2_hw *hw = &pfvf->hw;
|
|
|
|
int stack_pages, pool_id, rq;
|
|
|
|
struct otx2_pool *pool;
|
|
|
|
int err, ptr, num_ptrs;
|
|
|
|
s64 bufptr;
|
|
|
|
|
|
|
|
num_ptrs = pfvf->qset.rqe_cnt;
|
|
|
|
|
|
|
|
stack_pages =
|
|
|
|
(num_ptrs + hw->stack_pg_ptrs - 1) / hw->stack_pg_ptrs;
|
|
|
|
|
|
|
|
for (rq = 0; rq < hw->rx_queues; rq++) {
|
|
|
|
pool_id = otx2_get_pool_idx(pfvf, AURA_NIX_RQ, rq);
|
|
|
|
/* Initialize aura context */
|
|
|
|
err = otx2_aura_init(pfvf, pool_id, pool_id, num_ptrs);
|
|
|
|
if (err)
|
|
|
|
goto fail;
|
|
|
|
}
|
|
|
|
for (pool_id = 0; pool_id < hw->rqpool_cnt; pool_id++) {
|
|
|
|
err = otx2_pool_init(pfvf, pool_id, stack_pages,
|
|
|
|
num_ptrs, pfvf->rbsize);
|
|
|
|
if (err)
|
|
|
|
goto fail;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Flush accumulated messages */
|
|
|
|
err = otx2_sync_mbox_msg(&pfvf->mbox);
|
|
|
|
if (err)
|
|
|
|
goto fail;
|
|
|
|
|
|
|
|
/* Allocate pointers and free them to aura/pool */
|
|
|
|
for (pool_id = 0; pool_id < hw->rqpool_cnt; pool_id++) {
|
|
|
|
pool = &pfvf->qset.pool[pool_id];
|
|
|
|
for (ptr = 0; ptr < num_ptrs; ptr++) {
|
|
|
|
bufptr = otx2_alloc_rbuf(pfvf, pool, GFP_KERNEL);
|
|
|
|
if (bufptr <= 0)
|
|
|
|
return bufptr;
|
|
|
|
otx2_aura_freeptr(pfvf, pool_id,
|
|
|
|
bufptr + OTX2_HEAD_ROOM);
|
|
|
|
}
|
|
|
|
otx2_get_page(pool);
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
fail:
|
|
|
|
otx2_mbox_reset(&pfvf->mbox.mbox, 0);
|
|
|
|
otx2_aura_pool_free(pfvf);
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
2020-01-27 18:35:17 +05:30
|
|
|
int otx2_config_npa(struct otx2_nic *pfvf)
|
|
|
|
{
|
|
|
|
struct otx2_qset *qset = &pfvf->qset;
|
|
|
|
struct npa_lf_alloc_req *npalf;
|
|
|
|
struct otx2_hw *hw = &pfvf->hw;
|
|
|
|
int aura_cnt;
|
|
|
|
|
|
|
|
/* Pool - Stack of free buffer pointers
|
|
|
|
* Aura - Alloc/frees pointers from/to pool for NIX DMA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
if (!hw->pool_cnt)
|
|
|
|
return -EINVAL;
|
|
|
|
|
|
|
|
qset->pool = devm_kzalloc(pfvf->dev, sizeof(struct otx2_pool) *
|
|
|
|
hw->pool_cnt, GFP_KERNEL);
|
|
|
|
if (!qset->pool)
|
|
|
|
return -ENOMEM;
|
|
|
|
|
|
|
|
/* Get memory to put this msg */
|
|
|
|
npalf = otx2_mbox_alloc_msg_npa_lf_alloc(&pfvf->mbox);
|
|
|
|
if (!npalf)
|
|
|
|
return -ENOMEM;
|
|
|
|
|
|
|
|
/* Set aura and pool counts */
|
|
|
|
npalf->nr_pools = hw->pool_cnt;
|
|
|
|
aura_cnt = ilog2(roundup_pow_of_two(hw->pool_cnt));
|
|
|
|
npalf->aura_sz = (aura_cnt >= ilog2(128)) ? (aura_cnt - 6) : 1;
|
|
|
|
|
|
|
|
return otx2_sync_mbox_msg(&pfvf->mbox);
|
|
|
|
}
|
|
|
|
|
|
|
|
int otx2_detach_resources(struct mbox *mbox)
|
|
|
|
{
|
|
|
|
struct rsrc_detach *detach;
|
|
|
|
|
|
|
|
otx2_mbox_lock(mbox);
|
|
|
|
detach = otx2_mbox_alloc_msg_detach_resources(mbox);
|
|
|
|
if (!detach) {
|
|
|
|
otx2_mbox_unlock(mbox);
|
|
|
|
return -ENOMEM;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* detach all */
|
|
|
|
detach->partial = false;
|
|
|
|
|
|
|
|
/* Send detach request to AF */
|
|
|
|
otx2_mbox_msg_send(&mbox->mbox, 0);
|
|
|
|
otx2_mbox_unlock(mbox);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int otx2_attach_npa_nix(struct otx2_nic *pfvf)
|
|
|
|
{
|
|
|
|
struct rsrc_attach *attach;
|
|
|
|
struct msg_req *msix;
|
|
|
|
int err;
|
|
|
|
|
|
|
|
otx2_mbox_lock(&pfvf->mbox);
|
|
|
|
/* Get memory to put this msg */
|
|
|
|
attach = otx2_mbox_alloc_msg_attach_resources(&pfvf->mbox);
|
|
|
|
if (!attach) {
|
|
|
|
otx2_mbox_unlock(&pfvf->mbox);
|
|
|
|
return -ENOMEM;
|
|
|
|
}
|
|
|
|
|
|
|
|
attach->npalf = true;
|
|
|
|
attach->nixlf = true;
|
|
|
|
|
|
|
|
/* Send attach request to AF */
|
|
|
|
err = otx2_sync_mbox_msg(&pfvf->mbox);
|
|
|
|
if (err) {
|
|
|
|
otx2_mbox_unlock(&pfvf->mbox);
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
2020-01-27 18:35:18 +05:30
|
|
|
pfvf->nix_blkaddr = BLKADDR_NIX0;
|
|
|
|
|
|
|
|
/* If the platform has two NIX blocks then LF may be
|
|
|
|
* allocated from NIX1.
|
|
|
|
*/
|
|
|
|
if (otx2_read64(pfvf, RVU_PF_BLOCK_ADDRX_DISC(BLKADDR_NIX1)) & 0x1FFULL)
|
|
|
|
pfvf->nix_blkaddr = BLKADDR_NIX1;
|
|
|
|
|
2020-01-27 18:35:17 +05:30
|
|
|
/* Get NPA and NIX MSIX vector offsets */
|
|
|
|
msix = otx2_mbox_alloc_msg_msix_offset(&pfvf->mbox);
|
|
|
|
if (!msix) {
|
|
|
|
otx2_mbox_unlock(&pfvf->mbox);
|
|
|
|
return -ENOMEM;
|
|
|
|
}
|
|
|
|
|
|
|
|
err = otx2_sync_mbox_msg(&pfvf->mbox);
|
|
|
|
if (err) {
|
|
|
|
otx2_mbox_unlock(&pfvf->mbox);
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
otx2_mbox_unlock(&pfvf->mbox);
|
|
|
|
|
|
|
|
if (pfvf->hw.npa_msixoff == MSIX_VECTOR_INVALID ||
|
|
|
|
pfvf->hw.nix_msixoff == MSIX_VECTOR_INVALID) {
|
|
|
|
dev_err(pfvf->dev,
|
|
|
|
"RVUPF: Invalid MSIX vector offset for NPA/NIX\n");
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2020-01-27 18:35:18 +05:30
|
|
|
void otx2_ctx_disable(struct mbox *mbox, int type, bool npa)
|
|
|
|
{
|
|
|
|
struct hwctx_disable_req *req;
|
|
|
|
|
|
|
|
otx2_mbox_lock(mbox);
|
|
|
|
/* Request AQ to disable this context */
|
|
|
|
if (npa)
|
|
|
|
req = otx2_mbox_alloc_msg_npa_hwctx_disable(mbox);
|
|
|
|
else
|
|
|
|
req = otx2_mbox_alloc_msg_nix_hwctx_disable(mbox);
|
|
|
|
|
|
|
|
if (!req) {
|
|
|
|
otx2_mbox_unlock(mbox);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
req->ctype = type;
|
|
|
|
|
|
|
|
if (otx2_sync_mbox_msg(mbox))
|
|
|
|
dev_err(mbox->pfvf->dev, "%s failed to disable context\n",
|
|
|
|
__func__);
|
|
|
|
|
|
|
|
otx2_mbox_unlock(mbox);
|
|
|
|
}
|
|
|
|
|
|
|
|
void mbox_handler_nix_txsch_alloc(struct otx2_nic *pf,
|
|
|
|
struct nix_txsch_alloc_rsp *rsp)
|
|
|
|
{
|
|
|
|
int lvl, schq;
|
|
|
|
|
|
|
|
/* Setup transmit scheduler list */
|
|
|
|
for (lvl = 0; lvl < NIX_TXSCH_LVL_CNT; lvl++)
|
|
|
|
for (schq = 0; schq < rsp->schq[lvl]; schq++)
|
|
|
|
pf->hw.txschq_list[lvl][schq] =
|
|
|
|
rsp->schq_list[lvl][schq];
|
|
|
|
}
|
|
|
|
|
2020-01-27 18:35:17 +05:30
|
|
|
/* Mbox message handlers */
|
|
|
|
void mbox_handler_npa_lf_alloc(struct otx2_nic *pfvf,
|
|
|
|
struct npa_lf_alloc_rsp *rsp)
|
|
|
|
{
|
|
|
|
pfvf->hw.stack_pg_ptrs = rsp->stack_pg_ptrs;
|
|
|
|
pfvf->hw.stack_pg_bytes = rsp->stack_pg_bytes;
|
|
|
|
}
|
|
|
|
|
|
|
|
void mbox_handler_nix_lf_alloc(struct otx2_nic *pfvf,
|
|
|
|
struct nix_lf_alloc_rsp *rsp)
|
|
|
|
{
|
|
|
|
pfvf->hw.sqb_size = rsp->sqb_size;
|
|
|
|
pfvf->hw.rx_chan_base = rsp->rx_chan_base;
|
|
|
|
pfvf->hw.tx_chan_base = rsp->tx_chan_base;
|
|
|
|
}
|
|
|
|
|
|
|
|
void mbox_handler_msix_offset(struct otx2_nic *pfvf,
|
|
|
|
struct msix_offset_rsp *rsp)
|
|
|
|
{
|
|
|
|
pfvf->hw.npa_msixoff = rsp->npa_msixoff;
|
|
|
|
pfvf->hw.nix_msixoff = rsp->nix_msixoff;
|
|
|
|
}
|
2020-01-27 18:35:16 +05:30
|
|
|
|
|
|
|
#define M(_name, _id, _fn_name, _req_type, _rsp_type) \
|
|
|
|
int __weak \
|
|
|
|
otx2_mbox_up_handler_ ## _fn_name(struct otx2_nic *pfvf, \
|
|
|
|
struct _req_type *req, \
|
|
|
|
struct _rsp_type *rsp) \
|
|
|
|
{ \
|
|
|
|
/* Nothing to do here */ \
|
|
|
|
return 0; \
|
|
|
|
} \
|
|
|
|
EXPORT_SYMBOL(otx2_mbox_up_handler_ ## _fn_name);
|
|
|
|
MBOX_UP_CGX_MESSAGES
|
|
|
|
#undef M
|