From owner-freebsd-net@freebsd.org  Thu Mar 23 19:16:12 2017
Return-Path: <owner-freebsd-net@freebsd.org>
Delivered-To: freebsd-net@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org
 [IPv6:2001:1900:2254:206a::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id CB8EECBA672
 for <freebsd-net@mailman.ysv.freebsd.org>;
 Thu, 23 Mar 2017 19:16:12 +0000 (UTC)
 (envelope-from ozkan.kirik@gmail.com)
Received: from mail-qt0-x234.google.com (mail-qt0-x234.google.com
 [IPv6:2607:f8b0:400d:c0d::234])
 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
 (Client CN "smtp.gmail.com",
 Issuer "Google Internet Authority G2" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 828FD1FE3;
 Thu, 23 Mar 2017 19:16:12 +0000 (UTC)
 (envelope-from ozkan.kirik@gmail.com)
Received: by mail-qt0-x234.google.com with SMTP id i34so184439233qtc.0;
 Thu, 23 Mar 2017 12:16:12 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=mime-version:in-reply-to:references:from:date:message-id:subject:to
 :cc; bh=PnaAMduy2BCGNgles2Nffa63nbt0h9Di7mIMorVztlA=;
 b=Kpb/SilIX925nrE8cUmIaAMNPDyAsK2FwITh17pK6B/AYpw/1SE/dNPJZyjLCdCqM0
 77GK+B8cEY3h/g6c9IzhTedNmaFbkxonGxJd2nTji+4/zxiRYIxC/6IBFqbGmAVBEs2N
 zhK2niBwIG+NzdRlSkq2+RGnCv3Omwxem6m0X5lhwyb0fIq2Eb79UvqiLpgFvAnDvGgn
 onuZ+MjUz5NLUrkIxC1wxSjnCk5V/KWu1YZs2Em2W0J0SHpYb4H7tZe5TYEH0NELj8at
 KAiDdd2qxekXhFsT9BHaf1zHzb1dCV47q5pYKKGh0x/4o8GtDrsuO5BzeDx6qf0eY3LV
 fMCg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:mime-version:in-reply-to:references:from:date
 :message-id:subject:to:cc;
 bh=PnaAMduy2BCGNgles2Nffa63nbt0h9Di7mIMorVztlA=;
 b=WDNcnTmMOFG65fP22zeS0CjUp+SGhwJ0EvVfqXd2AU2QaGG7xLCgNWhS/Mzdk3F9M4
 GDNoOyzATJcSMyHmjGiXugmKODSuSnzT2N+2+XbTavVvUAelNb0H9pFThXkclBaeTQYJ
 qkx+GS29vSdzf67Tr4XZ9L0gxPjcKmjQ1ZrZ5hVsjYKQ1XPHyB8RtS4LTMOJcjdknG9Y
 uNjsOrZPl/x8zb9sFL0Zapa+jMue73SBZ+aVez3BY6zQl/NZf8mERmlRv3Dw1x+Mc/2T
 kU8j/9ZQrvahTgFxLm6dy/Xiw6jMChBeFkwnd2AUKT1n5zEkfenbLlnt3UOBTRl9BEor
 BIFA==
X-Gm-Message-State: AFeK/H1nsPdcLE/mYg64ZY87TO/q571T3BLAE3+RSj+cunSMKRWxym8DScRXWU7kh8wcqZQrVR4YYDyONgVShA==
X-Received: by 10.200.40.42 with SMTP id 39mr3952123qtq.149.1490296571112;
 Thu, 23 Mar 2017 12:16:11 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.12.179.135 with HTTP; Thu, 23 Mar 2017 12:16:10 -0700 (PDT)
In-Reply-To: <CAPBZQG1JoaAeMkrLenPAfm7cyeGRDVKkcDmoWjh+JvYjc5Oifw@mail.gmail.com>
References: <CAAcX-AFJ4mmFQt2k3gdsG4c8g3d-ypzSFpypQLQF_3Jdw0W3ew@mail.gmail.com>
 <CAPBZQG0oUHamfmvZxk8_LaPG_+hTbPTuvX4h7Y9osrsvcH1L3g@mail.gmail.com>
 <CAAcX-AFcnwAMCBcaFVYBBAGJ=hV-8P8zoP+xPj6T9i4eX1UFEA@mail.gmail.com>
 <CAAcX-AHPVSDhKrPdPCG9b3qvGPG7HOH5d_rs4o6Fjt8_+5gw6g@mail.gmail.com>
 <CAPBZQG32fZ-S5Qr-RhssgxP+Vv_v4NTGvogLgBTTw=5heKWHwg@mail.gmail.com>
 <CAAcX-AG6y827P3wzmAxn1_sWpy48WpXMmQn3AK-fcrap_kB+cA@mail.gmail.com>
 <CAPBZQG1JoaAeMkrLenPAfm7cyeGRDVKkcDmoWjh+JvYjc5Oifw@mail.gmail.com>
From: =?UTF-8?B?w5Z6a2FuIEtJUklL?= <ozkan.kirik@gmail.com>
Date: Thu, 23 Mar 2017 22:16:10 +0300
Message-ID: <CAAcX-AH6pckP31K-i-H3+ndx3BvGpfHCGnCQ2y2epXRejhLJSA@mail.gmail.com>
Subject: Re: if_epair altq support problem
To: =?UTF-8?Q?Ermal_Lu=C3=A7i?= <eri@freebsd.org>
Cc: "freebsd-net@freebsd.org" <freebsd-net@freebsd.org>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
X-Content-Filtered-By: Mailman/MimeDel 2.1.23
X-BeenThere: freebsd-net@freebsd.org
X-Mailman-Version: 2.1.23
Precedence: list
List-Id: Networking and TCP/IP with FreeBSD <freebsd-net.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/freebsd-net>,
 <mailto:freebsd-net-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/freebsd-net/>
List-Post: <mailto:freebsd-net@freebsd.org>
List-Help: <mailto:freebsd-net-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/freebsd-net>,
 <mailto:freebsd-net-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 23 Mar 2017 19:16:12 -0000

Ermal thank you again,
It compiles but pf still says that "pfctl: epair0b: driver does not support
altq"
:/

On Thu, Mar 23, 2017 at 9:46 PM, Ermal Lu=C3=A7i <eri@freebsd.org> wrote:

>
> On Thu, Mar 23, 2017 at 11:06 AM, =C3=96zkan KIRIK <ozkan.kirik@gmail.com=
>
> wrote:
>
>> Thank you, I'm waiting for 10.3 fix :)
>> have a nice day
>>
>
>
> This should work for 10.3++
>
>  diff --git a/sys/net/if_epair.c b/sys/net/if_epair.c
> index 540f06c..d028a95 100644
> --- a/sys/net/if_epair.c
> +++ b/sys/net/if_epair.c
> @@ -829,7 +829,8 @@ epair_clone_create(struct if_clone *ifc, char *name,
> size_t len, caddr_t params)
>         ifp->if_start =3D epair_start;
>         ifp->if_ioctl =3D epair_ioctl;
>         ifp->if_init  =3D epair_init;
> -       ifp->if_snd.ifq_maxlen =3D ifqmaxlen;
> +       IFQ_SET_MAXLEN(&ifp->if_snd, ifqmaxlen);
> +       IFQ_SET_READY(&ifp->if_snd);
>         /* Assign a hopefully unique, locally administered etheraddr. */
>         eaddr[0] =3D 0x02;
>         eaddr[3] =3D (ifp->if_index >> 8) & 0xff;
> @@ -855,7 +856,8 @@ epair_clone_create(struct if_clone *ifc, char *name,
> size_t len, caddr_t params)
>         ifp->if_start =3D epair_start;
>         ifp->if_ioctl =3D epair_ioctl;
>         ifp->if_init  =3D epair_init;
> -       ifp->if_snd.ifq_maxlen =3D ifqmaxlen;
> +       IFQ_SET_MAXLEN(&ifp->if_snd, ifqmaxlen);
> +       IFQ_SET_READY(&ifp->if_snd);
>         /* We need to play some tricks here for the second interface. */
>         strlcpy(name, epairname, len);
>         error =3D if_clone_create(name, len, (caddr_t)scb);
>
>
>
> On Wed, Mar 22, 2017 at 11:44 PM, Ermal Lu=C3=A7i <eri@freebsd.org> wrote=
:
>>
>>>
>>> On Wed, Mar 22, 2017 at 10:50 AM, =C3=96zkan KIRIK <ozkan.kirik@gmail.c=
om>
>>> wrote:
>>>
>>>> Sorry, I mistested on 10.3RELENG.
>>>> it works on 11  RELENG, But at 10.3RELENG it throws
>>>>
>>>> /usr/src/sys/modules/if_epair/../../net/if_epair.c:830:2: error:
>>>> implicit declaration of function 'if_setstartfn' is invalid in C99
>>>> [-Werror,-Wimplicit-function-declaration]
>>>>
>>>>
>>>> On Wed, Mar 22, 2017 at 8:18 PM, =C3=96zkan KIRIK <ozkan.kirik@gmail.c=
om>
>>>> wrote:
>>>>
>>>>> Thank You Ermal !
>>>>>
>>>>> It works perfectly, can you commit this patch to 11.0 RELENG and MFC
>>>>> to 10.3 RELENG ?
>>>>>
>>>>>
>>> Thanks, for confirming that it fixes your issues.
>>> Yeah, on 10.3 its almost the same fix i will deal with it.
>>>
>>>
>>>> Regards
>>>>>
>>>>> On Wed, Mar 22, 2017 at 6:59 AM, Ermal Lu=C3=A7i <eri@freebsd.org> wr=
ote:
>>>>>
>>>>>>
>>>>>>
>>>>>> On Tue, Mar 21, 2017 at 5:26 AM, =C3=96zkan KIRIK <ozkan.kirik@gmail=
.com>
>>>>>> wrote:
>>>>>>
>>>>>>> Hello,
>>>>>>>
>>>>>>> I sent this email also to  freebsd-pf list. But I think that the ma=
in
>>>>>>> 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/m
>>>>>>> an.cgi?query=3Daltq#end>*
>>>>>>>
>>>>>>>      The driver modifications described in altq(9)
>>>>>>> <https://www.freebsd.org/cgi/man.cgi?query=3Daltq&sektion=3D9&ap
>>>>>>> ropos=3D0&manpath=3DFreeBSD+11.0-RELEASE+and+Ports>
>>>>>>> are required    to use a cer-
>>>>>>>      tain network card with *ALTQ*.  They       have been applied t=
o
>>>>>>> the following
>>>>>>>      hardware drivers: ae(4)
>>>>>>> <https://www.freebsd.org/cgi/man.cgi?query=3Dae&sektion=3D4&apro
>>>>>>> pos=3D0&manpath=3DFreeBSD+11.0-RELEASE+and+Ports>,
>>>>>>> age(4) <https://www.freebsd.org/cgi/man.cgi?query=3Dage&sektion=3D4=
&apr
>>>>>>> opos=3D0&manpath=3DFreeBSD+11.0-RELEASE+and+Ports>,
>>>>>>> alc(4) <https://www.freebsd.org/cgi/man.cgi?query=3Dalc&sektion=3D4=
&apr
>>>>>>> opos=3D0&manpath=3DFreeBSD+11.0-RELEASE+and+Ports>,
>>>>>>> ale(4) <https://www.freebsd.org/cgi/man.cgi?query=3Dale&sektion=3D4=
&apr
>>>>>>> opos=3D0&manpath=3DFreeBSD+11.0-RELEASE+and+Ports>,
>>>>>>> an(4) <https://www.freebsd.org/cgi/man.cgi?query=3Dan&sektion=3D4&a=
pro
>>>>>>> pos=3D0&manpath=3DFreeBSD+11.0-RELEASE+and+Ports>,
>>>>>>> ath(4) <https://www.freebsd.org/cgi/man.cgi?query=3Dath&sektion=3D4=
&apr
>>>>>>> opos=3D0&manpath=3DFreeBSD+11.0-RELEASE+and+Ports>,
>>>>>>> aue(4) <https://www.freebsd.org/cgi/man.cgi?query=3Daue&sektion=3D4=
&apr
>>>>>>> opos=3D0&manpath=3DFreeBSD+11.0-RELEASE+and+Ports>,
>>>>>>>      axe(4) <https://www.freebsd.org/cgi/m
>>>>>>> an.cgi?query=3Daxe&sektion=3D4&apropos=3D0&manpath=3DFreeBSD+11.0-R=
E
>>>>>>> LEASE+and+Ports>,
>>>>>>> bce(4) <https://www.freebsd.org/cgi/man.cgi?query=3Dbce&sektion=3D4=
&apr
>>>>>>> opos=3D0&manpath=3DFreeBSD+11.0-RELEASE+and+Ports>,
>>>>>>> bfe(4) <https://www.freebsd.org/cgi/man.cgi?query=3Dbfe&sektion=3D4=
&apr
>>>>>>> opos=3D0&manpath=3DFreeBSD+11.0-RELEASE+and+Ports>,
>>>>>>> bge(4) <https://www.freebsd.org/cgi/man.cgi?query=3Dbge&sektion=3D4=
&apr
>>>>>>> opos=3D0&manpath=3DFreeBSD+11.0-RELEASE+and+Ports>,
>>>>>>> bxe(4) <https://www.freebsd.org/cgi/man.cgi?query=3Dbxe&sektion=3D4=
&apr
>>>>>>> opos=3D0&manpath=3DFreeBSD+11.0-RELEASE+and+Ports>,
>>>>>>> cas(4) <https://www.freebsd.org/cgi/man.cgi?query=3Dcas&sektion=3D4=
&apr
>>>>>>> opos=3D0&manpath=3DFreeBSD+11.0-RELEASE+and+Ports>,
>>>>>>> cxgbe(4) <https://www.freebsd.org/cgi/m
>>>>>>> an.cgi?query=3Dcxgbe&sektion=3D4&apropos=3D0&manpath=3DFreeBSD+11.0=
-
>>>>>>> RELEASE+and+Ports>,
>>>>>>> dc(4) <https://www.freebsd.org/cgi/man.cgi?query=3Ddc&sektion=3D4&a=
pro
>>>>>>> pos=3D0&manpath=3DFreeBSD+11.0-RELEASE+and+Ports>,
>>>>>>> de(4) <https://www.freebsd.org/cgi/man.cgi?query=3Dde&sektion=3D4&a=
pro
>>>>>>> pos=3D0&manpath=3DFreeBSD+11.0-RELEASE+and+Ports>,
>>>>>>>      ed(4) <https://www.freebsd.org/cgi/m
>>>>>>> an.cgi?query=3Ded&sektion=3D4&apropos=3D0&manpath=3DFreeBSD+11.0-RE=
L
>>>>>>> EASE+and+Ports>,
>>>>>>> em(4) <https://www.freebsd.org/cgi/man.cgi?query=3Dem&sektion=3D4&a=
pro
>>>>>>> pos=3D0&manpath=3DFreeBSD+11.0-RELEASE+and+Ports>,
>>>>>>> ep(4) <https://www.freebsd.org/cgi/man.cgi?query=3Dep&sektion=3D4&a=
pro
>>>>>>> pos=3D0&manpath=3DFreeBSD+11.0-RELEASE+and+Ports>,
>>>>>>> epair(4) <https://www.freebsd.org/cgi/m
>>>>>>> an.cgi?query=3Depair&sektion=3D4&apropos=3D0&manpath=3DFreeBSD+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 +=3D len;
>>>>>>>  524                         if (mflags & (M_BCAST|M_MCAST))
>>>>>>>  525                                 ifp->if_omcasts++;
>>>>>>>  526
>>>>>>>  527                         if ((ifp->if_drv_flags &
>>>>>>> IFF_DRV_OACTIVE) =3D=3D 0)
>>>>>>>  528                                 epair_start_locked(ifp);
>>>>>>>  529                         else
>>>>>>>  530                                 (void)epair_add_ifp_for_drain
>>>>>>> ing(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 =3D IFCAP_VLAN_MTU;
>>>>>>         ifp->if_capenable =3D IFCAP_VLAN_MTU;
>>>>>>         ifp->if_start =3D epair_start;
>>>>>> +       if_setstartfn(ifp, epair_start);
>>>>>> +       if_setsendqlen(ifp, ifqmaxlen);
>>>>>> +       if_setsendqready(ifp);
>>>>>>         ifp->if_ioctl =3D epair_ioctl;
>>>>>>         ifp->if_init  =3D epair_init;
>>>>>> -       ifp->if_snd.ifq_maxlen =3D ifqmaxlen;
>>>>>>         /* Assign a hopefully unique, locally administered etheraddr=
.
>>>>>> */
>>>>>>         eaddr[0] =3D 0x02;
>>>>>>         eaddr[3] =3D (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 =3D IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAS=
T;
>>>>>>         ifp->if_capabilities =3D IFCAP_VLAN_MTU;
>>>>>>         ifp->if_capenable =3D IFCAP_VLAN_MTU;
>>>>>> -       ifp->if_start =3D epair_start;
>>>>>> +       if_setstartfn(ifp, epair_start);
>>>>>> +       if_setsendqlen(ifp, ifqmaxlen);
>>>>>> +       if_setsendqready(ifp);
>>>>>>         ifp->if_ioctl =3D epair_ioctl;
>>>>>>         ifp->if_init  =3D epair_init;
>>>>>> -       ifp->if_snd.ifq_maxlen =3D ifqmaxlen;
>>>>>>         /* We need to play some tricks here for the second interface=
.
>>>>>> */
>>>>>>         strlcpy(name, epairname, len);
>>>>>>         error =3D if_clone_create(name, len, (caddr_t)scb);
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>> I have no idea that why it says that it doesn't support altq altoug=
h
>>>>>>> the
>>>>>>> source code contains ALTQ section.
>>>>>>>
>>>>>>>
>>>>>>> Regards
>>>>>>> =C3=96zkan KIRIK
>>>>>>> _______________________________________________
>>>>>>> freebsd-net@freebsd.org mailing list
>>>>>>> https://lists.freebsd.org/mailman/listinfo/freebsd-net
>>>>>>> To unsubscribe, send any mail to "freebsd-net-unsubscribe@freeb
>>>>>>> sd.org"
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Ermal
>>>>>>
>>>>>
>>>>>
>>>>
>>>
>>>
>>> --
>>> Ermal
>>>
>>
>>
>
>
> --
> Ermal
>