@@ -64,6 +64,7 @@ void DHCPMgr::handle_swss_notification() {
6464 config_db_dhcp_server_ipv4_ptr = std::make_shared<swss::SubscriberStateTable>(config_db_ptr.get (), " DHCP_SERVER_IPV4" );
6565 state_db_dhcp_server_ipv4_ip_ptr = std::make_shared<swss::SubscriberStateTable>(state_db_ptr.get (), " DHCP_SERVER_IPV4_SERVER_IP" );
6666 swss::SubscriberStateTable config_db_port_table (config_db_ptr.get (), " PORT" );
67+ swss::SubscriberStateTable config_db_dpu_table (config_db_ptr.get (), " DPUS" );
6768 swss::SubscriberStateTable state_db_interface_table (state_db_ptr.get (), " INTERFACE_TABLE" );
6869
6970 std::deque<swss::KeyOpFieldsValuesTuple> entries;
@@ -79,6 +80,7 @@ void DHCPMgr::handle_swss_notification() {
7980 swss_select.addSelectable (config_db_dhcp_server_ipv4_ptr.get ());
8081 swss_select.addSelectable (state_db_dhcp_server_ipv4_ip_ptr.get ());
8182 swss_select.addSelectable (&config_db_port_table);
83+ swss_select.addSelectable (&config_db_dpu_table);
8284 swss_select.addSelectable (&state_db_interface_table);
8385
8486 while (!stop_thread) {
@@ -137,6 +139,9 @@ void DHCPMgr::handle_swss_notification() {
137139 } else if (selectable == static_cast <swss::Selectable *>(&config_db_port_table)) {
138140 config_db_port_table.pops (entries);
139141 process_port_notification (entries);
142+ } else if (selectable == static_cast <swss::Selectable *>(&config_db_dpu_table)) {
143+ config_db_dpu_table.pops (entries);
144+ process_port_notification (entries);
140145 }
141146 }
142147}
@@ -157,6 +162,8 @@ void DHCPMgr::process_device_metadata_notification(std::deque<swss::KeyOpFieldsV
157162 std::string key = kfvKey (entry);
158163 std::vector<swss::FieldValueTuple> field_values = kfvFieldsValues (entry);
159164 std::string operation = kfvOp (entry);
165+ std::shared_ptr<swss::DBConnector> config_db = std::make_shared<swss::DBConnector>(" CONFIG_DB" , 0 );
166+ swss::Table midplane_tbl (config_db.get (), " MID_PLANE_BRIDGE" );
160167
161168 if (key != " localhost" ) {
162169 continue ;
@@ -191,6 +198,20 @@ void DHCPMgr::process_device_metadata_notification(std::deque<swss::KeyOpFieldsV
191198 send_dualTor_event = true ;
192199 }
193200
201+ // Handle is_SmartSwitch logic
202+ if (subtype_found && subtype_value == " SmartSwitch" ) {
203+ m_config.is_SmartSwitch = true ;
204+ std::string bridge_name;
205+ bool ok = midplane_tbl.hget (" GLOBAL" , " bridge" , bridge_name);
206+ if (ok) {
207+ m_config.midplane_bridge = bridge_name;
208+ } else {
209+ syslog (LOG_ERR, " Failed to read midplane bridge name\n " );
210+ }
211+ } else if (m_config.is_SmartSwitch ) {
212+ m_config.is_SmartSwitch = false ;
213+ }
214+
194215 if (send_dualTor_event) {
195216 relay_config *relay_msg = nullptr ;
196217 try {
@@ -724,8 +745,10 @@ void DHCPMgr::process_dhcp_server_ipv4_notification(std::deque<swss::KeyOpFields
724745 }
725746
726747 /* Validation to check vlan is present in VLAN table or not */
748+ /* If its a smartswitch, we are checking midplane_bridge details */
727749 std::string value;
728- if (!vlan_tbl.hget (vlan, " vlanid" , value)) {
750+ if ((!vlan_tbl.hget (vlan, " vlanid" , value))
751+ && (!m_config.is_SmartSwitch || (!m_config.midplane_bridge .empty () && m_config.midplane_bridge != vlan))) {
729752 delete relay_msg;
730753 continue ;
731754 }
@@ -812,6 +835,9 @@ void DHCPMgr::process_port_notification(std::deque<swss::KeyOpFieldsValuesTuple>
812835 if (fvField (fv) == " alias" ) {
813836 port_msg->alias = fvValue (fv);
814837 break ;
838+ } else if (fvField (fv) == " midplane_interface" ) {
839+ port_msg->alias = fvValue (fv);
840+ break ;
815841 }
816842 }
817843 } else {
0 commit comments