openbcm

Git mirror of https://github.com/Broadcom-Network-Switching-Software/OpenBCM
git clone git://git.finwo.net/mirror/broadcom/openbcm
Log | Files | Refs | README

commit 36957cf95df4f72dc2ca27371f2fb71973946766
parent 2192e3662fe64adfd12ac3a4d6f7050cfc7c571d
Author: Broadcom SDK Release <sdk.releases@broadcom.com>
Date:   Tue, 18 Jun 2019 10:53:40 -0700

SDK-182462: Check for green discard drops should be done before accessing any...

Devices: 56980_A0,56980_B0
Module: cosq

Symptom:
_bcm_th3_cosq_mmu_port_queue_wred_color_drop_set() checks for an invalid
input of bcmCosqStatGreenDiscardDroppedPackets but only after it has
incorrectly modified the value of bcmCosqStatRedDiscardDroppedPackets

Check for green discard drops should be done before accessing any
hardware

Diffstat:
Msdk-6.5.16/src/bcm/esw/tomahawk3/cosq_stat.c | 10+++++-----
1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/sdk-6.5.16/src/bcm/esw/tomahawk3/cosq_stat.c b/sdk-6.5.16/src/bcm/esw/tomahawk3/cosq_stat.c @@ -742,6 +742,11 @@ _bcm_th3_cosq_mmu_port_queue_wred_color_drop_set(int unit, bcm_gport_t port, if (cosq != BCM_COS_INVALID) { return BCM_E_UNAVAIL; } + if (stat == bcmCosqStatGreenDiscardDroppedPackets) { + /* Green Discard drop is combination of complete drops and red/yellow + * discard. All the elements can be set using other stat Enums */ + return BCM_E_UNAVAIL; + } if (stat == bcmCosqStatYellowDiscardDroppedPackets) { ctr_reg = SOC_COUNTER_NON_DMA_PORT_WRED_PKT_YELLOW; } else { /*(stat == bcmCosqStatRedDiscardDroppedPackets) */ @@ -756,11 +761,6 @@ _bcm_th3_cosq_mmu_port_queue_wred_color_drop_set(int unit, bcm_gport_t port, (soc_counter_generic_set(unit, ctr_reg, ctrl_info, 0, startq, value)); - if (stat == bcmCosqStatGreenDiscardDroppedPackets) { - /* Green Discard drop is combination of complete drops and red/yellow - * discard. All the elements can be set using other stat Enums */ - return BCM_E_UNAVAIL; - } return BCM_E_NONE; }