mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-27 02:45:17 +07:00
Merge branch 'octeontx2-af-Cleanup-changes'
Sunil Goutham says: ==================== octeontx2-af: Cleanup changes These patches cleanup AF driver by removing unnecessary function exports and cleanup repititive logic. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
commit
c3d5e561d6
@ -113,7 +113,6 @@ int cgx_get_cgxcnt_max(void)
|
|||||||
|
|
||||||
return idmax + 1;
|
return idmax + 1;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(cgx_get_cgxcnt_max);
|
|
||||||
|
|
||||||
int cgx_get_lmac_cnt(void *cgxd)
|
int cgx_get_lmac_cnt(void *cgxd)
|
||||||
{
|
{
|
||||||
@ -124,7 +123,6 @@ int cgx_get_lmac_cnt(void *cgxd)
|
|||||||
|
|
||||||
return cgx->lmac_count;
|
return cgx->lmac_count;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(cgx_get_lmac_cnt);
|
|
||||||
|
|
||||||
void *cgx_get_pdata(int cgx_id)
|
void *cgx_get_pdata(int cgx_id)
|
||||||
{
|
{
|
||||||
@ -136,7 +134,6 @@ void *cgx_get_pdata(int cgx_id)
|
|||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(cgx_get_pdata);
|
|
||||||
|
|
||||||
int cgx_get_cgxid(void *cgxd)
|
int cgx_get_cgxid(void *cgxd)
|
||||||
{
|
{
|
||||||
@ -164,7 +161,6 @@ int cgx_get_link_info(void *cgxd, int lmac_id,
|
|||||||
*linfo = lmac->link_info;
|
*linfo = lmac->link_info;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(cgx_get_link_info);
|
|
||||||
|
|
||||||
static u64 mac2u64 (u8 *mac_addr)
|
static u64 mac2u64 (u8 *mac_addr)
|
||||||
{
|
{
|
||||||
@ -195,7 +191,6 @@ int cgx_lmac_addr_set(u8 cgx_id, u8 lmac_id, u8 *mac_addr)
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(cgx_lmac_addr_set);
|
|
||||||
|
|
||||||
u64 cgx_lmac_addr_get(u8 cgx_id, u8 lmac_id)
|
u64 cgx_lmac_addr_get(u8 cgx_id, u8 lmac_id)
|
||||||
{
|
{
|
||||||
@ -205,7 +200,6 @@ u64 cgx_lmac_addr_get(u8 cgx_id, u8 lmac_id)
|
|||||||
cfg = cgx_read(cgx_dev, 0, CGXX_CMRX_RX_DMAC_CAM0 + lmac_id * 0x8);
|
cfg = cgx_read(cgx_dev, 0, CGXX_CMRX_RX_DMAC_CAM0 + lmac_id * 0x8);
|
||||||
return cfg & CGX_RX_DMAC_ADR_MASK;
|
return cfg & CGX_RX_DMAC_ADR_MASK;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(cgx_lmac_addr_get);
|
|
||||||
|
|
||||||
int cgx_set_pkind(void *cgxd, u8 lmac_id, int pkind)
|
int cgx_set_pkind(void *cgxd, u8 lmac_id, int pkind)
|
||||||
{
|
{
|
||||||
@ -217,7 +211,6 @@ int cgx_set_pkind(void *cgxd, u8 lmac_id, int pkind)
|
|||||||
cgx_write(cgx, lmac_id, CGXX_CMRX_RX_ID_MAP, (pkind & 0x3F));
|
cgx_write(cgx, lmac_id, CGXX_CMRX_RX_ID_MAP, (pkind & 0x3F));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(cgx_set_pkind);
|
|
||||||
|
|
||||||
static inline u8 cgx_get_lmac_type(struct cgx *cgx, int lmac_id)
|
static inline u8 cgx_get_lmac_type(struct cgx *cgx, int lmac_id)
|
||||||
{
|
{
|
||||||
@ -255,7 +248,6 @@ int cgx_lmac_internal_loopback(void *cgxd, int lmac_id, bool enable)
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(cgx_lmac_internal_loopback);
|
|
||||||
|
|
||||||
void cgx_lmac_promisc_config(int cgx_id, int lmac_id, bool enable)
|
void cgx_lmac_promisc_config(int cgx_id, int lmac_id, bool enable)
|
||||||
{
|
{
|
||||||
@ -289,7 +281,6 @@ void cgx_lmac_promisc_config(int cgx_id, int lmac_id, bool enable)
|
|||||||
(CGXX_CMRX_RX_DMAC_CAM0 + lmac_id * 0x8), cfg);
|
(CGXX_CMRX_RX_DMAC_CAM0 + lmac_id * 0x8), cfg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(cgx_lmac_promisc_config);
|
|
||||||
|
|
||||||
/* Enable or disable forwarding received pause frames to Tx block */
|
/* Enable or disable forwarding received pause frames to Tx block */
|
||||||
void cgx_lmac_enadis_rx_pause_fwding(void *cgxd, int lmac_id, bool enable)
|
void cgx_lmac_enadis_rx_pause_fwding(void *cgxd, int lmac_id, bool enable)
|
||||||
@ -318,7 +309,6 @@ void cgx_lmac_enadis_rx_pause_fwding(void *cgxd, int lmac_id, bool enable)
|
|||||||
cgx_write(cgx, lmac_id, CGXX_SMUX_RX_FRM_CTL, cfg);
|
cgx_write(cgx, lmac_id, CGXX_SMUX_RX_FRM_CTL, cfg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(cgx_lmac_enadis_rx_pause_fwding);
|
|
||||||
|
|
||||||
int cgx_get_rx_stats(void *cgxd, int lmac_id, int idx, u64 *rx_stat)
|
int cgx_get_rx_stats(void *cgxd, int lmac_id, int idx, u64 *rx_stat)
|
||||||
{
|
{
|
||||||
@ -329,7 +319,6 @@ int cgx_get_rx_stats(void *cgxd, int lmac_id, int idx, u64 *rx_stat)
|
|||||||
*rx_stat = cgx_read(cgx, lmac_id, CGXX_CMRX_RX_STAT0 + (idx * 8));
|
*rx_stat = cgx_read(cgx, lmac_id, CGXX_CMRX_RX_STAT0 + (idx * 8));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(cgx_get_rx_stats);
|
|
||||||
|
|
||||||
int cgx_get_tx_stats(void *cgxd, int lmac_id, int idx, u64 *tx_stat)
|
int cgx_get_tx_stats(void *cgxd, int lmac_id, int idx, u64 *tx_stat)
|
||||||
{
|
{
|
||||||
@ -340,7 +329,6 @@ int cgx_get_tx_stats(void *cgxd, int lmac_id, int idx, u64 *tx_stat)
|
|||||||
*tx_stat = cgx_read(cgx, lmac_id, CGXX_CMRX_TX_STAT0 + (idx * 8));
|
*tx_stat = cgx_read(cgx, lmac_id, CGXX_CMRX_TX_STAT0 + (idx * 8));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(cgx_get_tx_stats);
|
|
||||||
|
|
||||||
int cgx_lmac_rx_tx_enable(void *cgxd, int lmac_id, bool enable)
|
int cgx_lmac_rx_tx_enable(void *cgxd, int lmac_id, bool enable)
|
||||||
{
|
{
|
||||||
@ -358,7 +346,6 @@ int cgx_lmac_rx_tx_enable(void *cgxd, int lmac_id, bool enable)
|
|||||||
cgx_write(cgx, lmac_id, CGXX_CMRX_CFG, cfg);
|
cgx_write(cgx, lmac_id, CGXX_CMRX_CFG, cfg);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(cgx_lmac_rx_tx_enable);
|
|
||||||
|
|
||||||
int cgx_lmac_tx_enable(void *cgxd, int lmac_id, bool enable)
|
int cgx_lmac_tx_enable(void *cgxd, int lmac_id, bool enable)
|
||||||
{
|
{
|
||||||
@ -379,7 +366,6 @@ int cgx_lmac_tx_enable(void *cgxd, int lmac_id, bool enable)
|
|||||||
cgx_write(cgx, lmac_id, CGXX_CMRX_CFG, cfg);
|
cgx_write(cgx, lmac_id, CGXX_CMRX_CFG, cfg);
|
||||||
return !!(last & DATA_PKT_TX_EN);
|
return !!(last & DATA_PKT_TX_EN);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(cgx_lmac_tx_enable);
|
|
||||||
|
|
||||||
/* CGX Firmware interface low level support */
|
/* CGX Firmware interface low level support */
|
||||||
static int cgx_fwi_cmd_send(u64 req, u64 *resp, struct lmac *lmac)
|
static int cgx_fwi_cmd_send(u64 req, u64 *resp, struct lmac *lmac)
|
||||||
@ -610,7 +596,6 @@ int cgx_get_mkex_prfl_info(u64 *addr, u64 *size)
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(cgx_get_mkex_prfl_info);
|
|
||||||
|
|
||||||
static irqreturn_t cgx_fwi_event_handler(int irq, void *data)
|
static irqreturn_t cgx_fwi_event_handler(int irq, void *data)
|
||||||
{
|
{
|
||||||
@ -676,7 +661,6 @@ int cgx_lmac_evh_register(struct cgx_event_cb *cb, void *cgxd, int lmac_id)
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(cgx_lmac_evh_register);
|
|
||||||
|
|
||||||
int cgx_lmac_evh_unregister(void *cgxd, int lmac_id)
|
int cgx_lmac_evh_unregister(void *cgxd, int lmac_id)
|
||||||
{
|
{
|
||||||
@ -695,7 +679,6 @@ int cgx_lmac_evh_unregister(void *cgxd, int lmac_id)
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(cgx_lmac_evh_unregister);
|
|
||||||
|
|
||||||
static int cgx_fwi_link_change(struct cgx *cgx, int lmac_id, bool enable)
|
static int cgx_fwi_link_change(struct cgx *cgx, int lmac_id, bool enable)
|
||||||
{
|
{
|
||||||
@ -769,7 +752,6 @@ int cgx_lmac_linkup_start(void *cgxd)
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(cgx_lmac_linkup_start);
|
|
||||||
|
|
||||||
static int cgx_lmac_init(struct cgx *cgx)
|
static int cgx_lmac_init(struct cgx *cgx)
|
||||||
{
|
{
|
||||||
|
@ -432,7 +432,7 @@ int rvu_nix_reserve_mark_format(struct rvu *rvu, struct nix_hw *nix_hw,
|
|||||||
void rvu_nix_freemem(struct rvu *rvu);
|
void rvu_nix_freemem(struct rvu *rvu);
|
||||||
int rvu_get_nixlf_count(struct rvu *rvu);
|
int rvu_get_nixlf_count(struct rvu *rvu);
|
||||||
void rvu_nix_lf_teardown(struct rvu *rvu, u16 pcifunc, int blkaddr, int npalf);
|
void rvu_nix_lf_teardown(struct rvu *rvu, u16 pcifunc, int blkaddr, int npalf);
|
||||||
int nix_get_nixlf(struct rvu *rvu, u16 pcifunc, int *nixlf);
|
int nix_get_nixlf(struct rvu *rvu, u16 pcifunc, int *nixlf, int *nix_blkaddr);
|
||||||
|
|
||||||
/* NPC APIs */
|
/* NPC APIs */
|
||||||
int rvu_npc_init(struct rvu *rvu);
|
int rvu_npc_init(struct rvu *rvu);
|
||||||
|
@ -350,6 +350,18 @@ int rvu_cgx_exit(struct rvu *rvu)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Most of the CGX configuration is restricted to the mapped PF only,
|
||||||
|
* VF's of mapped PF and other PFs are not allowed. This fn() checks
|
||||||
|
* whether a PFFUNC is permitted to do the config or not.
|
||||||
|
*/
|
||||||
|
static bool is_cgx_config_permitted(struct rvu *rvu, u16 pcifunc)
|
||||||
|
{
|
||||||
|
if ((pcifunc & RVU_PFVF_FUNC_MASK) ||
|
||||||
|
!is_pf_cgxmapped(rvu, rvu_get_pf(pcifunc)))
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void rvu_cgx_enadis_rx_bp(struct rvu *rvu, int pf, bool enable)
|
void rvu_cgx_enadis_rx_bp(struct rvu *rvu, int pf, bool enable)
|
||||||
{
|
{
|
||||||
u8 cgx_id, lmac_id;
|
u8 cgx_id, lmac_id;
|
||||||
@ -373,11 +385,8 @@ int rvu_cgx_config_rxtx(struct rvu *rvu, u16 pcifunc, bool start)
|
|||||||
int pf = rvu_get_pf(pcifunc);
|
int pf = rvu_get_pf(pcifunc);
|
||||||
u8 cgx_id, lmac_id;
|
u8 cgx_id, lmac_id;
|
||||||
|
|
||||||
/* This msg is expected only from PFs that are mapped to CGX LMACs,
|
if (!is_cgx_config_permitted(rvu, pcifunc))
|
||||||
* if received from other PF/VF simply ACK, nothing to do.
|
return -EPERM;
|
||||||
*/
|
|
||||||
if ((pcifunc & RVU_PFVF_FUNC_MASK) || !is_pf_cgxmapped(rvu, pf))
|
|
||||||
return -ENODEV;
|
|
||||||
|
|
||||||
rvu_get_cgx_lmac_id(rvu->pf2cgxlmac_map[pf], &cgx_id, &lmac_id);
|
rvu_get_cgx_lmac_id(rvu->pf2cgxlmac_map[pf], &cgx_id, &lmac_id);
|
||||||
|
|
||||||
@ -409,8 +418,7 @@ int rvu_mbox_handler_cgx_stats(struct rvu *rvu, struct msg_req *req,
|
|||||||
u8 cgx_idx, lmac;
|
u8 cgx_idx, lmac;
|
||||||
void *cgxd;
|
void *cgxd;
|
||||||
|
|
||||||
if ((req->hdr.pcifunc & RVU_PFVF_FUNC_MASK) ||
|
if (!is_cgx_config_permitted(rvu, req->hdr.pcifunc))
|
||||||
!is_pf_cgxmapped(rvu, pf))
|
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
||||||
rvu_get_cgx_lmac_id(rvu->pf2cgxlmac_map[pf], &cgx_idx, &lmac);
|
rvu_get_cgx_lmac_id(rvu->pf2cgxlmac_map[pf], &cgx_idx, &lmac);
|
||||||
@ -477,12 +485,8 @@ int rvu_mbox_handler_cgx_promisc_enable(struct rvu *rvu, struct msg_req *req,
|
|||||||
int pf = rvu_get_pf(pcifunc);
|
int pf = rvu_get_pf(pcifunc);
|
||||||
u8 cgx_id, lmac_id;
|
u8 cgx_id, lmac_id;
|
||||||
|
|
||||||
/* This msg is expected only from PFs that are mapped to CGX LMACs,
|
if (!is_cgx_config_permitted(rvu, req->hdr.pcifunc))
|
||||||
* if received from other PF/VF simply ACK, nothing to do.
|
return -EPERM;
|
||||||
*/
|
|
||||||
if ((req->hdr.pcifunc & RVU_PFVF_FUNC_MASK) ||
|
|
||||||
!is_pf_cgxmapped(rvu, pf))
|
|
||||||
return -ENODEV;
|
|
||||||
|
|
||||||
rvu_get_cgx_lmac_id(rvu->pf2cgxlmac_map[pf], &cgx_id, &lmac_id);
|
rvu_get_cgx_lmac_id(rvu->pf2cgxlmac_map[pf], &cgx_id, &lmac_id);
|
||||||
|
|
||||||
@ -493,16 +497,11 @@ int rvu_mbox_handler_cgx_promisc_enable(struct rvu *rvu, struct msg_req *req,
|
|||||||
int rvu_mbox_handler_cgx_promisc_disable(struct rvu *rvu, struct msg_req *req,
|
int rvu_mbox_handler_cgx_promisc_disable(struct rvu *rvu, struct msg_req *req,
|
||||||
struct msg_rsp *rsp)
|
struct msg_rsp *rsp)
|
||||||
{
|
{
|
||||||
u16 pcifunc = req->hdr.pcifunc;
|
int pf = rvu_get_pf(req->hdr.pcifunc);
|
||||||
int pf = rvu_get_pf(pcifunc);
|
|
||||||
u8 cgx_id, lmac_id;
|
u8 cgx_id, lmac_id;
|
||||||
|
|
||||||
/* This msg is expected only from PFs that are mapped to CGX LMACs,
|
if (!is_cgx_config_permitted(rvu, req->hdr.pcifunc))
|
||||||
* if received from other PF/VF simply ACK, nothing to do.
|
return -EPERM;
|
||||||
*/
|
|
||||||
if ((req->hdr.pcifunc & RVU_PFVF_FUNC_MASK) ||
|
|
||||||
!is_pf_cgxmapped(rvu, pf))
|
|
||||||
return -ENODEV;
|
|
||||||
|
|
||||||
rvu_get_cgx_lmac_id(rvu->pf2cgxlmac_map[pf], &cgx_id, &lmac_id);
|
rvu_get_cgx_lmac_id(rvu->pf2cgxlmac_map[pf], &cgx_id, &lmac_id);
|
||||||
|
|
||||||
@ -515,11 +514,8 @@ static int rvu_cgx_config_linkevents(struct rvu *rvu, u16 pcifunc, bool en)
|
|||||||
int pf = rvu_get_pf(pcifunc);
|
int pf = rvu_get_pf(pcifunc);
|
||||||
u8 cgx_id, lmac_id;
|
u8 cgx_id, lmac_id;
|
||||||
|
|
||||||
/* This msg is expected only from PFs that are mapped to CGX LMACs,
|
if (!is_cgx_config_permitted(rvu, pcifunc))
|
||||||
* if received from other PF/VF simply ACK, nothing to do.
|
return -EPERM;
|
||||||
*/
|
|
||||||
if ((pcifunc & RVU_PFVF_FUNC_MASK) || !is_pf_cgxmapped(rvu, pf))
|
|
||||||
return -ENODEV;
|
|
||||||
|
|
||||||
rvu_get_cgx_lmac_id(rvu->pf2cgxlmac_map[pf], &cgx_id, &lmac_id);
|
rvu_get_cgx_lmac_id(rvu->pf2cgxlmac_map[pf], &cgx_id, &lmac_id);
|
||||||
|
|
||||||
@ -571,11 +567,8 @@ static int rvu_cgx_config_intlbk(struct rvu *rvu, u16 pcifunc, bool en)
|
|||||||
int pf = rvu_get_pf(pcifunc);
|
int pf = rvu_get_pf(pcifunc);
|
||||||
u8 cgx_id, lmac_id;
|
u8 cgx_id, lmac_id;
|
||||||
|
|
||||||
/* This msg is expected only from PFs that are mapped to CGX LMACs,
|
if (!is_cgx_config_permitted(rvu, pcifunc))
|
||||||
* if received from other PF/VF simply ACK, nothing to do.
|
return -EPERM;
|
||||||
*/
|
|
||||||
if ((pcifunc & RVU_PFVF_FUNC_MASK) || !is_pf_cgxmapped(rvu, pf))
|
|
||||||
return -ENODEV;
|
|
||||||
|
|
||||||
rvu_get_cgx_lmac_id(rvu->pf2cgxlmac_map[pf], &cgx_id, &lmac_id);
|
rvu_get_cgx_lmac_id(rvu->pf2cgxlmac_map[pf], &cgx_id, &lmac_id);
|
||||||
|
|
||||||
|
@ -90,6 +90,26 @@ int rvu_get_nixlf_count(struct rvu *rvu)
|
|||||||
return block->lf.max;
|
return block->lf.max;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int nix_get_nixlf(struct rvu *rvu, u16 pcifunc, int *nixlf, int *nix_blkaddr)
|
||||||
|
{
|
||||||
|
struct rvu_pfvf *pfvf = rvu_get_pfvf(rvu, pcifunc);
|
||||||
|
struct rvu_hwinfo *hw = rvu->hw;
|
||||||
|
int blkaddr;
|
||||||
|
|
||||||
|
blkaddr = rvu_get_blkaddr(rvu, BLKTYPE_NIX, pcifunc);
|
||||||
|
if (!pfvf->nixlf || blkaddr < 0)
|
||||||
|
return NIX_AF_ERR_AF_LF_INVALID;
|
||||||
|
|
||||||
|
*nixlf = rvu_get_lf(rvu, &hw->block[blkaddr], pcifunc, 0);
|
||||||
|
if (*nixlf < 0)
|
||||||
|
return NIX_AF_ERR_AF_LF_INVALID;
|
||||||
|
|
||||||
|
if (nix_blkaddr)
|
||||||
|
*nix_blkaddr = blkaddr;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static void nix_mce_list_init(struct nix_mce_list *list, int max)
|
static void nix_mce_list_init(struct nix_mce_list *list, int max)
|
||||||
{
|
{
|
||||||
INIT_HLIST_HEAD(&list->head);
|
INIT_HLIST_HEAD(&list->head);
|
||||||
@ -1667,13 +1687,9 @@ int rvu_mbox_handler_nix_txschq_cfg(struct rvu *rvu,
|
|||||||
req->num_regs > MAX_REGS_PER_MBOX_MSG)
|
req->num_regs > MAX_REGS_PER_MBOX_MSG)
|
||||||
return NIX_AF_INVAL_TXSCHQ_CFG;
|
return NIX_AF_INVAL_TXSCHQ_CFG;
|
||||||
|
|
||||||
err = nix_get_nixlf(rvu, pcifunc, &nixlf);
|
err = nix_get_nixlf(rvu, pcifunc, &nixlf, &blkaddr);
|
||||||
if (err)
|
if (err)
|
||||||
return NIX_AF_ERR_AF_LF_INVALID;
|
return err;
|
||||||
|
|
||||||
blkaddr = rvu_get_blkaddr(rvu, BLKTYPE_NIX, pcifunc);
|
|
||||||
if (blkaddr < 0)
|
|
||||||
return NIX_AF_ERR_AF_LF_INVALID;
|
|
||||||
|
|
||||||
nix_hw = get_nix_hw(rvu->hw, blkaddr);
|
nix_hw = get_nix_hw(rvu->hw, blkaddr);
|
||||||
if (!nix_hw)
|
if (!nix_hw)
|
||||||
@ -1767,17 +1783,12 @@ int rvu_mbox_handler_nix_vtag_cfg(struct rvu *rvu,
|
|||||||
struct nix_vtag_config *req,
|
struct nix_vtag_config *req,
|
||||||
struct msg_rsp *rsp)
|
struct msg_rsp *rsp)
|
||||||
{
|
{
|
||||||
struct rvu_hwinfo *hw = rvu->hw;
|
|
||||||
u16 pcifunc = req->hdr.pcifunc;
|
u16 pcifunc = req->hdr.pcifunc;
|
||||||
int blkaddr, nixlf, err;
|
int blkaddr, nixlf, err;
|
||||||
|
|
||||||
blkaddr = rvu_get_blkaddr(rvu, BLKTYPE_NIX, pcifunc);
|
err = nix_get_nixlf(rvu, pcifunc, &nixlf, &blkaddr);
|
||||||
if (blkaddr < 0)
|
if (err)
|
||||||
return NIX_AF_ERR_AF_LF_INVALID;
|
return err;
|
||||||
|
|
||||||
nixlf = rvu_get_lf(rvu, &hw->block[blkaddr], pcifunc, 0);
|
|
||||||
if (nixlf < 0)
|
|
||||||
return NIX_AF_ERR_AF_LF_INVALID;
|
|
||||||
|
|
||||||
if (req->cfg_type) {
|
if (req->cfg_type) {
|
||||||
err = nix_rx_vtag_cfg(rvu, nixlf, blkaddr, req);
|
err = nix_rx_vtag_cfg(rvu, nixlf, blkaddr, req);
|
||||||
@ -2119,18 +2130,13 @@ static int nix_af_mark_format_setup(struct rvu *rvu, struct nix_hw *nix_hw,
|
|||||||
int rvu_mbox_handler_nix_stats_rst(struct rvu *rvu, struct msg_req *req,
|
int rvu_mbox_handler_nix_stats_rst(struct rvu *rvu, struct msg_req *req,
|
||||||
struct msg_rsp *rsp)
|
struct msg_rsp *rsp)
|
||||||
{
|
{
|
||||||
struct rvu_hwinfo *hw = rvu->hw;
|
|
||||||
u16 pcifunc = req->hdr.pcifunc;
|
u16 pcifunc = req->hdr.pcifunc;
|
||||||
int i, nixlf, blkaddr;
|
int i, nixlf, blkaddr, err;
|
||||||
u64 stats;
|
u64 stats;
|
||||||
|
|
||||||
blkaddr = rvu_get_blkaddr(rvu, BLKTYPE_NIX, pcifunc);
|
err = nix_get_nixlf(rvu, pcifunc, &nixlf, &blkaddr);
|
||||||
if (blkaddr < 0)
|
if (err)
|
||||||
return NIX_AF_ERR_AF_LF_INVALID;
|
return err;
|
||||||
|
|
||||||
nixlf = rvu_get_lf(rvu, &hw->block[blkaddr], pcifunc, 0);
|
|
||||||
if (nixlf < 0)
|
|
||||||
return NIX_AF_ERR_AF_LF_INVALID;
|
|
||||||
|
|
||||||
/* Get stats count supported by HW */
|
/* Get stats count supported by HW */
|
||||||
stats = rvu_read64(rvu, blkaddr, NIX_AF_CONST1);
|
stats = rvu_read64(rvu, blkaddr, NIX_AF_CONST1);
|
||||||
@ -2418,18 +2424,14 @@ int rvu_mbox_handler_nix_rss_flowkey_cfg(struct rvu *rvu,
|
|||||||
struct nix_rss_flowkey_cfg *req,
|
struct nix_rss_flowkey_cfg *req,
|
||||||
struct nix_rss_flowkey_cfg_rsp *rsp)
|
struct nix_rss_flowkey_cfg_rsp *rsp)
|
||||||
{
|
{
|
||||||
struct rvu_hwinfo *hw = rvu->hw;
|
|
||||||
u16 pcifunc = req->hdr.pcifunc;
|
u16 pcifunc = req->hdr.pcifunc;
|
||||||
int alg_idx, nixlf, blkaddr;
|
int alg_idx, nixlf, blkaddr;
|
||||||
struct nix_hw *nix_hw;
|
struct nix_hw *nix_hw;
|
||||||
|
int err;
|
||||||
|
|
||||||
blkaddr = rvu_get_blkaddr(rvu, BLKTYPE_NIX, pcifunc);
|
err = nix_get_nixlf(rvu, pcifunc, &nixlf, &blkaddr);
|
||||||
if (blkaddr < 0)
|
if (err)
|
||||||
return NIX_AF_ERR_AF_LF_INVALID;
|
return err;
|
||||||
|
|
||||||
nixlf = rvu_get_lf(rvu, &hw->block[blkaddr], pcifunc, 0);
|
|
||||||
if (nixlf < 0)
|
|
||||||
return NIX_AF_ERR_AF_LF_INVALID;
|
|
||||||
|
|
||||||
nix_hw = get_nix_hw(rvu->hw, blkaddr);
|
nix_hw = get_nix_hw(rvu->hw, blkaddr);
|
||||||
if (!nix_hw)
|
if (!nix_hw)
|
||||||
@ -2522,19 +2524,15 @@ int rvu_mbox_handler_nix_set_mac_addr(struct rvu *rvu,
|
|||||||
struct nix_set_mac_addr *req,
|
struct nix_set_mac_addr *req,
|
||||||
struct msg_rsp *rsp)
|
struct msg_rsp *rsp)
|
||||||
{
|
{
|
||||||
struct rvu_hwinfo *hw = rvu->hw;
|
|
||||||
u16 pcifunc = req->hdr.pcifunc;
|
u16 pcifunc = req->hdr.pcifunc;
|
||||||
|
int blkaddr, nixlf, err;
|
||||||
struct rvu_pfvf *pfvf;
|
struct rvu_pfvf *pfvf;
|
||||||
int blkaddr, nixlf;
|
|
||||||
|
err = nix_get_nixlf(rvu, pcifunc, &nixlf, &blkaddr);
|
||||||
|
if (err)
|
||||||
|
return err;
|
||||||
|
|
||||||
pfvf = rvu_get_pfvf(rvu, pcifunc);
|
pfvf = rvu_get_pfvf(rvu, pcifunc);
|
||||||
blkaddr = rvu_get_blkaddr(rvu, BLKTYPE_NIX, pcifunc);
|
|
||||||
if (!pfvf->nixlf || blkaddr < 0)
|
|
||||||
return NIX_AF_ERR_AF_LF_INVALID;
|
|
||||||
|
|
||||||
nixlf = rvu_get_lf(rvu, &hw->block[blkaddr], pcifunc, 0);
|
|
||||||
if (nixlf < 0)
|
|
||||||
return NIX_AF_ERR_AF_LF_INVALID;
|
|
||||||
|
|
||||||
ether_addr_copy(pfvf->mac_addr, req->mac_addr);
|
ether_addr_copy(pfvf->mac_addr, req->mac_addr);
|
||||||
|
|
||||||
@ -2567,19 +2565,15 @@ int rvu_mbox_handler_nix_set_rx_mode(struct rvu *rvu, struct nix_rx_mode *req,
|
|||||||
struct msg_rsp *rsp)
|
struct msg_rsp *rsp)
|
||||||
{
|
{
|
||||||
bool allmulti = false, disable_promisc = false;
|
bool allmulti = false, disable_promisc = false;
|
||||||
struct rvu_hwinfo *hw = rvu->hw;
|
|
||||||
u16 pcifunc = req->hdr.pcifunc;
|
u16 pcifunc = req->hdr.pcifunc;
|
||||||
|
int blkaddr, nixlf, err;
|
||||||
struct rvu_pfvf *pfvf;
|
struct rvu_pfvf *pfvf;
|
||||||
int blkaddr, nixlf;
|
|
||||||
|
err = nix_get_nixlf(rvu, pcifunc, &nixlf, &blkaddr);
|
||||||
|
if (err)
|
||||||
|
return err;
|
||||||
|
|
||||||
pfvf = rvu_get_pfvf(rvu, pcifunc);
|
pfvf = rvu_get_pfvf(rvu, pcifunc);
|
||||||
blkaddr = rvu_get_blkaddr(rvu, BLKTYPE_NIX, pcifunc);
|
|
||||||
if (!pfvf->nixlf || blkaddr < 0)
|
|
||||||
return NIX_AF_ERR_AF_LF_INVALID;
|
|
||||||
|
|
||||||
nixlf = rvu_get_lf(rvu, &hw->block[blkaddr], pcifunc, 0);
|
|
||||||
if (nixlf < 0)
|
|
||||||
return NIX_AF_ERR_AF_LF_INVALID;
|
|
||||||
|
|
||||||
if (req->mode & NIX_RX_MODE_PROMISC)
|
if (req->mode & NIX_RX_MODE_PROMISC)
|
||||||
allmulti = false;
|
allmulti = false;
|
||||||
@ -2794,22 +2788,12 @@ int rvu_mbox_handler_nix_rxvlan_alloc(struct rvu *rvu, struct msg_req *req,
|
|||||||
int rvu_mbox_handler_nix_set_rx_cfg(struct rvu *rvu, struct nix_rx_cfg *req,
|
int rvu_mbox_handler_nix_set_rx_cfg(struct rvu *rvu, struct nix_rx_cfg *req,
|
||||||
struct msg_rsp *rsp)
|
struct msg_rsp *rsp)
|
||||||
{
|
{
|
||||||
struct rvu_hwinfo *hw = rvu->hw;
|
int nixlf, blkaddr, err;
|
||||||
u16 pcifunc = req->hdr.pcifunc;
|
|
||||||
struct rvu_block *block;
|
|
||||||
struct rvu_pfvf *pfvf;
|
|
||||||
int nixlf, blkaddr;
|
|
||||||
u64 cfg;
|
u64 cfg;
|
||||||
|
|
||||||
pfvf = rvu_get_pfvf(rvu, pcifunc);
|
err = nix_get_nixlf(rvu, req->hdr.pcifunc, &nixlf, &blkaddr);
|
||||||
blkaddr = rvu_get_blkaddr(rvu, BLKTYPE_NIX, pcifunc);
|
if (err)
|
||||||
if (!pfvf->nixlf || blkaddr < 0)
|
return err;
|
||||||
return NIX_AF_ERR_AF_LF_INVALID;
|
|
||||||
|
|
||||||
block = &hw->block[blkaddr];
|
|
||||||
nixlf = rvu_get_lf(rvu, block, pcifunc, 0);
|
|
||||||
if (nixlf < 0)
|
|
||||||
return NIX_AF_ERR_AF_LF_INVALID;
|
|
||||||
|
|
||||||
cfg = rvu_read64(rvu, blkaddr, NIX_AF_LFX_RX_CFG(nixlf));
|
cfg = rvu_read64(rvu, blkaddr, NIX_AF_LFX_RX_CFG(nixlf));
|
||||||
/* Set the interface configuration */
|
/* Set the interface configuration */
|
||||||
@ -3114,30 +3098,13 @@ void rvu_nix_freemem(struct rvu *rvu)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int nix_get_nixlf(struct rvu *rvu, u16 pcifunc, int *nixlf)
|
|
||||||
{
|
|
||||||
struct rvu_pfvf *pfvf = rvu_get_pfvf(rvu, pcifunc);
|
|
||||||
struct rvu_hwinfo *hw = rvu->hw;
|
|
||||||
int blkaddr;
|
|
||||||
|
|
||||||
blkaddr = rvu_get_blkaddr(rvu, BLKTYPE_NIX, pcifunc);
|
|
||||||
if (!pfvf->nixlf || blkaddr < 0)
|
|
||||||
return NIX_AF_ERR_AF_LF_INVALID;
|
|
||||||
|
|
||||||
*nixlf = rvu_get_lf(rvu, &hw->block[blkaddr], pcifunc, 0);
|
|
||||||
if (*nixlf < 0)
|
|
||||||
return NIX_AF_ERR_AF_LF_INVALID;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int rvu_mbox_handler_nix_lf_start_rx(struct rvu *rvu, struct msg_req *req,
|
int rvu_mbox_handler_nix_lf_start_rx(struct rvu *rvu, struct msg_req *req,
|
||||||
struct msg_rsp *rsp)
|
struct msg_rsp *rsp)
|
||||||
{
|
{
|
||||||
u16 pcifunc = req->hdr.pcifunc;
|
u16 pcifunc = req->hdr.pcifunc;
|
||||||
int nixlf, err;
|
int nixlf, err;
|
||||||
|
|
||||||
err = nix_get_nixlf(rvu, pcifunc, &nixlf);
|
err = nix_get_nixlf(rvu, pcifunc, &nixlf, NULL);
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
@ -3152,7 +3119,7 @@ int rvu_mbox_handler_nix_lf_stop_rx(struct rvu *rvu, struct msg_req *req,
|
|||||||
u16 pcifunc = req->hdr.pcifunc;
|
u16 pcifunc = req->hdr.pcifunc;
|
||||||
int nixlf, err;
|
int nixlf, err;
|
||||||
|
|
||||||
err = nix_get_nixlf(rvu, pcifunc, &nixlf);
|
err = nix_get_nixlf(rvu, pcifunc, &nixlf, NULL);
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user