From 038ca267c8c930176213945300bdd3ff812633c8 Mon Sep 17 00:00:00 2001
From: prabhataravind <108555774+prabhataravind@users.noreply.github.com>
Date: Tue, 2 Jan 2024 21:29:34 -0800
Subject: [PATCH] [image_config]: Update DHCP rate-limit for mgmt TOR devices
 (#17630)

* [image_config]: Update DHCP rate-limit for mgmt TOR devices

    Change DHCP rate limit(queue4,group3) in SONiC copp configuration to 300 PPS
    for mgmt TORs while keeping the rate limit at 100 PPS for other topologies.

    Why I did it:
    Some mgmt TORs based on Marvell ASIC do not support 100 PPS CIR, so that led
    to these devices silently dropping DHCP packets.

    Microsoft ADO: **25820076**

    How to verify it:
    Send DHCP broadcast packets to an M0 DUT and verify that they are trapped to
    CPU at 300 PPS. On non-mgmt devices, the packets should be trapped at CIR of
    100 PPS. Also ran sonic-mgmt dhcp_relay test and confirmed that it passes.

Signed-off-by: Prabhat Aravind <paravind@microsoft.com>
---
 files/image_config/copp/copp_cfg.j2 | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/files/image_config/copp/copp_cfg.j2 b/files/image_config/copp/copp_cfg.j2
index f3550677d760..dcae06fc0bbc 100755
--- a/files/image_config/copp/copp_cfg.j2
+++ b/files/image_config/copp/copp_cfg.j2
@@ -34,8 +34,13 @@
 		    "queue": "4",
 		    "meter_type":"packets",
 		    "mode":"sr_tcm",
+{% if DEVICE_METADATA is defined and DEVICE_METADATA['localhost'] is defined and DEVICE_METADATA['localhost']['type'] is defined and 'Mgmt' in DEVICE_METADATA['localhost']['type'] %}
+		    "cir":"300",
+		    "cbs":"300",
+{% else %}
 		    "cir":"100",
 		    "cbs":"100",
+{% endif %}
 		    "red_action":"drop"
 	    },
 	    "queue1_group1": {