Re: [ovs-dev] [RFC] [PATCH 3/6] port_group: bridge: set port_group in port config

2017-05-04 Thread Darrell Ball


On 4/3/17, 2:40 AM, "ovs-dev-boun...@openvswitch.org on behalf of Matthias May" 
 wrote:

Signed-off-by: Matthias May 
---
 vswitchd/bridge.c | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c
index 867a26d8d..316e4742e 100644
--- a/vswitchd/bridge.c
+++ b/vswitchd/bridge.c
@@ -966,6 +966,17 @@ port_configure(struct port *port)
 s.slaves[s.n_slaves++] = iface->ofp_port;
 }
 
+/* Get port_group. */
+if (cfg->port_group) {
+if ((*cfg->port_group > 0 && *cfg->port_group < OFPP_MAX)
+|| *cfg->port_group == OFPP_LOCAL) {
+s.port_group = (uint32_t) *cfg->port_group;
+}
+} else {
+/* On a port with multiple interfaces we default to the first. */
+s.port_group = s.slaves[0];

Instead of imposing a default policy like this, maybe it is better to have 
the isolation group with default “disabled” and have a helper function that 
checks for that
as well as the differing isolation groups.
Disabled isolation ports can communicate with any isolated ports.
This would leave loopback logic completely orthogonal.

+}
+
 /* Get VLAN tag. */
 s.vlan = -1;
 if (cfg->tag && *cfg->tag >= 0 && *cfg->tag <= 4095) {
-- 
2.11.0

___
dev mailing list
d...@openvswitch.org

https://urldefense.proofpoint.com/v2/url?u=https-3A__mail.openvswitch.org_mailman_listinfo_ovs-2Ddev=DwICAg=uilaK90D4TOVoH58JNXRgQ=BVhFA09CGX7JQ5Ih-uZnsw=reKfuY6GRfozcBj7e654rG5Di77rfpfqAbBm0BoJrEw=KRS04c6LgBEGunxav4lvA8s53R1rZ4DN1OJpaXGwwgA=
 


___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [RFC] [PATCH 3/6] port_group: bridge: set port_group in port config

2017-04-21 Thread Ben Pfaff
On Mon, Apr 03, 2017 at 11:40:57AM +0200, Matthias May wrote:
> Signed-off-by: Matthias May 
> ---
>  vswitchd/bridge.c | 11 +++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c
> index 867a26d8d..316e4742e 100644
> --- a/vswitchd/bridge.c
> +++ b/vswitchd/bridge.c
> @@ -966,6 +966,17 @@ port_configure(struct port *port)
>  s.slaves[s.n_slaves++] = iface->ofp_port;
>  }
>  
> +/* Get port_group. */
> +if (cfg->port_group) {
> +if ((*cfg->port_group > 0 && *cfg->port_group < OFPP_MAX)
> +|| *cfg->port_group == OFPP_LOCAL) {
> +s.port_group = (uint32_t) *cfg->port_group;
> +}
> +} else {
> +/* On a port with multiple interfaces we default to the first. */
> +s.port_group = s.slaves[0];
> +}
> +

This fails to build because:

../vswitchd/bridge.c:973:15: error: no member named 'port_group' in 'struct 
ofproto_bundle_settings'
../vswitchd/bridge.c:977:11: error: no member named 'port_group' in 'struct 
ofproto_bundle_settings'

Probably that indicates that this patch should be combined with a later
patch that adds the port_group member.

"sparse" says:

../vswitchd/bridge.c:971:57: warning: restricted ofp_port_t degrades to 
integer
../vswitchd/bridge.c:972:36: warning: restricted ofp_port_t degrades to 
integer

which probably indicates that you should be using use ofp_to_u16() to
get integer values for OFPP_MAX and OFPP_LOCAL.
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] [RFC] [PATCH 3/6] port_group: bridge: set port_group in port config

2017-04-03 Thread Matthias May
Signed-off-by: Matthias May 
---
 vswitchd/bridge.c | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c
index 867a26d8d..316e4742e 100644
--- a/vswitchd/bridge.c
+++ b/vswitchd/bridge.c
@@ -966,6 +966,17 @@ port_configure(struct port *port)
 s.slaves[s.n_slaves++] = iface->ofp_port;
 }
 
+/* Get port_group. */
+if (cfg->port_group) {
+if ((*cfg->port_group > 0 && *cfg->port_group < OFPP_MAX)
+|| *cfg->port_group == OFPP_LOCAL) {
+s.port_group = (uint32_t) *cfg->port_group;
+}
+} else {
+/* On a port with multiple interfaces we default to the first. */
+s.port_group = s.slaves[0];
+}
+
 /* Get VLAN tag. */
 s.vlan = -1;
 if (cfg->tag && *cfg->tag >= 0 && *cfg->tag <= 4095) {
-- 
2.11.0

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev