Skip to content

Commit 1dc2bf2

Browse files
committed
Merge branch 'master' into gh
2 parents 44662b1 + f125a55 commit 1dc2bf2

13 files changed

Lines changed: 915 additions & 205 deletions

LINUX/bsd_glue.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,7 @@ struct thread;
283283

284284
/* some other FreeBSD APIs */
285285
struct net_device* ifunit_ref(const char *name);
286+
void if_ref(struct net_device *ifp);
286287
void if_rele(struct net_device *ifp);
287288

288289
/* hook to send from user space */

LINUX/default-config.mak.in_

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ $(1)@clean := if [ -d $(1) ]; then make -C $(1) clean CFLAGS_EXTRA="$($(1)@cfla
88
$(1)@distclean := rm -rf $(1)-$(2)
99
endef
1010

11-
enabled_intel_driver = $(if $(filter $(1),$(E_DRIVERS)),$(eval $(call intel_driver,$(1),$(2)),))
11+
enabled_intel_driver = $(if $(filter $(1),$(E_DRIVERS)),$(eval $(call intel_driver,$(1),$(2))))
1212

1313
$(call enabled_intel_driver,ixgbe,4.5.4)
1414
$(call enabled_intel_driver,ixgbevf,3.3.2)

LINUX/netmap_linux.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -878,6 +878,11 @@ ifunit_ref(const char *name)
878878
#endif
879879
}
880880

881+
void if_ref(struct net_device *ifp)
882+
{
883+
dev_hold(ifp);
884+
}
885+
881886
void if_rele(struct net_device *ifp)
882887
{
883888
dev_put(ifp);

apps/lb/lb.c

Lines changed: 2 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -367,91 +367,6 @@ parse_pipes(char *spec)
367367
return 0;
368368
}
369369

370-
static void delete_custom_ports(void);
371-
/* create a persistent vale port or reuse an existing one.
372-
* Returns 1 on error, 0 on success
373-
*/
374-
static int
375-
create_custom_ports(int memid)
376-
{
377-
struct nmreq nmr;
378-
int i,rv;
379-
struct group_des *g;
380-
381-
rv = open("/dev/netmap", O_RDWR);
382-
if (rv < 0) {
383-
D("failed to open /dev/netmap: %s", strerror(errno));
384-
return 1;
385-
}
386-
glob_arg.netmap_fd = rv;
387-
388-
for (i = 0; i < glob_arg.num_groups; i++) {
389-
g = &groups[i];
390-
391-
if (!g->custom_port)
392-
continue;
393-
394-
bzero(&nmr, sizeof(nmr));
395-
nmr.nr_version = NETMAP_API;
396-
strncpy(nmr.nr_name, g->pipename, sizeof(nmr.nr_name));
397-
nmr.nr_cmd = NETMAP_BDG_NEWIF;
398-
nmr.nr_arg2 = memid;
399-
400-
rv = ioctl(glob_arg.netmap_fd, NIOCREGIF, &nmr);
401-
if (rv < 0) {
402-
/* reset the custom_port flag, so that we do not
403-
* try to delete what we did not create
404-
*/
405-
g->custom_port = 0;
406-
if (errno == EEXIST) {
407-
if (nmr.nr_arg2 != memid) {
408-
D("%s already exists, but it is using allocator %d instead of %d",
409-
g->pipename, nmr.nr_arg2, memid);
410-
411-
return 1;
412-
} else {
413-
D("opened already existing port %s", g->pipename);
414-
}
415-
} else {
416-
D("error creating %s: %s", g->pipename, strerror(errno));
417-
return 1;
418-
}
419-
} else {
420-
D("successfully created port %s", g->pipename);
421-
}
422-
}
423-
return 0;
424-
}
425-
426-
/* called at exit to remove all the custom ports that
427-
* we created (note that deletion may fail is somebody
428-
* is still using either the ports or their pipes
429-
*/
430-
static void
431-
delete_custom_ports(void)
432-
{
433-
struct nmreq nmr;
434-
int rv, i;
435-
436-
for (i = 0; i < glob_arg.num_groups; i++) {
437-
struct group_des *g = &groups[i];
438-
439-
if (!g->custom_port)
440-
continue;
441-
442-
bzero(&nmr, sizeof(nmr));
443-
nmr.nr_version = NETMAP_API;
444-
strncpy(nmr.nr_name, g->pipename, sizeof(nmr.nr_name));
445-
nmr.nr_cmd = NETMAP_BDG_DELIF;
446-
447-
rv = ioctl(glob_arg.netmap_fd, NIOCREGIF, &nmr);
448-
if (rv < 0) {
449-
D("WARNING: error while deleting %s: %s",
450-
g->pipename, strerror(errno));
451-
}
452-
}
453-
}
454-
455370
/* complete the initialization of the groups data structure */
456371
void init_groups(void)
457372
{
@@ -740,13 +655,6 @@ int main(int argc, char **argv)
740655
rxport->nmd->nifp->ni_bufs_head = 0;
741656

742657
run:
743-
/* we need to create the persistent vale ports */
744-
if (create_custom_ports(rxport->nmd->req.nr_arg2)) {
745-
free_buffers();
746-
return 1;
747-
}
748-
atexit(delete_custom_ports);
749-
750658
atexit(free_buffers);
751659

752660
int j, t = 0;
@@ -756,7 +664,8 @@ int main(int argc, char **argv)
756664
for (k = 0; k < g->nports; ++k) {
757665
struct port_des *p = &g->ports[k];
758666
char interface[25];
759-
sprintf(interface, "netmap:%s{%d/xT", g->pipename, g->first_id + k);
667+
sprintf(interface, "netmap:%s{%d/xT@%d", g->pipename, g->first_id + k,
668+
rxport->nmd->req.nr_arg2);
760669
D("opening pipe named %s", interface);
761670

762671
p->nmd = nm_open(interface, NULL, 0, rxport->nmd);

0 commit comments

Comments
 (0)