Skip to content

Commit c661473

Browse files
Subbaraya Sundeepdavem330
authored andcommitted
octeontx2-af: Add macro to generate mbox handlers declarations
For every mailbox handler added to rvu, we are adding a function declaration in rvu header file. Cleaned this up by adding a macro to generate these declarations automatically. Signed-off-by: Subbaraya Sundeep <[email protected]> Signed-off-by: Sunil Goutham <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent fdb9029 commit c661473

File tree

2 files changed

+17
-134
lines changed
  • drivers/net/ethernet/marvell/octeontx2/af

2 files changed

+17
-134
lines changed

drivers/net/ethernet/marvell/octeontx2/af/rvu.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -877,8 +877,8 @@ int rvu_aq_alloc(struct rvu *rvu, struct admin_queue **ad_queue,
877877
return 0;
878878
}
879879

880-
static int rvu_mbox_handler_ready(struct rvu *rvu, struct msg_req *req,
881-
struct ready_msg_rsp *rsp)
880+
int rvu_mbox_handler_ready(struct rvu *rvu, struct msg_req *req,
881+
struct ready_msg_rsp *rsp)
882882
{
883883
return 0;
884884
}
@@ -1023,9 +1023,9 @@ static int rvu_detach_rsrcs(struct rvu *rvu, struct rsrc_detach *detach,
10231023
return 0;
10241024
}
10251025

1026-
static int rvu_mbox_handler_detach_resources(struct rvu *rvu,
1027-
struct rsrc_detach *detach,
1028-
struct msg_rsp *rsp)
1026+
int rvu_mbox_handler_detach_resources(struct rvu *rvu,
1027+
struct rsrc_detach *detach,
1028+
struct msg_rsp *rsp)
10291029
{
10301030
return rvu_detach_rsrcs(rvu, detach, detach->hdr.pcifunc);
10311031
}
@@ -1171,9 +1171,9 @@ static int rvu_check_rsrc_availability(struct rvu *rvu,
11711171
return -ENOSPC;
11721172
}
11731173

