@@ -441,7 +441,7 @@ PfcWdZeroBufferHandler::PfcWdZeroBufferHandler(sai_object_id_t port,
441
441
return ;
442
442
}
443
443
444
- setPriorityGroupAndQueueLockFlag (portInstance, true );
444
+ setQueueLockFlag (portInstance, true );
445
445
446
446
sai_attribute_t attr;
447
447
attr.id = SAI_QUEUE_ATTR_BUFFER_PROFILE_ID;
@@ -457,7 +457,7 @@ PfcWdZeroBufferHandler::PfcWdZeroBufferHandler(sai_object_id_t port,
457
457
sai_object_id_t oldQueueProfileId = attr.value .oid ;
458
458
459
459
attr.id = SAI_QUEUE_ATTR_BUFFER_PROFILE_ID;
460
- attr.value .oid = ZeroBufferProfile::getZeroBufferProfile (false );
460
+ attr.value .oid = ZeroBufferProfile::getZeroBufferProfile ();
461
461
462
462
// Set our zero buffer profile
463
463
status = sai_queue_api->set_queue_attribute (queue, &attr);
@@ -469,35 +469,6 @@ PfcWdZeroBufferHandler::PfcWdZeroBufferHandler(sai_object_id_t port,
469
469
470
470
// Save original buffer profile
471
471
m_originalQueueBufferProfile = oldQueueProfileId;
472
-
473
- // Get PG
474
- sai_object_id_t pg = portInstance.m_priority_group_ids [static_cast <size_t > (queueId)];
475
-
476
- attr.id = SAI_INGRESS_PRIORITY_GROUP_ATTR_BUFFER_PROFILE;
477
-
478
- // Get PG's buffer profile
479
- status = sai_buffer_api->get_ingress_priority_group_attribute (pg, 1 , &attr);
480
- if (status != SAI_STATUS_SUCCESS)
481
- {
482
- SWSS_LOG_ERROR (" Failed to get buffer profile ID on PG 0x%" PRIx64 " : %d" , pg, status);
483
- return ;
484
- }
485
-
486
- // Set zero profile to PG
487
- sai_object_id_t oldPgProfileId = attr.value .oid ;
488
-
489
- attr.id = SAI_INGRESS_PRIORITY_GROUP_ATTR_BUFFER_PROFILE;
490
- attr.value .oid = ZeroBufferProfile::getZeroBufferProfile (true );
491
-
492
- status = sai_buffer_api->set_ingress_priority_group_attribute (pg, &attr);
493
- if (status != SAI_STATUS_SUCCESS)
494
- {
495
- SWSS_LOG_ERROR (" Failed to set buffer profile ID on pg 0x%" PRIx64 " : %d" , pg, status);
496
- return ;
497
- }
498
-
499
- // Save original buffer profile
500
- m_originalPgBufferProfile = oldPgProfileId;
501
472
}
502
473
503
474
PfcWdZeroBufferHandler::~PfcWdZeroBufferHandler (void )
@@ -523,26 +494,12 @@ PfcWdZeroBufferHandler::~PfcWdZeroBufferHandler(void)
523
494
return ;
524
495
}
525
496
526
- sai_object_id_t pg = portInstance.m_priority_group_ids [size_t (getQueueId ())];
527
-
528
- attr.id = SAI_INGRESS_PRIORITY_GROUP_ATTR_BUFFER_PROFILE;
529
- attr.value .oid = m_originalPgBufferProfile;
530
-
531
- // Set our zero buffer profile
532
- status = sai_buffer_api->set_ingress_priority_group_attribute (pg, &attr);
533
- if (status != SAI_STATUS_SUCCESS)
534
- {
535
- SWSS_LOG_ERROR (" Failed to set buffer profile ID on queue 0x%" PRIx64 " : %d" , getQueue (), status);
536
- return ;
537
- }
538
-
539
- setPriorityGroupAndQueueLockFlag (portInstance, false );
497
+ setQueueLockFlag (portInstance, false );
540
498
}
541
499
542
- void PfcWdZeroBufferHandler::setPriorityGroupAndQueueLockFlag (Port& port, bool isLocked) const
500
+ void PfcWdZeroBufferHandler::setQueueLockFlag (Port& port, bool isLocked) const
543
501
{
544
- // set lock bits on PG and queue
545
- port.m_priority_group_lock [static_cast <size_t >(getQueueId ())] = isLocked;
502
+ // set lock bits on queue
546
503
for (size_t i = 0 ; i < port.m_queue_ids .size (); ++i)
547
504
{
548
505
if (port.m_queue_ids [i] == getQueue ())
@@ -562,9 +519,8 @@ PfcWdZeroBufferHandler::ZeroBufferProfile::~ZeroBufferProfile(void)
562
519
{
563
520
SWSS_LOG_ENTER ();
564
521
565
- // Destory ingress and egress prifiles and pools
566
- destroyZeroBufferProfile (true );
567
- destroyZeroBufferProfile (false );
522
+ // Destory egress profiles and pools
523
+ destroyZeroBufferProfile ();
568
524
}
569
525
570
526
PfcWdZeroBufferHandler::ZeroBufferProfile &PfcWdZeroBufferHandler::ZeroBufferProfile::getInstance (void )
@@ -576,19 +532,19 @@ PfcWdZeroBufferHandler::ZeroBufferProfile &PfcWdZeroBufferHandler::ZeroBufferPro
576
532
return instance;
577
533
}
578
534
579
- sai_object_id_t PfcWdZeroBufferHandler::ZeroBufferProfile::getZeroBufferProfile (bool ingress )
535
+ sai_object_id_t PfcWdZeroBufferHandler::ZeroBufferProfile::getZeroBufferProfile (void )
580
536
{
581
537
SWSS_LOG_ENTER ();
582
538
583
- if (getInstance ().getProfile (ingress ) == SAI_NULL_OBJECT_ID)
539
+ if (getInstance ().getProfile () == SAI_NULL_OBJECT_ID)
584
540
{
585
- getInstance ().createZeroBufferProfile (ingress );
541
+ getInstance ().createZeroBufferProfile ();
586
542
}
587
543
588
- return getInstance ().getProfile (ingress );
544
+ return getInstance ().getProfile ();
589
545
}
590
546
591
- void PfcWdZeroBufferHandler::ZeroBufferProfile::createZeroBufferProfile (bool ingress )
547
+ void PfcWdZeroBufferHandler::ZeroBufferProfile::createZeroBufferProfile (void )
592
548
{
593
549
SWSS_LOG_ENTER ();
594
550
@@ -601,15 +557,15 @@ void PfcWdZeroBufferHandler::ZeroBufferProfile::createZeroBufferProfile(bool ing
601
557
attribs.push_back (attr);
602
558
603
559
attr.id = SAI_BUFFER_POOL_ATTR_TYPE;
604
- attr.value .u32 = ingress ? SAI_BUFFER_POOL_TYPE_INGRESS : SAI_BUFFER_POOL_TYPE_EGRESS;
560
+ attr.value .u32 = SAI_BUFFER_POOL_TYPE_EGRESS;
605
561
attribs.push_back (attr);
606
562
607
563
attr.id = SAI_BUFFER_POOL_ATTR_THRESHOLD_MODE;
608
564
attr.value .u32 = SAI_BUFFER_POOL_THRESHOLD_MODE_DYNAMIC;
609
565
attribs.push_back (attr);
610
566
611
567
sai_status_t status = sai_buffer_api->create_buffer_pool (
612
- &getPool (ingress ),
568
+ &getPool (),
613
569
gSwitchId ,
614
570
static_cast <uint32_t >(attribs.size ()),
615
571
attribs.data ());
@@ -623,7 +579,7 @@ void PfcWdZeroBufferHandler::ZeroBufferProfile::createZeroBufferProfile(bool ing
623
579
attribs.clear ();
624
580
625
581
attr.id = SAI_BUFFER_PROFILE_ATTR_POOL_ID;
626
- attr.value .oid = getPool (ingress );
582
+ attr.value .oid = getPool ();
627
583
attribs.push_back (attr);
628
584
629
585
attr.id = SAI_BUFFER_PROFILE_ATTR_THRESHOLD_MODE;
@@ -639,7 +595,7 @@ void PfcWdZeroBufferHandler::ZeroBufferProfile::createZeroBufferProfile(bool ing
639
595
attribs.push_back (attr);
640
596
641
597
status = sai_buffer_api->create_buffer_profile (
642
- &getProfile (ingress ),
598
+ &getProfile (),
643
599
gSwitchId ,
644
600
static_cast <uint32_t >(attribs.size ()),
645
601
attribs.data ());
@@ -650,18 +606,18 @@ void PfcWdZeroBufferHandler::ZeroBufferProfile::createZeroBufferProfile(bool ing
650
606
}
651
607
}
652
608
653
- void PfcWdZeroBufferHandler::ZeroBufferProfile::destroyZeroBufferProfile (bool ingress )
609
+ void PfcWdZeroBufferHandler::ZeroBufferProfile::destroyZeroBufferProfile (void )
654
610
{
655
611
SWSS_LOG_ENTER ();
656
612
657
- sai_status_t status = sai_buffer_api->remove_buffer_profile (getProfile (ingress ));
613
+ sai_status_t status = sai_buffer_api->remove_buffer_profile (getProfile ());
658
614
if (status != SAI_STATUS_SUCCESS)
659
615
{
660
616
SWSS_LOG_ERROR (" Failed to remove static zero buffer profile for PFC WD: %d" , status);
661
617
return ;
662
618
}
663
619
664
- status = sai_buffer_api->remove_buffer_pool (getPool (ingress ));
620
+ status = sai_buffer_api->remove_buffer_pool (getPool ());
665
621
if (status != SAI_STATUS_SUCCESS)
666
622
{
667
623
SWSS_LOG_ERROR (" Failed to remove static zero buffer pool for PFC WD: %d" , status);
0 commit comments