if_epair altq support problem
Ermal Luçi
eri at freebsd.org
Wed Mar 22 03:59:51 UTC 2017
On Tue, Mar 21, 2017 at 5:26 AM, Özkan KIRIK <ozkan.kirik at gmail.com> wrote:
> Hello,
>
> I sent this email also to freebsd-pf list. But I think that the main
> problem is belongs to sys/net/if_epair.c.
>
> I'm using FreeBSD 10.3-p17 amd64. epair pseudo device is listed as
> supperted deviced at the Man page of altq(4).
> From man page of altq :
>
> *SUPPORTED DEVICES <https://www.freebsd.org/cgi/man.cgi?query=altq#end>*
>
> The driver modifications described in altq(9)
> <https://www.freebsd.org/cgi/man.cgi?query=altq&sektion=9&
> apropos=0&manpath=FreeBSD+11.0-RELEASE+and+Ports>
> are required to use a cer-
> tain network card with *ALTQ*. They have been applied to the
> following
> hardware drivers: ae(4)
> <https://www.freebsd.org/cgi/man.cgi?query=ae&sektion=4&
> apropos=0&manpath=FreeBSD+11.0-RELEASE+and+Ports>,
> age(4) <https://www.freebsd.org/cgi/man.cgi?query=age&sektion=4&
> apropos=0&manpath=FreeBSD+11.0-RELEASE+and+Ports>,
> alc(4) <https://www.freebsd.org/cgi/man.cgi?query=alc&sektion=4&
> apropos=0&manpath=FreeBSD+11.0-RELEASE+and+Ports>,
> ale(4) <https://www.freebsd.org/cgi/man.cgi?query=ale&sektion=4&
> apropos=0&manpath=FreeBSD+11.0-RELEASE+and+Ports>,
> an(4) <https://www.freebsd.org/cgi/man.cgi?query=an&sektion=4&
> apropos=0&manpath=FreeBSD+11.0-RELEASE+and+Ports>,
> ath(4) <https://www.freebsd.org/cgi/man.cgi?query=ath&sektion=4&
> apropos=0&manpath=FreeBSD+11.0-RELEASE+and+Ports>,
> aue(4) <https://www.freebsd.org/cgi/man.cgi?query=aue&sektion=4&
> apropos=0&manpath=FreeBSD+11.0-RELEASE+and+Ports>,
> axe(4) <https://www.freebsd.org/cgi/man.cgi?query=axe&sektion=4&
> apropos=0&manpath=FreeBSD+11.0-RELEASE+and+Ports>,
> bce(4) <https://www.freebsd.org/cgi/man.cgi?query=bce&sektion=4&
> apropos=0&manpath=FreeBSD+11.0-RELEASE+and+Ports>,
> bfe(4) <https://www.freebsd.org/cgi/man.cgi?query=bfe&sektion=4&
> apropos=0&manpath=FreeBSD+11.0-RELEASE+and+Ports>,
> bge(4) <https://www.freebsd.org/cgi/man.cgi?query=bge&sektion=4&
> apropos=0&manpath=FreeBSD+11.0-RELEASE+and+Ports>,
> bxe(4) <https://www.freebsd.org/cgi/man.cgi?query=bxe&sektion=4&
> apropos=0&manpath=FreeBSD+11.0-RELEASE+and+Ports>,
> cas(4) <https://www.freebsd.org/cgi/man.cgi?query=cas&sektion=4&
> apropos=0&manpath=FreeBSD+11.0-RELEASE+and+Ports>,
> cxgbe(4) <https://www.freebsd.org/cgi/man.cgi?query=cxgbe&sektion=4&
> apropos=0&manpath=FreeBSD+11.0-RELEASE+and+Ports>,
> dc(4) <https://www.freebsd.org/cgi/man.cgi?query=dc&sektion=4&
> apropos=0&manpath=FreeBSD+11.0-RELEASE+and+Ports>,
> de(4) <https://www.freebsd.org/cgi/man.cgi?query=de&sektion=4&
> apropos=0&manpath=FreeBSD+11.0-RELEASE+and+Ports>,
> ed(4) <https://www.freebsd.org/cgi/man.cgi?query=ed&sektion=4&
> apropos=0&manpath=FreeBSD+11.0-RELEASE+and+Ports>,
> em(4) <https://www.freebsd.org/cgi/man.cgi?query=em&sektion=4&
> apropos=0&manpath=FreeBSD+11.0-RELEASE+and+Ports>,
> ep(4) <https://www.freebsd.org/cgi/man.cgi?query=ep&sektion=4&
> apropos=0&manpath=FreeBSD+11.0-RELEASE+and+Ports>,
> epair(4) <https://www.freebsd.org/cgi/man.cgi?query=epair&sektion=4&
> apropos=0&manpath=FreeBSD+11.0-RELEASE+and+Ports>,
> ....
>
> But while trying to use it the system says that it's not suppoerted. I
> tried on FreeBSD 11 also. The output is below:
>
> pf.conf :
> altq on epair0b hfsc bandwidth 1Mb queue { ftp, ssh, icmp, other }
> queue ftp bandwidth 30% priority 0 hfsc (upperlimit 99%)
> queue ssh bandwidth 30% priority 2 hfsc (upperlimit 99%)
> queue icmp bandwidth 10% priority 2 hfsc (upperlimit 99%)
> queue other bandwidth 30% priority 1 hfsc (default upperlimit 99%)
>
>
> # ifconfig epair0 create
> # ifconfig epair0a up
> # ifconfig epair0b up
> # pfctl -f pf.conf
> pfctl: epair0b: driver does not support altq
>
> # sysctl -a | grep ALTQ
> options ALTQ_NOPCC
> options ALTQ_PRIQ
> options ALTQ_CDNR
> options ALTQ_HFSC
> options ALTQ_RIO
> options ALTQ_RED
> options ALTQ_CBQ
> options ALTQ
>
>
> I have a look on /usr/src/sys/net/if_epair.c, and found the ALTQ section:
>
> 514 #ifdef ALTQ
> 515 /* Support ALTQ via the clasic if_start() path. */
> 516 IF_LOCK(&ifp->if_snd);
> 517 if (ALTQ_IS_ENABLED(&ifp->if_snd)) {
> 518 ALTQ_ENQUEUE(&ifp->if_snd, m, NULL, error);
> 519 if (error)
> 520 ifp->if_snd.ifq_drops++;
> 521 IF_UNLOCK(&ifp->if_snd);
> 522 if (!error) {
> 523 ifp->if_obytes += len;
> 524 if (mflags & (M_BCAST|M_MCAST))
> 525 ifp->if_omcasts++;
> 526
> 527 if ((ifp->if_drv_flags & IFF_DRV_OACTIVE) ==
> 0)
> 528 epair_start_locked(ifp);
> 529 else
> 530 (void)epair_add_ifp_for_
> draining(ifp);
> 531 }
> 532 return (error);
> 533 }
> 534 IF_UNLOCK(&ifp->if_snd);
> 535 #endif
>
>
Just apply manually this patch to make it work.
diff --git a/sys/net/if_epair.c b/sys/net/if_epair.c
index 540f06c..04733a5 100644
--- a/sys/net/if_epair.c
+++ b/sys/net/if_epair.c
@@ -827,9 +827,11 @@ epair_clone_create(struct if_clone *ifc, char *name,
size_t len, caddr_t params)
ifp->if_capabilities = IFCAP_VLAN_MTU;
ifp->if_capenable = IFCAP_VLAN_MTU;
ifp->if_start = epair_start;
+ if_setstartfn(ifp, epair_start);
+ if_setsendqlen(ifp, ifqmaxlen);
+ if_setsendqready(ifp);
ifp->if_ioctl = epair_ioctl;
ifp->if_init = epair_init;
- ifp->if_snd.ifq_maxlen = ifqmaxlen;
/* Assign a hopefully unique, locally administered etheraddr. */
eaddr[0] = 0x02;
eaddr[3] = (ifp->if_index >> 8) & 0xff;
@@ -852,10 +854,11 @@ epair_clone_create(struct if_clone *ifc, char *name,
size_t len, caddr_t params)
ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
ifp->if_capabilities = IFCAP_VLAN_MTU;
ifp->if_capenable = IFCAP_VLAN_MTU;
- ifp->if_start = epair_start;
+ if_setstartfn(ifp, epair_start);
+ if_setsendqlen(ifp, ifqmaxlen);
+ if_setsendqready(ifp);
ifp->if_ioctl = epair_ioctl;
ifp->if_init = epair_init;
- ifp->if_snd.ifq_maxlen = ifqmaxlen;
/* We need to play some tricks here for the second interface. */
strlcpy(name, epairname, len);
error = if_clone_create(name, len, (caddr_t)scb);
> I have no idea that why it says that it doesn't support altq altough the
> source code contains ALTQ section.
>
>
> Regards
> Özkan KIRIK
> _______________________________________________
> freebsd-net at freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-net
> To unsubscribe, send any mail to "freebsd-net-unsubscribe at freebsd.org"
--
Ermal
More information about the freebsd-net
mailing list