@@ -48,11 +48,7 @@ BufferOrch::BufferOrch(DBConnector *applDb, DBConnector *confDb, DBConnector *st
48
48
m_flexCounterTable(new ProducerTable(m_flexCounterDb.get(), FLEX_COUNTER_TABLE)),
49
49
m_flexCounterGroupTable(new ProducerTable(m_flexCounterDb.get(), FLEX_COUNTER_GROUP_TABLE)),
50
50
m_countersDb(new DBConnector(" COUNTERS_DB" , 0 )),
51
- m_stateBufferMaximumValueTable(stateDb, STATE_BUFFER_MAXIMUM_VALUE_TABLE),
52
- m_ingressZeroBufferPool(SAI_NULL_OBJECT_ID),
53
- m_egressZeroBufferPool(SAI_NULL_OBJECT_ID),
54
- m_ingressZeroPoolRefCount(0 ),
55
- m_egressZeroPoolRefCount(0 )
51
+ m_stateBufferMaximumValueTable(stateDb, STATE_BUFFER_MAXIMUM_VALUE_TABLE)
56
52
{
57
53
SWSS_LOG_ENTER ();
58
54
initTableHandlers ();
@@ -314,65 +310,6 @@ const object_reference_map &BufferOrch::getBufferPoolNameOidMap(void)
314
310
return *m_buffer_type_maps[APP_BUFFER_POOL_TABLE_NAME];
315
311
}
316
312
317
- void BufferOrch::lockZeroBufferPool (bool ingress)
318
- {
319
- if (ingress)
320
- m_ingressZeroPoolRefCount++;
321
- else
322
- m_egressZeroPoolRefCount++;
323
- }
324
-
325
- void BufferOrch::unlockZeroBufferPool (bool ingress)
326
- {
327
- sai_object_id_t pool = SAI_NULL_OBJECT_ID;
328
- if (ingress)
329
- {
330
- if (--m_ingressZeroPoolRefCount <= 0 )
331
- {
332
- pool = m_ingressZeroBufferPool;
333
- m_ingressZeroBufferPool = SAI_NULL_OBJECT_ID;
334
- }
335
- }
336
- else
337
- {
338
- if (--m_egressZeroPoolRefCount <= 0 )
339
- {
340
- pool = m_egressZeroBufferPool;
341
- m_egressZeroBufferPool = SAI_NULL_OBJECT_ID;
342
- }
343
- }
344
-
345
- if (pool != SAI_NULL_OBJECT_ID)
346
- {
347
- auto sai_status = sai_buffer_api->remove_buffer_pool (pool);
348
- if (SAI_STATUS_SUCCESS != sai_status)
349
- {
350
- SWSS_LOG_ERROR (" Failed to remove buffer pool, rv:%d" , sai_status);
351
- task_process_status handle_status = handleSaiRemoveStatus (SAI_API_BUFFER, sai_status);
352
- if (handle_status != task_process_status::task_success)
353
- {
354
- return ;
355
- }
356
- }
357
- else
358
- {
359
- SWSS_LOG_NOTICE (" Zero buffer pool has been successfully removed" );
360
- }
361
- }
362
- }
363
-
364
- void BufferOrch::setZeroBufferPool (bool ingress, sai_object_id_t pool)
365
- {
366
- if (ingress)
367
- {
368
- m_ingressZeroBufferPool = pool;
369
- }
370
- else
371
- {
372
- m_egressZeroBufferPool = pool;
373
- }
374
- }
375
-
376
313
task_process_status BufferOrch::processBufferPool (KeyOpFieldsValuesTuple &tuple)
377
314
{
378
315
SWSS_LOG_ENTER ();
@@ -381,8 +318,6 @@ task_process_status BufferOrch::processBufferPool(KeyOpFieldsValuesTuple &tuple)
381
318
string map_type_name = APP_BUFFER_POOL_TABLE_NAME;
382
319
string object_name = kfvKey (tuple);
383
320
string op = kfvOp (tuple);
384
- sai_buffer_pool_type_t pool_direction = SAI_BUFFER_POOL_TYPE_INGRESS;
385
- bool creating_zero_pool = false ;
386
321
387
322
SWSS_LOG_DEBUG (" object name:%s" , object_name.c_str ());
388
323
if (m_buffer_type_maps[map_type_name]->find (object_name) != m_buffer_type_maps[map_type_name]->end ())
@@ -396,16 +331,6 @@ task_process_status BufferOrch::processBufferPool(KeyOpFieldsValuesTuple &tuple)
396
331
}
397
332
}
398
333
SWSS_LOG_DEBUG (" processing command:%s" , op.c_str ());
399
- if (object_name == " ingress_zero_pool" )
400
- {
401
- creating_zero_pool = true ;
402
- pool_direction = SAI_BUFFER_POOL_TYPE_INGRESS;
403
- }
404
- else if (object_name == " egress_zero_pool" )
405
- {
406
- creating_zero_pool = true ;
407
- pool_direction = SAI_BUFFER_POOL_TYPE_EGRESS;
408
- }
409
334
410
335
if (op == SET_COMMAND)
411
336
{
@@ -453,11 +378,6 @@ task_process_status BufferOrch::processBufferPool(KeyOpFieldsValuesTuple &tuple)
453
378
return task_process_status::task_invalid_entry;
454
379
}
455
380
attr.id = SAI_BUFFER_POOL_ATTR_TYPE;
456
- if (creating_zero_pool && pool_direction != static_cast <sai_buffer_pool_type_t >(attr.value .u32 ))
457
- {
458
- SWSS_LOG_ERROR (" Wrong pool direction for pool %s" , object_name.c_str ());
459
- return task_process_status::task_invalid_entry;
460
- }
461
381
attribs.push_back (attr);
462
382
}
463
383
else if (field == buffer_pool_mode_field_name)
@@ -523,54 +443,20 @@ task_process_status BufferOrch::processBufferPool(KeyOpFieldsValuesTuple &tuple)
523
443
}
524
444
else
525
445
{
526
- if (creating_zero_pool)
527
- {
528
- if (pool_direction == SAI_BUFFER_POOL_TYPE_INGRESS)
529
- {
530
- sai_object = m_ingressZeroBufferPool;
531
- }
532
- else if (pool_direction == SAI_BUFFER_POOL_TYPE_EGRESS)
533
- {
534
- sai_object = m_egressZeroBufferPool;
535
- }
536
- }
537
-
538
- if (SAI_NULL_OBJECT_ID == sai_object)
539
- {
540
- sai_status = sai_buffer_api->create_buffer_pool (&sai_object, gSwitchId , (uint32_t )attribs.size (), attribs.data ());
541
- if (SAI_STATUS_SUCCESS != sai_status)
542
- {
543
- SWSS_LOG_ERROR (" Failed to create buffer pool %s with type %s, rv:%d" , object_name.c_str (), map_type_name.c_str (), sai_status);
544
- task_process_status handle_status = handleSaiCreateStatus (SAI_API_BUFFER, sai_status);
545
- if (handle_status != task_process_status::task_success)
546
- {
547
- return handle_status;
548
- }
549
- }
550
-
551
- SWSS_LOG_NOTICE (" Created buffer pool %s with type %s" , object_name.c_str (), map_type_name.c_str ());
552
- }
553
- else
554
- {
555
- SWSS_LOG_NOTICE (" No need to create buffer pool %s since it has been created" , object_name.c_str ());
556
- }
557
-
558
- if (creating_zero_pool)
446
+ sai_status = sai_buffer_api->create_buffer_pool (&sai_object, gSwitchId , (uint32_t )attribs.size (), attribs.data ());
447
+ if (SAI_STATUS_SUCCESS != sai_status)
559
448
{
560
- if (pool_direction == SAI_BUFFER_POOL_TYPE_INGRESS)
561
- {
562
- m_ingressZeroPoolRefCount++;
563
- m_ingressZeroBufferPool = sai_object;
564
- }
565
- else if (pool_direction == SAI_BUFFER_POOL_TYPE_EGRESS)
449
+ SWSS_LOG_ERROR (" Failed to create buffer pool %s with type %s, rv:%d" , object_name.c_str (), map_type_name.c_str (), sai_status);
450
+ task_process_status handle_status = handleSaiCreateStatus (SAI_API_BUFFER, sai_status);
451
+ if (handle_status != task_process_status::task_success)
566
452
{
567
- m_egressZeroPoolRefCount++;
568
- m_egressZeroBufferPool = sai_object;
453
+ return handle_status;
569
454
}
570
455
}
571
456
572
457
(*(m_buffer_type_maps[map_type_name]))[object_name].m_saiObjectId = sai_object;
573
458
(*(m_buffer_type_maps[map_type_name]))[object_name].m_pendingRemove = false ;
459
+ SWSS_LOG_NOTICE (" Created buffer pool %s with type %s" , object_name.c_str (), map_type_name.c_str ());
574
460
// Here we take the PFC watchdog approach to update the COUNTERS_DB metadata (e.g., PFC_WD_DETECTION_TIME per queue)
575
461
// at initialization (creation and registration phase)
576
462
// Specifically, we push the buffer pool name to oid mapping upon the creation of the oid
@@ -593,39 +479,17 @@ task_process_status BufferOrch::processBufferPool(KeyOpFieldsValuesTuple &tuple)
593
479
if (SAI_NULL_OBJECT_ID != sai_object)
594
480
{
595
481
clearBufferPoolWatermarkCounterIdList (sai_object);
596
- bool remove = true ;
597
- if (sai_object == m_ingressZeroBufferPool)
598
- {
599
- if (--m_ingressZeroPoolRefCount > 0 )
600
- remove = false ;
601
- else
602
- m_ingressZeroBufferPool = SAI_NULL_OBJECT_ID;
603
- }
604
- else if (sai_object == m_egressZeroBufferPool)
605
- {
606
- if (--m_egressZeroPoolRefCount > 0 )
607
- remove = false ;
608
- else
609
- m_egressZeroBufferPool = SAI_NULL_OBJECT_ID;
610
- }
611
- if (remove )
482
+ sai_status = sai_buffer_api->remove_buffer_pool (sai_object);
483
+ if (SAI_STATUS_SUCCESS != sai_status)
612
484
{
613
- sai_status = sai_buffer_api->remove_buffer_pool (sai_object);
614
- if (SAI_STATUS_SUCCESS != sai_status)
485
+ SWSS_LOG_ERROR (" Failed to remove buffer pool %s with type %s, rv:%d" , object_name.c_str (), map_type_name.c_str (), sai_status);
486
+ task_process_status handle_status = handleSaiRemoveStatus (SAI_API_BUFFER, sai_status);
487
+ if (handle_status != task_process_status::task_success)
615
488
{
616
- SWSS_LOG_ERROR (" Failed to remove buffer pool %s with type %s, rv:%d" , object_name.c_str (), map_type_name.c_str (), sai_status);
617
- task_process_status handle_status = handleSaiRemoveStatus (SAI_API_BUFFER, sai_status);
618
- if (handle_status != task_process_status::task_success)
619
- {
620
- return handle_status;
621
- }
489
+ return handle_status;
622
490
}
623
- SWSS_LOG_NOTICE (" Removed buffer pool %s with type %s" , object_name.c_str (), map_type_name.c_str ());
624
- }
625
- else
626
- {
627
- SWSS_LOG_NOTICE (" Will not remove buffer pool %s since it is still referenced" , object_name.c_str ());
628
491
}
492
+ SWSS_LOG_NOTICE (" Removed buffer pool %s with type %s" , object_name.c_str (), map_type_name.c_str ());
629
493
}
630
494
auto it_to_delete = (m_buffer_type_maps[map_type_name])->find (object_name);
631
495
(m_buffer_type_maps[map_type_name])->erase (it_to_delete);
@@ -1049,7 +913,6 @@ task_process_status BufferOrch::processPriorityGroup(KeyOpFieldsValuesTuple &tup
1049
913
for (string port_name : port_names)
1050
914
{
1051
915
Port port;
1052
- bool portUpdated = false ;
1053
916
SWSS_LOG_DEBUG (" processing port:%s" , port_name.c_str ());
1054
917
if (!gPortsOrch ->getPort (port_name, port))
1055
918
{
@@ -1064,12 +927,6 @@ task_process_status BufferOrch::processPriorityGroup(KeyOpFieldsValuesTuple &tup
1064
927
SWSS_LOG_ERROR (" Invalid pg index specified:%zd" , ind);
1065
928
return task_process_status::task_invalid_entry;
1066
929
}
1067
- if (port.m_priority_group_lock [ind])
1068
- {
1069
- SWSS_LOG_WARN (" Priority group %zd on port %s is locked, pending profile 0x%" PRIx64 " until unlocked" , ind, port_name.c_str (), sai_buffer_profile);
1070
- portUpdated = true ;
1071
- port.m_priority_group_pending_profile [ind] = sai_buffer_profile;
1072
- }
1073
930
else
1074
931
{
1075
932
if (need_update_sai)
@@ -1090,10 +947,6 @@ task_process_status BufferOrch::processPriorityGroup(KeyOpFieldsValuesTuple &tup
1090
947
}
1091
948
}
1092
949
}
1093
- if (portUpdated)
1094
- {
1095
- gPortsOrch ->setPort (port_name, port);
1096
- }
1097
950
}
1098
951
1099
952
if (m_ready_list.find (key) != m_ready_list.end ())
0 commit comments