Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion orchagent/fdborch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ void FdbOrch::doTask(Consumer& consumer)

FdbEntry entry;
entry.mac = MacAddress(keys[1]);
entry.vlan = vlan.m_vlan_id;
entry.vlan = vlan.m_vlan_info.vlan_id;

if (op == SET_COMMAND)
{
Expand Down
5 changes: 3 additions & 2 deletions orchagent/intfsorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ bool IntfsOrch::addRouterIntfs(Port &port)
break;
case Port::VLAN:
attr.id = SAI_ROUTER_INTERFACE_ATTR_VLAN_ID;
attr.value.oid = port.m_vlan_oid;
attr.value.oid = port.m_vlan_info.vlan_oid;
break;
default:
SWSS_LOG_ERROR("Unsupported port type: %d", port.m_type);
Expand Down Expand Up @@ -287,7 +287,8 @@ bool IntfsOrch::removeRouterIntfs(Port &port)

port.m_rif_id = 0;
gPortsOrch->setPort(port.m_alias, port);

/* Clean this port from default VLAN */
gPortsOrch->removeDefaultVlanMembers();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do you need to call this function here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After removeRouterIntfs(), the port goes back to default VLAN. Since there is no vlan member id available, this is the only way to get the port out of default VLAN.

Not very clear about the expected behavior at sai level. If port is not supposed to be put back to default VLAN, then it could be libsai implementation issue. This line may be removed.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the port is not supposed to be put back to default VLAN according to the SAI spec. you could remove this line.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the port is not supposed to be put back to default VLAN according to the SAI spec. you could remove this line.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, will remove the line of code. Libsai from ASIC vendor should not automatically move the port to default VLAN.

SWSS_LOG_NOTICE("Remove router interface for port %s", port.m_alias.c_str());

return true;
Expand Down
2 changes: 1 addition & 1 deletion orchagent/mirrororch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ bool MirrorOrch::getNeighborInfo(const string& name, MirrorEntry& session, const

if (session.neighborInfo.port.m_type == Port::VLAN)
{
session.neighborInfo.vlanId = session.neighborInfo.port.m_vlan_id;
session.neighborInfo.vlanId = session.neighborInfo.port.m_vlan_info.vlan_id;

Port member;
if (!m_fdbOrch->getPort(session.neighborInfo.mac, session.neighborInfo.vlanId, member))
Expand Down
22 changes: 19 additions & 3 deletions orchagent/port.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,27 @@ extern "C" {
#include <set>
#include <string>
#include <vector>
#include <map>

#define DEFAULT_PORT_VLAN_ID 1

namespace swss {

struct VlanMemberEntry
{
sai_object_id_t vlan_member_id;
sai_vlan_tagging_mode_t vlan_mode;
};

typedef std::map<sai_vlan_id_t, VlanMemberEntry> port_vlan_members_t;

struct VlanInfo
{
sai_object_id_t vlan_oid;
sai_vlan_id_t vlan_id;
std::string autostate;
};

class Port
{
public:
Expand Down Expand Up @@ -53,17 +69,17 @@ class Port
Type m_type;
int m_index = 0; // PHY_PORT: index
int m_ifindex = 0;
sai_uint32_t m_mtu;
sai_object_id_t m_port_id = 0;
sai_object_id_t m_vlan_oid = 0;
VlanInfo m_vlan_info;
sai_object_id_t m_bridge_port_id = 0; // TODO: port could have multiple bridge port IDs
sai_vlan_id_t m_vlan_id = 0;
sai_vlan_id_t m_port_vlan_id = DEFAULT_PORT_VLAN_ID; // Port VLAN ID
sai_object_id_t m_vlan_member_id = 0;
sai_object_id_t m_rif_id = 0;
sai_object_id_t m_hif_id = 0;
sai_object_id_t m_lag_id = 0;
sai_object_id_t m_lag_member_id = 0;
sai_object_id_t m_acl_table_group_id = 0;
port_vlan_members_t m_vlan_members;
std::set<std::string> m_members;
std::vector<sai_object_id_t> m_queue_ids;
std::vector<sai_object_id_t> m_priority_group_ids;
Expand Down
Loading