1174-
static int rvu_mbox_handler_attach_resources(struct rvu *rvu,
1175-
struct rsrc_attach *attach,
1176-
struct msg_rsp *rsp)
1174+
int rvu_mbox_handler_attach_resources(struct rvu *rvu,
1175+
struct rsrc_attach *attach,
1176+
struct msg_rsp *rsp)
11771177
{
11781178
u16 pcifunc = attach->hdr.pcifunc;
11791179
int err;
@@ -1294,8 +1294,8 @@ static void rvu_clear_msix_offset(struct rvu *rvu, struct rvu_pfvf *pfvf,
12941294
rvu_free_rsrc_contig(&pfvf->msix, nvecs, offset);
12951295
}
12961296

1297-
static int rvu_mbox_handler_msix_offset(struct rvu *rvu, struct msg_req *req,
1298-
struct msix_offset_rsp *rsp)
1297+
int rvu_mbox_handler_msix_offset(struct rvu *rvu, struct msg_req *req,
1298+
struct msix_offset_rsp *rsp)
12991299
{
13001300
struct rvu_hwinfo *hw = rvu->hw;
13011301
u16 pcifunc = req->hdr.pcifunc;
@@ -1343,8 +1343,8 @@ static int rvu_mbox_handler_msix_offset(struct rvu *rvu, struct msg_req *req,
13431343
return 0;
13441344
}
13451345

1346-
static int rvu_mbox_handler_vf_flr(struct rvu *rvu, struct msg_req *req,
1347-
struct msg_rsp *rsp)
1346+
int rvu_mbox_handler_vf_flr(struct rvu *rvu, struct msg_req *req,
1347+
struct msg_rsp *rsp)
13481348
{
13491349
u16 pcifunc = req->hdr.pcifunc;
13501350
u16 vf, numvfs;

drivers/net/ethernet/marvell/octeontx2/af/rvu.h

Lines changed: 5 additions & 122 deletions
Original file line numberDiff line numberDiff line change
@@ -374,56 +374,23 @@ static inline void rvu_get_cgx_lmac_id(u8 map, u8 *cgx_id, u8 *lmac_id)
374374
*lmac_id = (map & 0xF);
375375
}
376376

377+
#define M(_name, _id, fn_name, req, rsp) \
378+
int rvu_mbox_handler_ ## fn_name(struct rvu *, struct req *, struct rsp *);
379+
MBOX_MESSAGES
380+
#undef M
381+
377382
int rvu_cgx_init(struct rvu *rvu);
378383
int rvu_cgx_exit(struct rvu *rvu);
379384
void *rvu_cgx_pdata(u8 cgx_id, struct rvu *rvu);
380385
int rvu_cgx_config_rxtx(struct rvu *rvu, u16 pcifunc, bool start);
381386
int rvu_cgx_nix_cuml_stats(struct rvu *rvu, void *cgxd, int lmac_id, int index,
382387
int rxtxflag, u64 *stat);
383-
int rvu_mbox_handler_cgx_start_rxtx(struct rvu *rvu, struct msg_req *req,
384-
struct msg_rsp *rsp);
385-
int rvu_mbox_handler_cgx_stop_rxtx(struct rvu *rvu, struct msg_req *req,
386-
struct msg_rsp *rsp);
387-
int rvu_mbox_handler_cgx_stats(struct rvu *rvu, struct msg_req *req,
388-
struct cgx_stats_rsp *rsp);
389-
int rvu_mbox_handler_cgx_mac_addr_set(struct rvu *rvu,
390-
struct cgx_mac_addr_set_or_get *req,
391-
struct cgx_mac_addr_set_or_get *rsp);
392-
int rvu_mbox_handler_cgx_mac_addr_get(struct rvu *rvu,
393-
struct cgx_mac_addr_set_or_get *req,
394-
struct cgx_mac_addr_set_or_get *rsp);
395-
int rvu_mbox_handler_cgx_promisc_enable(struct rvu *rvu, struct msg_req *req,
396-
struct msg_rsp *rsp);
397-
int rvu_mbox_handler_cgx_promisc_disable(struct rvu *rvu, struct msg_req *req,
398-
struct msg_rsp *rsp);
399-
int rvu_mbox_handler_cgx_start_linkevents(struct rvu *rvu, struct msg_req *req,
400-
struct msg_rsp *rsp);
401-
int rvu_mbox_handler_cgx_stop_linkevents(struct rvu *rvu, struct msg_req *req,
402-
struct msg_rsp *rsp);
403-
int rvu_mbox_handler_cgx_get_linkinfo(struct rvu *rvu, struct msg_req *req,
404-
struct cgx_link_info_msg *rsp);
405-
int rvu_mbox_handler_cgx_intlbk_enable(struct rvu *rvu, struct msg_req *req,
406-
struct msg_rsp *rsp);
407-
int rvu_mbox_handler_cgx_intlbk_disable(struct rvu *rvu, struct msg_req *req,
408-
struct msg_rsp *rsp);
409-
410388
/* NPA APIs */
411389
int rvu_npa_init(struct rvu *rvu);
412390
void rvu_npa_freemem(struct rvu *rvu);
413391
void rvu_npa_lf_teardown(struct rvu *rvu, u16 pcifunc, int npalf);
414392
int rvu_npa_aq_enq_inst(struct rvu *rvu, struct npa_aq_enq_req *req,
415393
struct npa_aq_enq_rsp *rsp);
416-
int rvu_mbox_handler_npa_aq_enq(struct rvu *rvu,
417-
struct npa_aq_enq_req *req,
418-
struct npa_aq_enq_rsp *rsp);
419-
int rvu_mbox_handler_npa_hwctx_disable(struct rvu *rvu,
420-
struct hwctx_disable_req *req,
421-
struct msg_rsp *rsp);
422-
int rvu_mbox_handler_npa_lf_alloc(struct rvu *rvu,
423-
struct npa_lf_alloc_req *req,
424-
struct npa_lf_alloc_rsp *rsp);
425-
int rvu_mbox_handler_npa_lf_free(struct rvu *rvu, struct msg_req *req,
426-
struct msg_rsp *rsp);
427394

428395
/* NIX APIs */
429396
bool is_nixlf_attached(struct rvu *rvu, u16 pcifunc);
@@ -433,55 +400,6 @@ int rvu_nix_reserve_mark_format(struct rvu *rvu, struct nix_hw *nix_hw,
433400
void rvu_nix_freemem(struct rvu *rvu);
434401
int rvu_get_nixlf_count(struct rvu *rvu);
435402
void rvu_nix_lf_teardown(struct rvu *rvu, u16 pcifunc, int blkaddr, int npalf);
436-
int rvu_mbox_handler_nix_lf_alloc(struct rvu *rvu,
437-
struct nix_lf_alloc_req *req,
438-
struct nix_lf_alloc_rsp *rsp);
439-
int rvu_mbox_handler_nix_lf_free(struct rvu *rvu, struct msg_req *req,
440-
struct msg_rsp *rsp);
441-
int rvu_mbox_handler_nix_aq_enq(struct rvu *rvu,
442-
struct nix_aq_enq_req *req,
443-
struct nix_aq_enq_rsp *rsp);
444-
int rvu_mbox_handler_nix_hwctx_disable(struct rvu *rvu,
445-
struct hwctx_disable_req *req,
446-
struct msg_rsp *rsp);
447-
int rvu_mbox_handler_nix_txsch_alloc(struct rvu *rvu,
448-
struct nix_txsch_alloc_req *req,
449-
struct nix_txsch_alloc_rsp *rsp);
450-
int rvu_mbox_handler_nix_txsch_free(struct rvu *rvu,
451-
struct nix_txsch_free_req *req,
452-
struct msg_rsp *rsp);
453-
int rvu_mbox_handler_nix_txschq_cfg(struct rvu *rvu,
454-
struct nix_txschq_config *req,
455-
struct msg_rsp *rsp);
456-
int rvu_mbox_handler_nix_stats_rst(struct rvu *rvu, struct msg_req *req,
457-
struct msg_rsp *rsp);
458-
int rvu_mbox_handler_nix_vtag_cfg(struct rvu *rvu,
459-
struct nix_vtag_config *req,
460-
struct msg_rsp *rsp);
461-
int rvu_mbox_handler_nix_rxvlan_alloc(struct rvu *rvu, struct msg_req *req,
462-
struct msg_rsp *rsp);
463-
int rvu_mbox_handler_nix_rss_flowkey_cfg(struct rvu *rvu,
464-
struct nix_rss_flowkey_cfg *req,
465-
struct nix_rss_flowkey_cfg_rsp *rsp);
466-
int rvu_mbox_handler_nix_set_mac_addr(struct rvu *rvu,
467-
struct nix_set_mac_addr *req,
468-
struct msg_rsp *rsp);
469-
int rvu_mbox_handler_nix_set_rx_mode(struct rvu *rvu, struct nix_rx_mode *req,
470-
struct msg_rsp *rsp);
471-
int rvu_mbox_handler_nix_set_hw_frs(struct rvu *rvu, struct nix_frs_cfg *req,
472-
struct msg_rsp *rsp);
473-
int rvu_mbox_handler_nix_lf_start_rx(struct rvu *rvu, struct msg_req *req,
474-
struct msg_rsp *rsp);
475-
int rvu_mbox_handler_nix_lf_stop_rx(struct rvu *rvu, struct msg_req *req,
476-
struct msg_rsp *rsp);
477-
int rvu_mbox_handler_nix_mark_format_cfg(struct rvu *rvu,
478-
struct nix_mark_format_cfg *req,
479-
struct nix_mark_format_cfg_rsp *rsp);
480-
int rvu_mbox_handler_nix_set_rx_cfg(struct rvu *rvu, struct nix_rx_cfg *req,
481-
struct msg_rsp *rsp);
482-
int rvu_mbox_handler_nix_lso_format_cfg(struct rvu *rvu,
483-
struct nix_lso_format_cfg *req,
484-
struct nix_lso_format_cfg_rsp *rsp);
485403

486404
/* NPC APIs */
487405
int rvu_npc_init(struct rvu *rvu);
@@ -508,41 +426,6 @@ void rvu_npc_get_mcam_entry_alloc_info(struct rvu *rvu, u16 pcifunc,
508426
void rvu_npc_get_mcam_counter_alloc_info(struct rvu *rvu, u16 pcifunc,
509427
int blkaddr, int *alloc_cnt,
510428
int *enable_cnt);
511-
int rvu_mbox_handler_npc_mcam_alloc_entry(struct rvu *rvu,
512-
struct npc_mcam_alloc_entry_req *req,
513-
struct npc_mcam_alloc_entry_rsp *rsp);
514-
int rvu_mbox_handler_npc_mcam_free_entry(struct rvu *rvu,
515-
struct npc_mcam_free_entry_req *req,
516-
struct msg_rsp *rsp);
517-
int rvu_mbox_handler_npc_mcam_write_entry(struct rvu *rvu,
518-
struct npc_mcam_write_entry_req *req,
519-
struct msg_rsp *rsp);
520-
int rvu_mbox_handler_npc_mcam_ena_entry(struct rvu *rvu,
521-
struct npc_mcam_ena_dis_entry_req *req,
522-
struct msg_rsp *rsp);
523-
int rvu_mbox_handler_npc_mcam_dis_entry(struct rvu *rvu,
524-
struct npc_mcam_ena_dis_entry_req *req,
525-
struct msg_rsp *rsp);
526-
int rvu_mbox_handler_npc_mcam_shift_entry(struct rvu *rvu,
527-
struct npc_mcam_shift_entry_req *req,
528-
struct npc_mcam_shift_entry_rsp *rsp);
529-
int rvu_mbox_handler_npc_mcam_alloc_counter(struct rvu *rvu,
530-
struct npc_mcam_alloc_counter_req *req,
531-
struct npc_mcam_alloc_counter_rsp *rsp);
532-
int rvu_mbox_handler_npc_mcam_free_counter(struct rvu *rvu,
533-
struct npc_mcam_oper_counter_req *req, struct msg_rsp *rsp);
534-
int rvu_mbox_handler_npc_mcam_clear_counter(struct rvu *rvu,
535-
struct npc_mcam_oper_counter_req *req, struct msg_rsp *rsp);
536-
int rvu_mbox_handler_npc_mcam_unmap_counter(struct rvu *rvu,
537-
struct npc_mcam_unmap_counter_req *req, struct msg_rsp *rsp);
538-
int rvu_mbox_handler_npc_mcam_counter_stats(struct rvu *rvu,
539-
struct npc_mcam_oper_counter_req *req,
540-
struct npc_mcam_oper_counter_rsp *rsp);
541-
int rvu_mbox_handler_npc_mcam_alloc_and_write_entry(struct rvu *rvu,
542-
struct npc_mcam_alloc_and_write_entry_req *req,
543-
struct npc_mcam_alloc_and_write_entry_rsp *rsp);
544-
int rvu_mbox_handler_npc_get_kex_cfg(struct rvu *rvu, struct msg_req *req,
545-
struct npc_get_kex_cfg_rsp *rsp);
546429

547430
#ifdef CONFIG_DEBUG_FS
548431
void rvu_dbg_init(struct rvu *rvu);

0 commit comments

Comments
 (0)