-
Notifications
You must be signed in to change notification settings - Fork 28
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
vtep: add an option to have no multicast #528
Open
outscale-mgo
wants to merge
1
commit into
outscale:master
Choose a base branch
from
outscale-mgo:no-multicat-management
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -355,10 +355,12 @@ static inline int vtep_header_prepend(struct vtep_state *state, | |
|
||
static inline int vtep_encapsulate(struct vtep_state *state, | ||
struct vtep_port *port, | ||
struct rte_mbuf **pkts, uint64_t pkts_mask, | ||
struct rte_mbuf **pkts, | ||
uint64_t *maskp, | ||
struct pg_error **errp) | ||
{ | ||
struct rte_mempool *mp = pg_get_mempool(); | ||
uint64_t pkts_mask = *maskp; | ||
|
||
/* do the encapsulation */ | ||
for (; pkts_mask;) { | ||
|
@@ -388,6 +390,12 @@ static inline int vtep_encapsulate(struct vtep_state *state, | |
unicast = 0; | ||
} | ||
|
||
if (state->flags & PG_VTEP_NO_MULTICAST && !unicast) { | ||
/* in this case all we can do is to skip the packet */ | ||
*maskp &= ~i; | ||
continue; | ||
} | ||
|
||
if (unlikely(!(state->flags & PG_VTEP_NO_COPY))) { | ||
tmp = rte_pktmbuf_clone(pkt, mp); | ||
if (unlikely(!tmp)) | ||
|
@@ -459,11 +467,15 @@ static inline int to_vtep(struct pg_brick *brick, enum pg_side from, | |
if (unlikely(are_mac_tables_dead(port) && | ||
try_fix_tables(state, port, errp) < 0)) | ||
return -1; | ||
/* if the port VNI is not set up ignore the packets */ | ||
if (unlikely(!pg_is_multicast_ip(port->multicast_ip))) | ||
return 0; | ||
|
||
if (unlikely(vtep_encapsulate(state, port, pkts, pkts_mask, errp) < 0)) | ||
if (state->flags & PG_VTEP_NO_MULTICAST) { | ||
/* if the port VNI is not set up ignore the packets */ | ||
if (unlikely(!pg_is_multicast_ip(port->multicast_ip))) | ||
return 0; | ||
} | ||
|
||
if (unlikely(vtep_encapsulate(state, port, pkts, | ||
&pkts_mask, errp) < 0)) | ||
return -1; | ||
|
||
ret = pg_brick_side_forward(s, from, state->pkts, pkts_mask, errp); | ||
|
@@ -795,7 +807,8 @@ static int do_add_vni(struct vtep_state *state, uint16_t edge_index, | |
*errp = pg_error_new("port already attached to a vni"); | ||
return -1; | ||
} | ||
if (unlikely(pg_is_multicast_ip(port->multicast_ip))) { | ||
if (!(state->flags & PG_VTEP_NO_MULTICAST) && | ||
unlikely(pg_is_multicast_ip(port->multicast_ip))) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here, i prefer |
||
*errp = pg_error_new("port alread have a mutlicast IP"); | ||
return -1; | ||
} | ||
|
@@ -806,7 +819,8 @@ static int do_add_vni(struct vtep_state *state, uint16_t edge_index, | |
g_assert(!pg_mac_table_init(&port->mac_to_dst, &state->exeption_env)); | ||
g_assert(!pg_mac_table_init(&port->known_mac, &state->exeption_env)); | ||
|
||
multicast_subscribe(state, port, multicast_ip, errp); | ||
if (!(state->flags & PG_VTEP_NO_MULTICAST)) | ||
multicast_subscribe(state, port, multicast_ip, errp); | ||
return 0; | ||
} | ||
|
||
|
@@ -827,8 +841,8 @@ static void do_remove_vni(struct vtep_state *state, | |
if (!pg_is_multicast_ip(port->multicast_ip)) | ||
return; | ||
|
||
multicast_unsubscribe(state, port, port->multicast_ip, | ||
errp); | ||
if (!(state->flags & PG_VTEP_NO_MULTICAST)) | ||
multicast_unsubscribe(state, port, port->multicast_ip, errp); | ||
|
||
if (pg_error_is_set(errp)) | ||
return; | ||
|
@@ -1053,12 +1067,6 @@ int pg_vtep_add_vni_(struct pg_brick *brick, | |
|
||
pg_ip_copy(multicast_ip, &tmp_ip); | ||
|
||
if (!pg_is_multicast_ip(tmp_ip)) { | ||
*errp = pg_error_new( | ||
"Provided IP is not in the multicast range"); | ||
return -1; | ||
} | ||
|
||
/* lookup for the vtep brick index */ | ||
found = 0; | ||
for (i = 0; i < brick->sides[side].max; i++) | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer
if (!unicast && state->flags & PG_VTEP_NO_MULTICAST)
we don't have to do this
state->flags & PG_VTEP_NO_MULTICAST
operation ifunicast==true