@@ -569,16 +569,25 @@ void rvu_nix_flr_free_bpids(struct rvu *rvu, u16 pcifunc)
569569 mutex_unlock (& rvu -> rsrc_lock );
570570}
571571
572- int rvu_mbox_handler_nix_bp_disable (struct rvu * rvu ,
573- struct nix_bp_cfg_req * req ,
574- struct msg_rsp * rsp )
572+ static u16 nix_get_channel (u16 chan , bool cpt_link )
573+ {
574+ /* CPT channel for a given link channel is always
575+ * assumed to be BIT(11) set in link channel.
576+ */
577+ return cpt_link ? chan | BIT (11 ) : chan ;
578+ }
579+
580+ static int nix_bp_disable (struct rvu * rvu ,
581+ struct nix_bp_cfg_req * req ,
582+ struct msg_rsp * rsp , bool cpt_link )
575583{
576584 u16 pcifunc = req -> hdr .pcifunc ;
577585 int blkaddr , pf , type , err ;
578586 u16 chan_base , chan , bpid ;
579587 struct rvu_pfvf * pfvf ;
580588 struct nix_hw * nix_hw ;
581589 struct nix_bp * bp ;
590+ u16 chan_v ;
582591 u64 cfg ;
583592
584593 pf = rvu_get_pf (pcifunc );
@@ -589,6 +598,9 @@ int rvu_mbox_handler_nix_bp_disable(struct rvu *rvu,
589598 if (is_sdp_pfvf (pcifunc ))
590599 type = NIX_INTF_TYPE_SDP ;
591600
601+ if (cpt_link && !rvu -> hw -> cpt_links )
602+ return 0 ;
603+
592604 pfvf = rvu_get_pfvf (rvu , pcifunc );
593605 err = nix_get_struct_ptrs (rvu , pcifunc , & nix_hw , & blkaddr );
594606 if (err )
@@ -597,8 +609,9 @@ int rvu_mbox_handler_nix_bp_disable(struct rvu *rvu,
597609 bp = & nix_hw -> bp ;
598610 chan_base = pfvf -> rx_chan_base + req -> chan_base ;
599611 for (chan = chan_base ; chan < (chan_base + req -> chan_cnt ); chan ++ ) {
600- cfg = rvu_read64 (rvu , blkaddr , NIX_AF_RX_CHANX_CFG (chan ));
601- rvu_write64 (rvu , blkaddr , NIX_AF_RX_CHANX_CFG (chan ),
612+ chan_v = nix_get_channel (chan , cpt_link );
613+ cfg = rvu_read64 (rvu , blkaddr , NIX_AF_RX_CHANX_CFG (chan_v ));
614+ rvu_write64 (rvu , blkaddr , NIX_AF_RX_CHANX_CFG (chan_v ),
602615 cfg & ~BIT_ULL (16 ));
603616
604617 if (type == NIX_INTF_TYPE_LBK ) {
@@ -617,6 +630,20 @@ int rvu_mbox_handler_nix_bp_disable(struct rvu *rvu,
617630 return 0 ;
618631}
619632
633+ int rvu_mbox_handler_nix_bp_disable (struct rvu * rvu ,
634+ struct nix_bp_cfg_req * req ,
635+ struct msg_rsp * rsp )
636+ {
637+ return nix_bp_disable (rvu , req , rsp , false);
638+ }
639+
640+ int rvu_mbox_handler_nix_cpt_bp_disable (struct rvu * rvu ,
641+ struct nix_bp_cfg_req * req ,
642+ struct msg_rsp * rsp )
643+ {
644+ return nix_bp_disable (rvu , req , rsp , true);
645+ }
646+
620647static int rvu_nix_get_bpid (struct rvu * rvu , struct nix_bp_cfg_req * req ,
621648 int type , int chan_id )
622649{
@@ -696,15 +723,17 @@ static int rvu_nix_get_bpid(struct rvu *rvu, struct nix_bp_cfg_req *req,
696723 return bpid ;
697724}
698725
699- int rvu_mbox_handler_nix_bp_enable (struct rvu * rvu ,
700- struct nix_bp_cfg_req * req ,
701- struct nix_bp_cfg_rsp * rsp )
726+ static int nix_bp_enable (struct rvu * rvu ,
727+ struct nix_bp_cfg_req * req ,
728+ struct nix_bp_cfg_rsp * rsp ,
729+ bool cpt_link )
702730{
703731 int blkaddr , pf , type , chan_id = 0 ;
704732 u16 pcifunc = req -> hdr .pcifunc ;
705733 struct rvu_pfvf * pfvf ;
706734 u16 chan_base , chan ;
707735 s16 bpid , bpid_base ;
736+ u16 chan_v ;
708737 u64 cfg ;
709738
710739 pf = rvu_get_pf (pcifunc );
@@ -717,6 +746,9 @@ int rvu_mbox_handler_nix_bp_enable(struct rvu *rvu,
717746 type != NIX_INTF_TYPE_SDP )
718747 return 0 ;
719748
749+ if (cpt_link && !rvu -> hw -> cpt_links )
750+ return 0 ;
751+
720752 pfvf = rvu_get_pfvf (rvu , pcifunc );
721753 blkaddr = rvu_get_blkaddr (rvu , BLKTYPE_NIX , pcifunc );
722754
@@ -730,9 +762,11 @@ int rvu_mbox_handler_nix_bp_enable(struct rvu *rvu,
730762 return - EINVAL ;
731763 }
732764
733- cfg = rvu_read64 (rvu , blkaddr , NIX_AF_RX_CHANX_CFG (chan ));
765+ chan_v = nix_get_channel (chan , cpt_link );
766+
767+ cfg = rvu_read64 (rvu , blkaddr , NIX_AF_RX_CHANX_CFG (chan_v ));
734768 cfg &= ~GENMASK_ULL (8 , 0 );
735- rvu_write64 (rvu , blkaddr , NIX_AF_RX_CHANX_CFG (chan ),
769+ rvu_write64 (rvu , blkaddr , NIX_AF_RX_CHANX_CFG (chan_v ),
736770 cfg | (bpid & GENMASK_ULL (8 , 0 )) | BIT_ULL (16 ));
737771 chan_id ++ ;
738772 bpid = rvu_nix_get_bpid (rvu , req , type , chan_id );
@@ -750,6 +784,20 @@ int rvu_mbox_handler_nix_bp_enable(struct rvu *rvu,
750784 return 0 ;
751785}
752786
787+ int rvu_mbox_handler_nix_bp_enable (struct rvu * rvu ,
788+ struct nix_bp_cfg_req * req ,
789+ struct nix_bp_cfg_rsp * rsp )
790+ {
791+ return nix_bp_enable (rvu , req , rsp , false);
792+ }
793+
794+ int rvu_mbox_handler_nix_cpt_bp_enable (struct rvu * rvu ,
795+ struct nix_bp_cfg_req * req ,
796+ struct nix_bp_cfg_rsp * rsp )
797+ {
798+ return nix_bp_enable (rvu , req , rsp , true);
799+ }
800+
753801static void nix_setup_lso_tso_l3 (struct rvu * rvu , int blkaddr ,
754802 u64 format , bool v4 , u64 * fidx )
755803{
0 commit comments