Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[proxy_arp] Implement proxy ARP feature #1285

Merged
merged 8 commits into from
May 26, 2020

Conversation

volodymyrsamotiy
Copy link
Collaborator

Signed-off-by: Volodymyr Samotiy volodymyrs@mellanox.com

What I did
Implemented ARP proxy feature.

Why I did it
Feature request according to HLD https://github.com/Azure/SONiC/blob/master/doc/arp/Proxy%20Arp.md.

How I verified it

  • Verified that it is possible to enable and disable proxy ARP on non VNET interfaces
    • Verified kernel configuration via proc FS
    • Verified VLAN flood SAI configuration for VLAN RIF
  • Verified that proxy ARP is enabled by default on VNET interfaces
  • Verified that ARP packets are propagated correctly when proxy ARP is enabled

Details if related
N/A

@lgtm-com
Copy link

lgtm-com bot commented Apr 30, 2020

This pull request introduces 1 alert and fixes 10 when merging 1e4a62e into 3829053 - view on LGTM.com

new alerts:

  • 1 for Syntax error

fixed alerts:

  • 8 for Unused local variable
  • 2 for Unused import

@volodymyrsamotiy volodymyrsamotiy force-pushed the proxy_arp branch 5 times, most recently from de6a68c to 1215973 Compare May 4, 2020 12:32
Signed-off-by: Volodymyr Samotiy <volodymyrs@mellanox.com>
@prsunny
Copy link
Collaborator

prsunny commented May 8, 2020

can you please fix lgtm alerts?

Volodymyr Samotiy added 3 commits May 9, 2020 17:18
* Update VNET virtual switch test

Signed-off-by: Volodymyr Samotiy <volodymyrs@mellanox.com>
* Remove redundant attribute check from VNET virtual switch test

Signed-off-by: Volodymyr Samotiy <volodymyrs@mellanox.com>
* Remove redundant code in VNET virtual test

Signed-off-by: Volodymyr Samotiy <volodymyrs@mellanox.com>
@volodymyrsamotiy
Copy link
Collaborator Author

retest this please

1 similar comment
@volodymyrsamotiy
Copy link
Collaborator Author

retest this please

{
SWSS_LOG_ENTER();

if (proxy_arp != "enabled" || proxy_arp != "disabled")
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think we need this check. It wouldn't be added by IntfMgr if value is different

@@ -420,7 +454,22 @@ bool IntfMgr::doIntfGeneralTask(const vector<string>& keys,
FieldValueTuple fvTuple("mac_addr", MacAddress().to_string());
data.push_back(fvTuple);
}


if (!proxy_arp.empty() || !vrf_name.compare(0, strlen(VNET_PREFIX), VNET_PREFIX))
Copy link
Collaborator

Choose a reason for hiding this comment

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

A small request for change : After some internal discussion, we don't want to have proxy_arp enabled explicitly for Vnets. Let that also be triggered by config_db entry. I'll make necessary modifications to requirement doc. Please remove this check on Vnets

EXEC_WITH_ERROR_THROW(cmd.str(), res);

SWSS_LOG_INFO("Proxy ARP set to \"%s\" on interface \"%s\"", proxy_arp.c_str(), alias.c_str());

Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggest to remove extra line to avoid file getting bigger

}
else
{
port.m_vlan_info.vlan_flood_type = SAI_VLAN_FLOOD_CONTROL_TYPE_ALL;
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't see this updated back to port map. Please refer this after updating a field of port. In this case, i dont think you need to store this value. Just pass the flood_type to setIntfVlanFloodType

Copy link
Contributor

Choose a reason for hiding this comment

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

Hi @volodymyrsamotiy @prsunny, is it alright to influence the flooding behavior of all BUM packets when proxy_arp enabled? This flood_type attr seems not only applied to ARP packets.

typedef enum _sai_vlan_flood_control_type_t
{
    /**
     * @brief Flood on all vlan members
     *
     * When setting all to broadcast or unknown multicast flood, it also includes
     * flooding to the router. When setting all to unknown unicast flood, it does
     * not include flooding to the router
     */
    SAI_VLAN_FLOOD_CONTROL_TYPE_ALL,

    /** Disable flooding */
    SAI_VLAN_FLOOD_CONTROL_TYPE_NONE,

    /** Flood on the L2MC group */
    SAI_VLAN_FLOOD_CONTROL_TYPE_L2MC_GROUP,

    /**
     * @brief Flood on all vlan members and L2MC group
     *
     * Flood on all vlan members, without the router
     * In addition, flood on the supplied L2MC group
     */
    SAI_VLAN_FLOOD_CONTROL_TYPE_COMBINED

} sai_vlan_flood_control_type_t;

}

m_syncdIntfses[alias].proxy_arp = (proxy_arp == "enabled") ? true : false;

Copy link
Collaborator

Choose a reason for hiding this comment

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

Pls remove this extra line. Just a suggestion

orchagent/port.h Outdated
sai_vlan_id_t vlan_id = 0;
sai_object_id_t vlan_oid = 0;
sai_vlan_id_t vlan_id = 0;
sai_vlan_flood_control_type_t vlan_flood_type = SAI_VLAN_FLOOD_CONTROL_TYPE_ALL;
Copy link
Collaborator

Choose a reason for hiding this comment

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

I suggest to remove this attribute as it is a function handled in intforch and portorch doesn't necessarily be aware of this

Volodymyr Samotiy added 3 commits May 22, 2020 19:41
* Fix review comments

Sined-off-by: Volodymyr Samotiy <volodymyrs@mellanox.com>
* Fix review comments

Signed-off-by: Volodymyr Samotiy <volodymyrs@mellanox.com>
* Remove extra line

Signed-off-by: Volodymyr Samotiy <volodymyrs@mellanox.com>
@volodymyrsamotiy
Copy link
Collaborator Author

fixed review comments

@@ -420,7 +453,23 @@ bool IntfMgr::doIntfGeneralTask(const vector<string>& keys,
FieldValueTuple fvTuple("mac_addr", MacAddress().to_string());
data.push_back(fvTuple);
}



Copy link
Collaborator

Choose a reason for hiding this comment

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

Please remove this extra line

@@ -272,6 +272,33 @@ void IntfMgr::removeSubIntfState(const string &alias)
}
}

bool IntfMgr::setIntfProxyArp(const string &alias, const string &vrf_name, const string &proxy_arp)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could you please remove this parameter as it is not used?

* Fix review comments

Signed-off-by: Volodymyr Samotiy <volodymyrs@mellanox.com>
@prsunny prsunny merged commit 4798584 into sonic-net:master May 26, 2020
@abdosi
Copy link
Contributor

abdosi commented May 28, 2020

@volodymyrsamotiy please create PR for 201911 branch. Chery-pick has conflict

@prsunny

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants