Skip to content

Commit 6d6c59f

Browse files
Merge branch 'master' into github-master
2 parents a80556d + 39a3fe0 commit 6d6c59f

3 files changed

Lines changed: 24 additions & 3 deletions

File tree

apps/pkt-gen/pkt-gen.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1649,6 +1649,14 @@ receiver_body(void *data)
16491649
i = poll(&pfd, 1, 1000);
16501650
if (i > 0 && !(pfd.revents & POLLERR))
16511651
break;
1652+
if (i < 0) {
1653+
D("poll() error: %s", strerror(errno));
1654+
goto quit;
1655+
}
1656+
if (pfd.revents & POLLERR) {
1657+
D("fd error");
1658+
goto quit;
1659+
}
16521660
RD(1, "waiting for initial packets, poll returns %d %d",
16531661
i, pfd.revents);
16541662
}

sys/dev/netmap/netmap_vale.c

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -553,6 +553,7 @@ static int
553553
nm_vi_destroy(const char *name)
554554
{
555555
struct ifnet *ifp;
556+
struct netmap_vp_adapter *vpna;
556557
int error;
557558

558559
ifp = ifunit_ref(name);
@@ -565,18 +566,29 @@ nm_vi_destroy(const char *name)
565566
goto err;
566567
}
567568

568-
if (NA(ifp)->na_refcount > 1) {
569+
vpna = (struct netmap_vp_adapter *)NA(ifp);
570+
571+
/* we can only destroy ports that were created via NETMAP_BDG_NEWIF */
572+
if (vpna->autodelete) {
573+
error = EINVAL;
574+
goto err;
575+
}
576+
577+
/* also make sure that nobody is using the inferface */
578+
if (NETMAP_OWNED_BY_ANY(&vpna->up) ||
579+
vpna->up.na_refcount > 1 /* any ref besides the one in nm_vi_create()? */) {
569580
error = EBUSY;
570581
goto err;
571582
}
583+
572584
NMG_UNLOCK();
573585

574586
D("destroying a persistent vale interface %s", ifp->if_xname);
575587
/* Linux requires all the references are released
576588
* before unregister
577589
*/
578-
if_rele(ifp);
579590
netmap_detach(ifp);
591+
if_rele(ifp);
580592
nm_os_vi_detach(ifp);
581593
return 0;
582594

utils/testmmap.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -802,7 +802,8 @@ nmr_arg_extra()
802802
printf("arg1: %d [%sextra rings]\n", curr_nmr.nr_arg1,
803803
(curr_nmr.nr_arg1 ? "" : "no "));
804804
printf("arg2: %d [%s memory allocator]\n", curr_nmr.nr_arg2,
805-
(curr_nmr.nr_arg2 == 0 ? "global" : "private"));
805+
(curr_nmr.nr_arg2 == 0 ? "default" :
806+
curr_nmr.nr_arg2 == 1 ? "global" : "private"));
806807
printf("arg3: %d [%sextra buffers]\n", curr_nmr.nr_arg3,
807808
(curr_nmr.nr_arg3 ? "" : "no "));
808809
}

0 commit comments

Comments
 (0)