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

Changed NM_BRIDGES to 256 #421

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -73,3 +73,4 @@ read-vars.mak
LINUX/scripts/conf
config.mak
*.rej
G*A*
2 changes: 1 addition & 1 deletion sys/dev/netmap/netmap_kern.h
Expand Up @@ -1443,7 +1443,7 @@ struct netmap_bdg_ops {
u_int netmap_bdg_learning(struct nm_bdg_fwd *ft, uint8_t *dst_ring,
struct netmap_vp_adapter *);

#define NM_BRIDGES 8 /* number of bridges */
#define NM_BRIDGES 256 /* number of bridges */
#define NM_BDG_MAXPORTS 254 /* up to 254 */
#define NM_BDG_BROADCAST NM_BDG_MAXPORTS
#define NM_BDG_NOPORT (NM_BDG_MAXPORTS+1)
Expand Down
4 changes: 1 addition & 3 deletions sys/dev/netmap/netmap_vale.c
Expand Up @@ -711,7 +711,6 @@ netmap_get_bdg_na(struct nmreq *nmr, struct netmap_adapter **na,
struct netmap_vp_adapter *vpna, *hostna = NULL;
struct nm_bridge *b;
int i, j, cand = -1, cand2 = -1;
int needed;

*na = NULL; /* default return value */

Expand Down Expand Up @@ -752,8 +751,7 @@ netmap_get_bdg_na(struct nmreq *nmr, struct netmap_adapter **na,
if (!create)
return ENXIO;
/* yes we should, see if we have space to attach entries */
needed = 2; /* in some cases we only need 1 */
if (b->bdg_active_ports + needed >= NM_BDG_MAXPORTS) {
if (b->bdg_active_ports >= NM_BDG_MAXPORTS) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

The previous check was too conservative: >= should have been > and needed should have been computed more precisely.

Your change, however, is wrong. There are cases when we need two slots. See where cand2 is actually used.

D("bridge full %d, cannot create new port", b->bdg_active_ports);
return ENOMEM;
}
Expand Down