Re: svn commit: r198845 - head/sys/netinet/ipfw

2009-11-03 Thread Oleg Bulyzhin
On Tue, Nov 03, 2009 at 08:41:14AM +, Oleg Bulyzhin wrote:
> Author: oleg
> Date: Tue Nov  3 08:41:14 2009
> New Revision: 198845
> URL: http://svn.freebsd.org/changeset/base/198845
> 
> Log:
>   Fix two issues that can lead to exceeding configured pipe bandwidth:
>   - do not expire queues which are not ready to be expired.
>   - properly calculate available burst size.
>   
>   MFC after:  3 days
> 
> Modified:
>   head/sys/netinet/ipfw/ip_dummynet.c


Reviews are welcome, since i'm going to push this into 8.0-RELEASE.
Thanks.

-- 
Oleg.

====
=== Oleg Bulyzhin -- OBUL-RIPN -- OBUL-RIPE -- o...@rinet.ru ===


___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r198845 - head/sys/netinet/ipfw

2009-11-03 Thread Oleg Bulyzhin
Author: oleg
Date: Tue Nov  3 08:41:14 2009
New Revision: 198845
URL: http://svn.freebsd.org/changeset/base/198845

Log:
  Fix two issues that can lead to exceeding configured pipe bandwidth:
  - do not expire queues which are not ready to be expired.
  - properly calculate available burst size.
  
  MFC after:3 days

Modified:
  head/sys/netinet/ipfw/ip_dummynet.c

Modified: head/sys/netinet/ipfw/ip_dummynet.c
==
--- head/sys/netinet/ipfw/ip_dummynet.c Tue Nov  3 07:29:58 2009
(r198844)
+++ head/sys/netinet/ipfw/ip_dummynet.c Tue Nov  3 08:41:14 2009
(r198845)
@@ -244,6 +244,17 @@ void   dummynet_drain(void);
 static int dummynet_io(struct mbuf **, int , struct ip_fw_args *);
 
 /*
+ * Flow queue is idle if:
+ *   1) it's empty for at least 1 tick
+ *   2) it has invalid timestamp (WF2Q case)
+ *   3) parent pipe has no 'exhausted' burst.
+ */
+#define QUEUE_IS_IDLE(q) ((q)->head == NULL && (q)->S == (q)->F + 1 && \
+   curr_time > (q)->idle_time + 1 && \
+   ((q)->numbytes + (curr_time - (q)->idle_time - 1) * \
+   (q)->fs->pipe->bandwidth >= q->fs->pipe->burst))
+
+/*
  * Heap management functions.
  *
  * In the heap, first node is element 0. Children of i are 2i+1 and 2i+2.
@@ -1004,7 +1015,7 @@ expire_queues(struct dn_flow_set *fs)
 fs->last_expired = time_uptime ;
 for (i = 0 ; i <= fs->rq_size ; i++) /* last one is overflow */
for (prev=NULL, q = fs->rq[i] ; q != NULL ; )
-   if (q->head != NULL || q->S != q->F+1) {
+   if (!QUEUE_IS_IDLE(q)) {
prev = q ;
q = q->next ;
} else { /* entry is idle, expire it */
@@ -1134,7 +1145,7 @@ find_queue(struct dn_flow_set *fs, struc
break ; /* found */
 
/* No match. Check if we can expire the entry */
-   if (pipe_expire && q->head == NULL && q->S == q->F+1 ) {
+   if (pipe_expire && QUEUE_IS_IDLE(q)) {
/* entry is idle and not in any heap, expire it */
struct dn_flow_queue *old_q = q ;
 
@@ -1408,7 +1419,7 @@ dummynet_io(struct mbuf **m0, int dir, s
if (q->idle_time < curr_time) {
/* Calculate available burst size. */
q->numbytes +=
-   (curr_time - q->idle_time) * pipe->bandwidth;
+   (curr_time - q->idle_time - 1) * pipe->bandwidth;
if (q->numbytes > pipe->burst)
q->numbytes = pipe->burst;
if (io_fast)
@@ -1418,8 +1429,8 @@ dummynet_io(struct mbuf **m0, int dir, s
if (pipe->idle_time < curr_time) {
/* Calculate available burst size. */
pipe->numbytes +=
-   (curr_time - pipe->idle_time) * pipe->bandwidth;
-   if (pipe->numbytes > pipe->burst)
+   (curr_time - pipe->idle_time - 1) * pipe->bandwidth;
+   if (pipe->numbytes > 0 && pipe->numbytes > pipe->burst)
pipe->numbytes = pipe->burst;
if (io_fast)
pipe->numbytes += pipe->bandwidth;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r199073 - head/sys/netinet/ipfw

2009-11-09 Thread Oleg Bulyzhin
Author: oleg
Date: Mon Nov  9 09:12:45 2009
New Revision: 199073
URL: http://svn.freebsd.org/changeset/base/199073

Log:
  style(9): add missing parentheses

Modified:
  head/sys/netinet/ipfw/ip_dummynet.c

Modified: head/sys/netinet/ipfw/ip_dummynet.c
==
--- head/sys/netinet/ipfw/ip_dummynet.c Mon Nov  9 08:54:47 2009
(r199072)
+++ head/sys/netinet/ipfw/ip_dummynet.c Mon Nov  9 09:12:45 2009
(r199073)
@@ -252,7 +252,7 @@ static int  dummynet_io(struct mbuf **, i
 #define QUEUE_IS_IDLE(q) ((q)->head == NULL && (q)->S == (q)->F + 1 && \
curr_time > (q)->idle_time + 1 && \
((q)->numbytes + (curr_time - (q)->idle_time - 1) * \
-   (q)->fs->pipe->bandwidth >= q->fs->pipe->burst))
+   (q)->fs->pipe->bandwidth >= (q)->fs->pipe->burst))
 
 /*
  * Heap management functions.
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r199075 - stable/8/sys/netinet/ipfw

2009-11-09 Thread Oleg Bulyzhin
Author: oleg
Date: Mon Nov  9 10:13:24 2009
New Revision: 199075
URL: http://svn.freebsd.org/changeset/base/199075

Log:
  MFC r198845:
  Fix two issues that can lead to exceeding configured pipe bandwidth:
  - do not expire queues which are not ready to be expired.
  - properly calculate available burst size.
  
  MFC r199073:
  style(9): add missing parentheses

Modified:
  stable/8/sys/netinet/ipfw/ip_dummynet.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/netinet/ipfw/ip_dummynet.c
==
--- stable/8/sys/netinet/ipfw/ip_dummynet.c Mon Nov  9 09:27:09 2009
(r199074)
+++ stable/8/sys/netinet/ipfw/ip_dummynet.c Mon Nov  9 10:13:24 2009
(r199075)
@@ -244,6 +244,17 @@ void   dummynet_drain(void);
 static int dummynet_io(struct mbuf **, int , struct ip_fw_args *);
 
 /*
+ * Flow queue is idle if:
+ *   1) it's empty for at least 1 tick
+ *   2) it has invalid timestamp (WF2Q case)
+ *   3) parent pipe has no 'exhausted' burst.
+ */
+#define QUEUE_IS_IDLE(q) ((q)->head == NULL && (q)->S == (q)->F + 1 && \
+   curr_time > (q)->idle_time + 1 && \
+   ((q)->numbytes + (curr_time - (q)->idle_time - 1) * \
+   (q)->fs->pipe->bandwidth >= (q)->fs->pipe->burst))
+
+/*
  * Heap management functions.
  *
  * In the heap, first node is element 0. Children of i are 2i+1 and 2i+2.
@@ -1004,7 +1015,7 @@ expire_queues(struct dn_flow_set *fs)
 fs->last_expired = time_uptime ;
 for (i = 0 ; i <= fs->rq_size ; i++) /* last one is overflow */
for (prev=NULL, q = fs->rq[i] ; q != NULL ; )
-   if (q->head != NULL || q->S != q->F+1) {
+   if (!QUEUE_IS_IDLE(q)) {
prev = q ;
q = q->next ;
} else { /* entry is idle, expire it */
@@ -1134,7 +1145,7 @@ find_queue(struct dn_flow_set *fs, struc
break ; /* found */
 
/* No match. Check if we can expire the entry */
-   if (pipe_expire && q->head == NULL && q->S == q->F+1 ) {
+   if (pipe_expire && QUEUE_IS_IDLE(q)) {
/* entry is idle and not in any heap, expire it */
struct dn_flow_queue *old_q = q ;
 
@@ -1408,7 +1419,7 @@ dummynet_io(struct mbuf **m0, int dir, s
if (q->idle_time < curr_time) {
/* Calculate available burst size. */
q->numbytes +=
-   (curr_time - q->idle_time) * pipe->bandwidth;
+   (curr_time - q->idle_time - 1) * pipe->bandwidth;
if (q->numbytes > pipe->burst)
q->numbytes = pipe->burst;
if (io_fast)
@@ -1418,8 +1429,8 @@ dummynet_io(struct mbuf **m0, int dir, s
if (pipe->idle_time < curr_time) {
/* Calculate available burst size. */
pipe->numbytes +=
-   (curr_time - pipe->idle_time) * pipe->bandwidth;
-   if (pipe->numbytes > pipe->burst)
+   (curr_time - pipe->idle_time - 1) * pipe->bandwidth;
+   if (pipe->numbytes > 0 && pipe->numbytes > pipe->burst)
pipe->numbytes = pipe->burst;
if (io_fast)
pipe->numbytes += pipe->bandwidth;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r216730 - stable/8/sys/net

2010-12-26 Thread Oleg Bulyzhin
Author: oleg
Date: Mon Dec 27 06:59:59 2010
New Revision: 216730
URL: http://svn.freebsd.org/changeset/base/216730

Log:
  MFC r203548:
  
  Propagate the vlan events to the underlying interfaces/members so they
  can do initialization of hw related features.
  
  PR:   kern/141646

Modified:
  stable/8/sys/net/if_lagg.c
  stable/8/sys/net/if_lagg.h
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)

Modified: stable/8/sys/net/if_lagg.c
==
--- stable/8/sys/net/if_lagg.c  Mon Dec 27 05:47:24 2010(r216729)
+++ stable/8/sys/net/if_lagg.c  Mon Dec 27 06:59:59 2010(r216730)
@@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -204,6 +205,50 @@ static moduledata_t lagg_mod = {
 
 DECLARE_MODULE(if_lagg, lagg_mod, SI_SUB_PSEUDO, SI_ORDER_ANY);
 
+#if __FreeBSD_version >= 80
+/*
+ * This routine is run via an vlan
+ * config EVENT
+ */
+static void
+lagg_register_vlan(void *arg, struct ifnet *ifp, u_int16_t vtag)
+{
+struct lagg_softc   *sc = ifp->if_softc;
+struct lagg_port*lp;
+
+if (ifp->if_softc !=  arg)   /* Not our event */
+return;
+
+LAGG_RLOCK(sc);
+if (!SLIST_EMPTY(&sc->sc_ports)) {
+SLIST_FOREACH(lp, &sc->sc_ports, lp_entries)
+EVENTHANDLER_INVOKE(vlan_config, lp->lp_ifp, vtag);
+}
+LAGG_RUNLOCK(sc);
+}
+
+/*
+ * This routine is run via an vlan
+ * unconfig EVENT
+ */
+static void
+lagg_unregister_vlan(void *arg, struct ifnet *ifp, u_int16_t vtag)
+{
+struct lagg_softc   *sc = ifp->if_softc;
+struct lagg_port*lp;
+
+if (ifp->if_softc !=  arg)   /* Not our event */
+return;
+
+LAGG_RLOCK(sc);
+if (!SLIST_EMPTY(&sc->sc_ports)) {
+SLIST_FOREACH(lp, &sc->sc_ports, lp_entries)
+EVENTHANDLER_INVOKE(vlan_unconfig, lp->lp_ifp, vtag);
+}
+LAGG_RUNLOCK(sc);
+}
+#endif
+
 static int
 lagg_clone_create(struct if_clone *ifc, int unit, caddr_t params)
 {
@@ -259,6 +304,13 @@ lagg_clone_create(struct if_clone *ifc, 
 */
ether_ifattach(ifp, eaddr);
 
+#if __FreeBSD_version >= 80
+   sc->vlan_attach = EVENTHANDLER_REGISTER(vlan_config,
+   lagg_register_vlan, sc, EVENTHANDLER_PRI_FIRST);
+   sc->vlan_detach = EVENTHANDLER_REGISTER(vlan_unconfig,
+   lagg_unregister_vlan, sc, EVENTHANDLER_PRI_FIRST);
+#endif
+
/* Insert into the global list of laggs */
mtx_lock(&lagg_list_mtx);
SLIST_INSERT_HEAD(&lagg_list, sc, sc_entries);
@@ -278,6 +330,11 @@ lagg_clone_destroy(struct ifnet *ifp)
lagg_stop(sc);
ifp->if_flags &= ~IFF_UP;
 
+#if __FreeBSD_version >= 80
+   EVENTHANDLER_DEREGISTER(vlan_config, sc->vlan_attach);
+   EVENTHANDLER_DEREGISTER(vlan_unconfig, sc->vlan_detach);
+#endif
+
/* Shutdown and remove lagg ports */
while ((lp = SLIST_FIRST(&sc->sc_ports)) != NULL)
lagg_port_destroy(lp, 1);

Modified: stable/8/sys/net/if_lagg.h
==
--- stable/8/sys/net/if_lagg.h  Mon Dec 27 05:47:24 2010(r216729)
+++ stable/8/sys/net/if_lagg.h  Mon Dec 27 06:59:59 2010(r216730)
@@ -198,6 +198,10 @@ struct lagg_softc {
void(*sc_lladdr)(struct lagg_softc *);
void(*sc_req)(struct lagg_softc *, caddr_t);
void(*sc_portreq)(struct lagg_port *, caddr_t);
+#if __FreeBSD_version >= 80
+   eventhandler_tag vlan_attach;
+   eventhandler_tag vlan_detach;
+#endif
 };
 
 struct lagg_port {
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r216741 - releng/8.2/sys/net

2010-12-27 Thread Oleg Bulyzhin
Author: oleg
Date: Mon Dec 27 18:55:16 2010
New Revision: 216741
URL: http://svn.freebsd.org/changeset/base/216741

Log:
  MFC r203548:
  
  Propagate the vlan events to the underlying interfaces/members so they
  can do initialization of hw related features.
  
  PR:   kern/141646
  Approved by:  re (bz)

Modified:
  releng/8.2/sys/net/if_lagg.c
  releng/8.2/sys/net/if_lagg.h
Directory Properties:
  releng/8.2/sys/   (props changed)
  releng/8.2/sys/amd64/include/xen/   (props changed)
  releng/8.2/sys/cddl/contrib/opensolaris/   (props changed)
  releng/8.2/sys/contrib/dev/acpica/   (props changed)
  releng/8.2/sys/contrib/pf/   (props changed)

Modified: releng/8.2/sys/net/if_lagg.c
==
--- releng/8.2/sys/net/if_lagg.cMon Dec 27 16:02:14 2010
(r216740)
+++ releng/8.2/sys/net/if_lagg.cMon Dec 27 18:55:16 2010
(r216741)
@@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -204,6 +205,50 @@ static moduledata_t lagg_mod = {
 
 DECLARE_MODULE(if_lagg, lagg_mod, SI_SUB_PSEUDO, SI_ORDER_ANY);
 
+#if __FreeBSD_version >= 80
+/*
+ * This routine is run via an vlan
+ * config EVENT
+ */
+static void
+lagg_register_vlan(void *arg, struct ifnet *ifp, u_int16_t vtag)
+{
+struct lagg_softc   *sc = ifp->if_softc;
+struct lagg_port*lp;
+
+if (ifp->if_softc !=  arg)   /* Not our event */
+return;
+
+LAGG_RLOCK(sc);
+if (!SLIST_EMPTY(&sc->sc_ports)) {
+SLIST_FOREACH(lp, &sc->sc_ports, lp_entries)
+EVENTHANDLER_INVOKE(vlan_config, lp->lp_ifp, vtag);
+}
+LAGG_RUNLOCK(sc);
+}
+
+/*
+ * This routine is run via an vlan
+ * unconfig EVENT
+ */
+static void
+lagg_unregister_vlan(void *arg, struct ifnet *ifp, u_int16_t vtag)
+{
+struct lagg_softc   *sc = ifp->if_softc;
+struct lagg_port*lp;
+
+if (ifp->if_softc !=  arg)   /* Not our event */
+return;
+
+LAGG_RLOCK(sc);
+if (!SLIST_EMPTY(&sc->sc_ports)) {
+SLIST_FOREACH(lp, &sc->sc_ports, lp_entries)
+EVENTHANDLER_INVOKE(vlan_unconfig, lp->lp_ifp, vtag);
+}
+LAGG_RUNLOCK(sc);
+}
+#endif
+
 static int
 lagg_clone_create(struct if_clone *ifc, int unit, caddr_t params)
 {
@@ -259,6 +304,13 @@ lagg_clone_create(struct if_clone *ifc, 
 */
ether_ifattach(ifp, eaddr);
 
+#if __FreeBSD_version >= 80
+   sc->vlan_attach = EVENTHANDLER_REGISTER(vlan_config,
+   lagg_register_vlan, sc, EVENTHANDLER_PRI_FIRST);
+   sc->vlan_detach = EVENTHANDLER_REGISTER(vlan_unconfig,
+   lagg_unregister_vlan, sc, EVENTHANDLER_PRI_FIRST);
+#endif
+
/* Insert into the global list of laggs */
mtx_lock(&lagg_list_mtx);
SLIST_INSERT_HEAD(&lagg_list, sc, sc_entries);
@@ -278,6 +330,11 @@ lagg_clone_destroy(struct ifnet *ifp)
lagg_stop(sc);
ifp->if_flags &= ~IFF_UP;
 
+#if __FreeBSD_version >= 80
+   EVENTHANDLER_DEREGISTER(vlan_config, sc->vlan_attach);
+   EVENTHANDLER_DEREGISTER(vlan_unconfig, sc->vlan_detach);
+#endif
+
/* Shutdown and remove lagg ports */
while ((lp = SLIST_FIRST(&sc->sc_ports)) != NULL)
lagg_port_destroy(lp, 1);

Modified: releng/8.2/sys/net/if_lagg.h
==
--- releng/8.2/sys/net/if_lagg.hMon Dec 27 16:02:14 2010
(r216740)
+++ releng/8.2/sys/net/if_lagg.hMon Dec 27 18:55:16 2010
(r216741)
@@ -198,6 +198,10 @@ struct lagg_softc {
void(*sc_lladdr)(struct lagg_softc *);
void(*sc_req)(struct lagg_softc *, caddr_t);
void(*sc_portreq)(struct lagg_port *, caddr_t);
+#if __FreeBSD_version >= 80
+   eventhandler_tag vlan_attach;
+   eventhandler_tag vlan_detach;
+#endif
 };
 
 struct lagg_port {
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r216757 - stable/8/sys/netinet/ipfw

2010-12-28 Thread Oleg Bulyzhin
Author: oleg
Date: Tue Dec 28 11:34:59 2010
New Revision: 216757
URL: http://svn.freebsd.org/changeset/base/216757

Log:
  MFC r213265:
  
  Fix handling of initial credit for an idle pipe.  This fixes the bug where
  setting bw > 1 MTU/tick resulted in infinite bandwidth if io_fast=1
  
  PR:   kern/147245, kern/148429
  Obtained from:Riccardo Panicucci

Modified:
  stable/8/sys/netinet/ipfw/ip_dn_io.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)

Modified: stable/8/sys/netinet/ipfw/ip_dn_io.c
==
--- stable/8/sys/netinet/ipfw/ip_dn_io.cTue Dec 28 10:08:50 2010
(r216756)
+++ stable/8/sys/netinet/ipfw/ip_dn_io.cTue Dec 28 11:34:59 2010
(r216757)
@@ -742,8 +742,11 @@ dummynet_io(struct mbuf **m0, int dir, s
}
 
/* compute the initial allowance */
-   {
+   if (si->idle_time < dn_cfg.curr_time) {
+   /* Do this only on the first packet on an idle pipe */
struct dn_link *p = &fs->sched->link;
+
+   si->sched_time = dn_cfg.curr_time;
si->credit = dn_cfg.io_fast ? p->bandwidth : 0;
if (p->burst) {
uint64_t burst = (dn_cfg.curr_time - si->idle_time) * 
p->bandwidth;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r216759 - releng/8.2/sys/netinet/ipfw

2010-12-28 Thread Oleg Bulyzhin
Author: oleg
Date: Tue Dec 28 12:18:46 2010
New Revision: 216759
URL: http://svn.freebsd.org/changeset/base/216759

Log:
  MFC r213265:
  
  Fix handling of initial credit for an idle pipe.  This fixes the bug where
  setting bw > 1 MTU/tick resulted in infinite bandwidth if io_fast=1
  
  PR:   kern/147245, kern/148429
  Obtained from:Riccardo Panicucci
  Approved by:  re (bz)

Modified:
  releng/8.2/sys/netinet/ipfw/ip_dn_io.c
Directory Properties:
  releng/8.2/sys/   (props changed)
  releng/8.2/sys/amd64/include/xen/   (props changed)
  releng/8.2/sys/cddl/contrib/opensolaris/   (props changed)
  releng/8.2/sys/contrib/dev/acpica/   (props changed)
  releng/8.2/sys/contrib/pf/   (props changed)

Modified: releng/8.2/sys/netinet/ipfw/ip_dn_io.c
==
--- releng/8.2/sys/netinet/ipfw/ip_dn_io.c  Tue Dec 28 12:13:30 2010
(r216758)
+++ releng/8.2/sys/netinet/ipfw/ip_dn_io.c  Tue Dec 28 12:18:46 2010
(r216759)
@@ -742,8 +742,11 @@ dummynet_io(struct mbuf **m0, int dir, s
}
 
/* compute the initial allowance */
-   {
+   if (si->idle_time < dn_cfg.curr_time) {
+   /* Do this only on the first packet on an idle pipe */
struct dn_link *p = &fs->sched->link;
+
+   si->sched_time = dn_cfg.curr_time;
si->credit = dn_cfg.io_fast ? p->bandwidth : 0;
if (p->burst) {
uint64_t burst = (dn_cfg.curr_time - si->idle_time) * 
p->bandwidth;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r190865 - in head: sbin/ipfw sys/netinet

2009-04-15 Thread Oleg Bulyzhin

Converting numbytes (struct dn_pipe) to dn_key (which is uint64_t) may break
WFQ.  ready_event_wfq() code depends on signed 'numbytes'. 

P.S. i vote for modifing ready_event_wfq() to deal with unsigned numbytes.

-- 
Oleg.

====
=== Oleg Bulyzhin -- OBUL-RIPN -- OBUL-RIPE -- o...@rinet.ru ===


___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r191570 - head/sys/netinet

2009-04-27 Thread Oleg Bulyzhin
Author: oleg
Date: Mon Apr 27 17:37:36 2009
New Revision: 191570
URL: http://svn.freebsd.org/changeset/base/191570

Log:
  Optimize packet flow: if net.inet.ip.fw.one_pass != 0 and packet was
  processed by ipfw once - avoid second ipfw_chk() call.
  This saves us from unnecessary IPFW_RLOCK(), m_tag_find() calls and
  ip/tcp/udp header parsing.
  
  MFC after:2 month

Modified:
  head/sys/netinet/ip_fw2.c
  head/sys/netinet/ip_fw_pfil.c

Modified: head/sys/netinet/ip_fw2.c
==
--- head/sys/netinet/ip_fw2.c   Mon Apr 27 17:36:41 2009(r191569)
+++ head/sys/netinet/ip_fw2.c   Mon Apr 27 17:37:36 2009(r191570)
@@ -2515,16 +2515,7 @@ do { 
\
/*
 * Packet has already been tagged. Look for the next rule
 * to restart processing.
-*
-* If fw_one_pass != 0 then just accept it.
-* XXX should not happen here, but optimized out in
-* the caller.
 */
-   if (V_fw_one_pass) {
-   IPFW_RUNLOCK(chain);
-   return (IP_FW_PASS);
-   }
-
f = args->rule->next_rule;
if (f == NULL)
f = lookup_next_rule(args->rule, 0);

Modified: head/sys/netinet/ip_fw_pfil.c
==
--- head/sys/netinet/ip_fw_pfil.c   Mon Apr 27 17:36:41 2009
(r191569)
+++ head/sys/netinet/ip_fw_pfil.c   Mon Apr 27 17:37:36 2009
(r191570)
@@ -51,7 +51,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-#define _NET_IF_VAR_H_ /* we don't want if_var.h, only if.h */
 #include 
 #include 
 #include 
@@ -63,6 +62,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -131,10 +131,14 @@ again:
 
args.m = *m0;
args.inp = inp;
-   ipfw = ipfw_chk(&args);
-   *m0 = args.m;
tee = 0;
 
+   if (V_fw_one_pass == 0 || args.rule == NULL) {
+   ipfw = ipfw_chk(&args);
+   *m0 = args.m;
+   } else
+   ipfw = IP_FW_PASS;
+   
KASSERT(*m0 != NULL || ipfw == IP_FW_DENY, ("%s: m0 is NULL",
__func__));
 
@@ -257,10 +261,14 @@ again:
args.m = *m0;
args.oif = ifp;
args.inp = inp;
-   ipfw = ipfw_chk(&args);
-   *m0 = args.m;
tee = 0;
 
+   if (V_fw_one_pass == 0 || args.rule == NULL) {
+   ipfw = ipfw_chk(&args);
+   *m0 = args.m;
+   } else
+   ipfw = IP_FW_PASS;
+
KASSERT(*m0 != NULL || ipfw == IP_FW_DENY, ("%s: m0 is NULL",
__func__));
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r253256 - head/sbin/recoverdisk

2013-07-12 Thread Oleg Bulyzhin
Author: oleg
Date: Fri Jul 12 09:20:55 2013
New Revision: 253256
URL: http://svnweb.freebsd.org/changeset/base/253256

Log:
  Fix 'SEE ALSO' list.

Modified:
  head/sbin/recoverdisk/recoverdisk.1

Modified: head/sbin/recoverdisk/recoverdisk.1
==
--- head/sbin/recoverdisk/recoverdisk.1 Fri Jul 12 08:03:10 2013
(r253255)
+++ head/sbin/recoverdisk/recoverdisk.1 Fri Jul 12 09:20:55 2013
(r253256)
@@ -125,9 +125,9 @@ recoverdisk -b 0 /dev/ad3 /somewhere
 .Ed
 .Sh SEE ALSO
 .Xr dd 1 ,
-.Xr ada 4,
-.Xr cam 4,
-.Xr cd 4,
+.Xr ada 4 ,
+.Xr cam 4 ,
+.Xr cd 4 ,
 .Xr da 4
 .Sh HISTORY
 The
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r249628 - head/sys/net

2013-04-18 Thread Oleg Bulyzhin
Author: oleg
Date: Thu Apr 18 20:13:33 2013
New Revision: 249628
URL: http://svnweb.freebsd.org/changeset/base/249628

Log:
  Recover missing arp_ifinit() call.
  
  MFC after:2 weeks

Modified:
  head/sys/net/if_vlan.c

Modified: head/sys/net/if_vlan.c
==
--- head/sys/net/if_vlan.c  Thu Apr 18 19:52:11 2013(r249627)
+++ head/sys/net/if_vlan.c  Thu Apr 18 20:13:33 2013(r249628)
@@ -41,6 +41,7 @@
 #include 
 __FBSDID("$FreeBSD$");
 
+#include "opt_inet.h"
 #include "opt_vlan.h"
 
 #include 
@@ -66,6 +67,11 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#ifdef INET
+#include 
+#include 
+#endif
+
 #defineVLAN_DEF_HWIDTH 4
 #defineVLAN_IFFLAGS(IFF_BROADCAST | IFF_MULTICAST)
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r249742 - in head/sys: netinet netinet6

2013-04-21 Thread Oleg Bulyzhin
Author: oleg
Date: Sun Apr 21 21:28:38 2013
New Revision: 249742
URL: http://svnweb.freebsd.org/changeset/base/249742

Log:
  Plug static llentry leak (ipv4 & ipv6 were affected).
  
  PR:   kern/172985
  MFC after:1 month

Modified:
  head/sys/netinet/in.c
  head/sys/netinet6/in6.c

Modified: head/sys/netinet/in.c
==
--- head/sys/netinet/in.c   Sun Apr 21 20:51:53 2013(r249741)
+++ head/sys/netinet/in.c   Sun Apr 21 21:28:38 2013(r249742)
@@ -1467,10 +1467,14 @@ in_lltable_lookup(struct lltable *llt, u
LLE_WLOCK(lle);
lle->la_flags |= LLE_DELETED;
EVENTHANDLER_INVOKE(lle_event, lle, LLENTRY_DELETED);
-   LLE_WUNLOCK(lle);
 #ifdef DIAGNOSTIC
-   log(LOG_INFO, "ifaddr cache = %p  is deleted\n", lle);
+   log(LOG_INFO, "ifaddr cache = %p is deleted\n", lle);
 #endif
+   if ((lle->la_flags &
+   (LLE_STATIC | LLE_IFADDR)) == LLE_STATIC)
+   llentry_free(lle);
+   else
+   LLE_WUNLOCK(lle);
}
lle = (void *)-1;
 

Modified: head/sys/netinet6/in6.c
==
--- head/sys/netinet6/in6.c Sun Apr 21 20:51:53 2013(r249741)
+++ head/sys/netinet6/in6.c Sun Apr 21 21:28:38 2013(r249742)
@@ -195,10 +195,10 @@ in6_ifremloop(struct ifaddr *ifa)
 
ia = ifa2ia6(ifa);
ifp = ifa->ifa_ifp;
-   IF_AFDATA_LOCK(ifp);
-   lla_lookup(LLTABLE6(ifp), (LLE_DELETE | LLE_IFADDR),
-   (struct sockaddr *)&ia->ia_addr);
-   IF_AFDATA_UNLOCK(ifp);
+   memcpy(&addr, &ia->ia_addr, sizeof(ia->ia_addr));
+   memcpy(&mask, &ia->ia_prefixmask, sizeof(ia->ia_prefixmask));
+   lltable_prefix_free(AF_INET6, (struct sockaddr *)&addr,
+   (struct sockaddr *)&mask, LLE_STATIC);
 
/*
 * initialize for rtmsg generation
@@ -210,8 +210,6 @@ in6_ifremloop(struct ifaddr *ifa)
gateway.sdl_alen = ifp->if_addrlen;
bzero(&rt0, sizeof(rt0));
rt0.rt_gateway = (struct sockaddr *)&gateway;
-   memcpy(&mask, &ia->ia_prefixmask, sizeof(ia->ia_prefixmask));
-   memcpy(&addr, &ia->ia_addr, sizeof(ia->ia_addr));
rt_mask(&rt0) = (struct sockaddr *)&mask;
rt_key(&rt0) = (struct sockaddr *)&addr;
rt0.rt_flags = RTF_HOST | RTF_STATIC;
@@ -2604,10 +2602,14 @@ in6_lltable_lookup(struct lltable *llt, 
if (!(lle->la_flags & LLE_IFADDR) || (flags & LLE_IFADDR)) {
LLE_WLOCK(lle);
lle->la_flags |= LLE_DELETED;
-   LLE_WUNLOCK(lle);
 #ifdef DIAGNOSTIC
-   log(LOG_INFO, "ifaddr cache = %p  is deleted\n", lle);
+   log(LOG_INFO, "ifaddr cache = %p is deleted\n", lle);
 #endif
+   if ((lle->la_flags &
+   (LLE_STATIC | LLE_IFADDR)) == LLE_STATIC)
+   llentry_free(lle);
+   else
+   LLE_WUNLOCK(lle);
}
lle = (void *)-1;
}
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r250927 - in stable/9/sys: net netinet netinet6

2013-05-23 Thread Oleg Bulyzhin
Author: oleg
Date: Thu May 23 11:29:28 2013
New Revision: 250927
URL: http://svnweb.freebsd.org/changeset/base/250927

Log:
  MFC: r249628, r249742
  
  - recover missing arp_ifinit() call.
  - plug static llentry leak (ipv4 & ipv6 were affected).
  
  PR:   kern/172985

Modified:
  stable/9/sys/net/if_vlan.c
  stable/9/sys/netinet/in.c
  stable/9/sys/netinet6/in6.c
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/net/if_vlan.c
==
--- stable/9/sys/net/if_vlan.c  Thu May 23 05:42:35 2013(r250926)
+++ stable/9/sys/net/if_vlan.c  Thu May 23 11:29:28 2013(r250927)
@@ -41,6 +41,7 @@
 #include 
 __FBSDID("$FreeBSD$");
 
+#include "opt_inet.h"
 #include "opt_vlan.h"
 
 #include 
@@ -66,6 +67,11 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#ifdef INET
+#include 
+#include 
+#endif
+
 #define VLANNAME   "vlan"
 #defineVLAN_DEF_HWIDTH 4
 #defineVLAN_IFFLAGS(IFF_BROADCAST | IFF_MULTICAST)

Modified: stable/9/sys/netinet/in.c
==
--- stable/9/sys/netinet/in.c   Thu May 23 05:42:35 2013(r250926)
+++ stable/9/sys/netinet/in.c   Thu May 23 11:29:28 2013(r250927)
@@ -1528,10 +1528,14 @@ in_lltable_lookup(struct lltable *llt, u
LLE_WLOCK(lle);
lle->la_flags |= LLE_DELETED;
EVENTHANDLER_INVOKE(arp_update_event, lle);
-   LLE_WUNLOCK(lle);
 #ifdef DIAGNOSTIC
-   log(LOG_INFO, "ifaddr cache = %p  is deleted\n", lle);
+   log(LOG_INFO, "ifaddr cache = %p is deleted\n", lle);
 #endif
+   if ((lle->la_flags &
+   (LLE_STATIC | LLE_IFADDR)) == LLE_STATIC)
+   llentry_free(lle);
+   else
+   LLE_WUNLOCK(lle);
}
lle = (void *)-1;
 

Modified: stable/9/sys/netinet6/in6.c
==
--- stable/9/sys/netinet6/in6.c Thu May 23 05:42:35 2013(r250926)
+++ stable/9/sys/netinet6/in6.c Thu May 23 11:29:28 2013(r250927)
@@ -194,10 +194,10 @@ in6_ifremloop(struct ifaddr *ifa)
 
ia = ifa2ia6(ifa);
ifp = ifa->ifa_ifp;
-   IF_AFDATA_LOCK(ifp);
-   lla_lookup(LLTABLE6(ifp), (LLE_DELETE | LLE_IFADDR),
-   (struct sockaddr *)&ia->ia_addr);
-   IF_AFDATA_UNLOCK(ifp);
+   memcpy(&addr, &ia->ia_addr, sizeof(ia->ia_addr));
+   memcpy(&mask, &ia->ia_prefixmask, sizeof(ia->ia_prefixmask));
+   lltable_prefix_free(AF_INET6, (struct sockaddr *)&addr,
+   (struct sockaddr *)&mask, LLE_STATIC);
 
/*
 * initialize for rtmsg generation
@@ -209,8 +209,6 @@ in6_ifremloop(struct ifaddr *ifa)
gateway.sdl_alen = ifp->if_addrlen;
bzero(&rt0, sizeof(rt0));
rt0.rt_gateway = (struct sockaddr *)&gateway;
-   memcpy(&mask, &ia->ia_prefixmask, sizeof(ia->ia_prefixmask));
-   memcpy(&addr, &ia->ia_addr, sizeof(ia->ia_addr));
rt_mask(&rt0) = (struct sockaddr *)&mask;
rt_key(&rt0) = (struct sockaddr *)&addr;
rt0.rt_flags = RTF_HOST | RTF_STATIC;
@@ -2581,10 +2579,14 @@ in6_lltable_lookup(struct lltable *llt, 
if (!(lle->la_flags & LLE_IFADDR) || (flags & LLE_IFADDR)) {
LLE_WLOCK(lle);
lle->la_flags |= LLE_DELETED;
-   LLE_WUNLOCK(lle);
 #ifdef DIAGNOSTIC
-   log(LOG_INFO, "ifaddr cache = %p  is deleted\n", lle);
+   log(LOG_INFO, "ifaddr cache = %p is deleted\n", lle);
 #endif
+   if ((lle->la_flags &
+   (LLE_STATIC | LLE_IFADDR)) == LLE_STATIC)
+   llentry_free(lle);
+   else
+   LLE_WUNLOCK(lle);
}
lle = (void *)-1;
}
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r258346 - stable/10/sys/dev/ixgbe

2013-11-19 Thread Oleg Bulyzhin
Author: oleg
Date: Tue Nov 19 14:24:25 2013
New Revision: 258346
URL: http://svnweb.freebsd.org/changeset/base/258346

Log:
  MFC: 257695
  
  - Fix link loss on vlan reconfiguration.
  - Fix issues with 'vlanhwfilter'.
  
  Approved by:  re (glebius)

Modified:
  stable/10/sys/dev/ixgbe/ixgbe.c
Directory Properties:
  stable/10/sys/   (props changed)

Modified: stable/10/sys/dev/ixgbe/ixgbe.c
==
--- stable/10/sys/dev/ixgbe/ixgbe.c Tue Nov 19 13:32:24 2013
(r258345)
+++ stable/10/sys/dev/ixgbe/ixgbe.c Tue Nov 19 14:24:25 2013
(r258346)
@@ -1253,9 +1253,6 @@ ixgbe_init_locked(struct adapter *adapte
IXGBE_WRITE_REG(hw, IXGBE_RDT(i), adapter->num_rx_desc - 1);
}
 
-   /* Set up VLAN support and filter */
-   ixgbe_setup_vlan_hw_support(adapter);
-
/* Enable Receive engine */
rxctrl = IXGBE_READ_REG(hw, IXGBE_RXCTRL);
if (hw->mac.type == ixgbe_mac_82598EB)
@@ -1339,6 +1336,9 @@ ixgbe_init_locked(struct adapter *adapte
/* Initialize the FC settings */
ixgbe_start_hw(hw);
 
+   /* Set up VLAN support and filter */
+   ixgbe_setup_vlan_hw_support(adapter);
+
/* And now turn on interrupts */
ixgbe_enable_intr(adapter);
 
@@ -4691,7 +4691,7 @@ ixgbe_register_vlan(void *arg, struct if
bit = vtag & 0x1F;
adapter->shadow_vfta[index] |= (1 << bit);
++adapter->num_vlans;
-   ixgbe_init_locked(adapter);
+   ixgbe_setup_vlan_hw_support(adapter);
IXGBE_CORE_UNLOCK(adapter);
 }
 
@@ -4718,7 +4718,7 @@ ixgbe_unregister_vlan(void *arg, struct 
adapter->shadow_vfta[index] &= ~(1 << bit);
--adapter->num_vlans;
/* Re-init to load the changes */
-   ixgbe_init_locked(adapter);
+   ixgbe_setup_vlan_hw_support(adapter);
IXGBE_CORE_UNLOCK(adapter);
 }
 
@@ -4740,6 +4740,20 @@ ixgbe_setup_vlan_hw_support(struct adapt
if (adapter->num_vlans == 0)
return;
 
+   /* Setup the queues for vlans */
+   for (int i = 0; i < adapter->num_queues; i++) {
+   rxr = &adapter->rx_rings[i];
+   /* On 82599 the VLAN enable is per/queue in RXDCTL */
+   if (hw->mac.type != ixgbe_mac_82598EB) {
+   ctrl = IXGBE_READ_REG(hw, IXGBE_RXDCTL(i));
+   ctrl |= IXGBE_RXDCTL_VME;
+   IXGBE_WRITE_REG(hw, IXGBE_RXDCTL(i), ctrl);
+   }
+   rxr->vtag_strip = TRUE;
+   }
+
+   if ((ifp->if_capenable & IFCAP_VLAN_HWFILTER) == 0)
+   return;
/*
** A soft reset zero's out the VFTA, so
** we need to repopulate it now.
@@ -4758,18 +4772,6 @@ ixgbe_setup_vlan_hw_support(struct adapt
if (hw->mac.type == ixgbe_mac_82598EB)
ctrl |= IXGBE_VLNCTRL_VME;
IXGBE_WRITE_REG(hw, IXGBE_VLNCTRL, ctrl);
-
-   /* Setup the queues for vlans */
-   for (int i = 0; i < adapter->num_queues; i++) {
-   rxr = &adapter->rx_rings[i];
-   /* On 82599 the VLAN enable is per/queue in RXDCTL */
-   if (hw->mac.type != ixgbe_mac_82598EB) {
-   ctrl = IXGBE_READ_REG(hw, IXGBE_RXDCTL(i));
-   ctrl |= IXGBE_RXDCTL_VME;
-   IXGBE_WRITE_REG(hw, IXGBE_RXDCTL(i), ctrl);
-   }
-   rxr->vtag_strip = TRUE;
-   }
 }
 
 static void
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r258346 - stable/10/sys/dev/ixgbe

2013-12-19 Thread Oleg Bulyzhin
On Mon, Dec 16, 2013 at 08:53:21PM +0400, Andrey V. Elsukov wrote:
> On 19.11.2013 18:24, Oleg Bulyzhin wrote:
> > Author: oleg
> > Date: Tue Nov 19 14:24:25 2013
> > New Revision: 258346
> > URL: http://svnweb.freebsd.org/changeset/base/258346
> > 
> > Log:
> >   MFC: 257695
> >   
> >   - Fix link loss on vlan reconfiguration.
> >   - Fix issues with 'vlanhwfilter'.
> 
> Hi, Oleg,
> 
> do you plan to merge this in stable/9 too?
> 
> -- 
> WBR, Andrey V. Elsukov

I didn't plan it (i'm still hoping jfv@ will fix it).

-- 
Oleg.


=== Oleg Bulyzhin -- OBUL-RIPN -- OBUL-RIPE -- o...@rinet.ru ===


___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r257695 - head/sys/dev/ixgbe

2013-11-05 Thread Oleg Bulyzhin
Author: oleg
Date: Tue Nov  5 09:46:01 2013
New Revision: 257695
URL: http://svnweb.freebsd.org/changeset/base/257695

Log:
  - Fix link loss on vlan reconfiguration.
  - Fix issues with 'vlanhwfilter'.
  
  MFC after:1 week
  Silence from: jfv 5 weeks

Modified:
  head/sys/dev/ixgbe/ixgbe.c

Modified: head/sys/dev/ixgbe/ixgbe.c
==
--- head/sys/dev/ixgbe/ixgbe.c  Tue Nov  5 09:30:06 2013(r257694)
+++ head/sys/dev/ixgbe/ixgbe.c  Tue Nov  5 09:46:01 2013(r257695)
@@ -1253,9 +1253,6 @@ ixgbe_init_locked(struct adapter *adapte
IXGBE_WRITE_REG(hw, IXGBE_RDT(i), adapter->num_rx_desc - 1);
}
 
-   /* Set up VLAN support and filter */
-   ixgbe_setup_vlan_hw_support(adapter);
-
/* Enable Receive engine */
rxctrl = IXGBE_READ_REG(hw, IXGBE_RXCTRL);
if (hw->mac.type == ixgbe_mac_82598EB)
@@ -1339,6 +1336,9 @@ ixgbe_init_locked(struct adapter *adapte
/* Initialize the FC settings */
ixgbe_start_hw(hw);
 
+   /* Set up VLAN support and filter */
+   ixgbe_setup_vlan_hw_support(adapter);
+
/* And now turn on interrupts */
ixgbe_enable_intr(adapter);
 
@@ -4688,7 +4688,7 @@ ixgbe_register_vlan(void *arg, struct if
bit = vtag & 0x1F;
adapter->shadow_vfta[index] |= (1 << bit);
++adapter->num_vlans;
-   ixgbe_init_locked(adapter);
+   ixgbe_setup_vlan_hw_support(adapter);
IXGBE_CORE_UNLOCK(adapter);
 }
 
@@ -4715,7 +4715,7 @@ ixgbe_unregister_vlan(void *arg, struct 
adapter->shadow_vfta[index] &= ~(1 << bit);
--adapter->num_vlans;
/* Re-init to load the changes */
-   ixgbe_init_locked(adapter);
+   ixgbe_setup_vlan_hw_support(adapter);
IXGBE_CORE_UNLOCK(adapter);
 }
 
@@ -4737,6 +4737,20 @@ ixgbe_setup_vlan_hw_support(struct adapt
if (adapter->num_vlans == 0)
return;
 
+   /* Setup the queues for vlans */
+   for (int i = 0; i < adapter->num_queues; i++) {
+   rxr = &adapter->rx_rings[i];
+   /* On 82599 the VLAN enable is per/queue in RXDCTL */
+   if (hw->mac.type != ixgbe_mac_82598EB) {
+   ctrl = IXGBE_READ_REG(hw, IXGBE_RXDCTL(i));
+   ctrl |= IXGBE_RXDCTL_VME;
+   IXGBE_WRITE_REG(hw, IXGBE_RXDCTL(i), ctrl);
+   }
+   rxr->vtag_strip = TRUE;
+   }
+
+   if ((ifp->if_capenable & IFCAP_VLAN_HWFILTER) == 0)
+   return;
/*
** A soft reset zero's out the VFTA, so
** we need to repopulate it now.
@@ -4755,18 +4769,6 @@ ixgbe_setup_vlan_hw_support(struct adapt
if (hw->mac.type == ixgbe_mac_82598EB)
ctrl |= IXGBE_VLNCTRL_VME;
IXGBE_WRITE_REG(hw, IXGBE_VLNCTRL, ctrl);
-
-   /* Setup the queues for vlans */
-   for (int i = 0; i < adapter->num_queues; i++) {
-   rxr = &adapter->rx_rings[i];
-   /* On 82599 the VLAN enable is per/queue in RXDCTL */
-   if (hw->mac.type != ixgbe_mac_82598EB) {
-   ctrl = IXGBE_READ_REG(hw, IXGBE_RXDCTL(i));
-   ctrl |= IXGBE_RXDCTL_VME;
-   IXGBE_WRITE_REG(hw, IXGBE_RXDCTL(i), ctrl);
-   }
-   rxr->vtag_strip = TRUE;
-   }
 }
 
 static void
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r257695 - head/sys/dev/ixgbe

2013-11-05 Thread Oleg Bulyzhin

Discussion is here:
http://lists.freebsd.org/pipermail/freebsd-stable/2013-September/075280.html

-- 
Oleg.


=== Oleg Bulyzhin -- OBUL-RIPN -- OBUL-RIPE -- o...@rinet.ru ===


___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r232272 - head/sys/netinet/ipfw

2012-02-28 Thread Oleg Bulyzhin
Author: oleg
Date: Tue Feb 28 21:53:39 2012
New Revision: 232272
URL: http://svn.freebsd.org/changeset/base/232272

Log:
  lookup_dyn_rule_locked(): style(9) cleanup
  
  MFC after:1 month

Modified:
  head/sys/netinet/ipfw/ip_fw_dynamic.c

Modified: head/sys/netinet/ipfw/ip_fw_dynamic.c
==
--- head/sys/netinet/ipfw/ip_fw_dynamic.c   Tue Feb 28 21:45:21 2012
(r232271)
+++ head/sys/netinet/ipfw/ip_fw_dynamic.c   Tue Feb 28 21:53:39 2012
(r232272)
@@ -390,72 +390,68 @@ ipfw_remove_dyn_children(struct ip_fw *r
IPFW_DYN_UNLOCK();
 }
 
-/**
- * lookup a dynamic rule, locked version
+/*
+ * Lookup a dynamic rule, locked version.
  */
 static ipfw_dyn_rule *
 lookup_dyn_rule_locked(struct ipfw_flow_id *pkt, int *match_direction,
 struct tcphdr *tcp)
 {
/*
-* stateful ipfw extensions.
-* Lookup into dynamic session queue
+* Stateful ipfw extensions.
+* Lookup into dynamic session queue.
 */
 #define MATCH_REVERSE  0
 #define MATCH_FORWARD  1
 #define MATCH_NONE 2
 #define MATCH_UNKNOWN  3
int i, dir = MATCH_NONE;
-   ipfw_dyn_rule *prev, *q=NULL;
+   ipfw_dyn_rule *prev, *q = NULL;
 
IPFW_DYN_LOCK_ASSERT();
 
if (V_ipfw_dyn_v == NULL)
-   goto done;  /* not found */
-   i = hash_packet( pkt );
-   for (prev=NULL, q = V_ipfw_dyn_v[i] ; q != NULL ; ) {
+   goto done;  /* not found */
+   i = hash_packet(pkt);
+   for (prev = NULL, q = V_ipfw_dyn_v[i]; q != NULL;) {
if (q->dyn_type == O_LIMIT_PARENT && q->count)
goto next;
-   if (TIME_LEQ( q->expire, time_uptime)) { /* expire entry */
+   if (TIME_LEQ(q->expire, time_uptime)) { /* expire entry */
UNLINK_DYN_RULE(prev, V_ipfw_dyn_v[i], q);
continue;
}
-   if (pkt->proto == q->id.proto &&
-   q->dyn_type != O_LIMIT_PARENT) {
-   if (IS_IP6_FLOW_ID(pkt)) {
-   if (IN6_ARE_ADDR_EQUAL(&(pkt->src_ip6),
-   &(q->id.src_ip6)) &&
-   IN6_ARE_ADDR_EQUAL(&(pkt->dst_ip6),
-   &(q->id.dst_ip6)) &&
+   if (pkt->proto != q->id.proto || q->dyn_type == O_LIMIT_PARENT)
+   goto next;
+
+   if (IS_IP6_FLOW_ID(pkt)) {
+   if (IN6_ARE_ADDR_EQUAL(&pkt->src_ip6, &q->id.src_ip6) &&
+   IN6_ARE_ADDR_EQUAL(&pkt->dst_ip6, &q->id.dst_ip6) &&
pkt->src_port == q->id.src_port &&
-   pkt->dst_port == q->id.dst_port ) {
+   pkt->dst_port == q->id.dst_port) {
dir = MATCH_FORWARD;
break;
-   }
-   if (IN6_ARE_ADDR_EQUAL(&(pkt->src_ip6),
-   &(q->id.dst_ip6)) &&
-   IN6_ARE_ADDR_EQUAL(&(pkt->dst_ip6),
-   &(q->id.src_ip6)) &&
-   pkt->src_port == q->id.dst_port &&
-   pkt->dst_port == q->id.src_port ) {
-   dir = MATCH_REVERSE;
-   break;
-   }
-   } else {
-   if (pkt->src_ip == q->id.src_ip &&
-   pkt->dst_ip == q->id.dst_ip &&
-   pkt->src_port == q->id.src_port &&
-   pkt->dst_port == q->id.dst_port ) {
-   dir = MATCH_FORWARD;
-   break;
-   }
-   if (pkt->src_ip == q->id.dst_ip &&
-   pkt->dst_ip == q->id.src_ip &&
-   pkt->src_port == q->id.dst_port &&
-   pkt->dst_port == q->id.src_port ) {
-   dir = MATCH_REVERSE;
-   break;
-   }
+   }
+   if (IN6_ARE_ADDR_EQUAL(&pkt->src_ip6, &q->id.dst_ip6) &&
+   IN6_ARE_ADDR_EQUAL(&pkt->dst_ip6, &q->id.src_ip6) &&
+   pkt->src_port == q->id.dst_port &&
+   pkt->dst_port == q->id.src_port) {
+   dir = MATCH_REVERSE;
+   break;
+   }
+   } else {
+   if (pkt->src_ip == q->id.src_ip &&
+   pkt->dst_ip == q->id.dst_ip &&
+   pkt->src_port == q->id.

svn commit: r232273 - head/sys/netinet/ipfw

2012-02-28 Thread Oleg Bulyzhin
Author: oleg
Date: Tue Feb 28 22:00:41 2012
New Revision: 232273
URL: http://svn.freebsd.org/changeset/base/232273

Log:
  - Refresh dynamic tcp rule only if both sides answered keepalive packets.
  - Remove some useless assignments.
  
  MFC after:1 month

Modified:
  head/sys/netinet/ipfw/ip_fw_dynamic.c

Modified: head/sys/netinet/ipfw/ip_fw_dynamic.c
==
--- head/sys/netinet/ipfw/ip_fw_dynamic.c   Tue Feb 28 21:53:39 2012
(r232272)
+++ head/sys/netinet/ipfw/ip_fw_dynamic.c   Tue Feb 28 22:00:41 2012
(r232273)
@@ -472,8 +472,12 @@ next:
 
 #define BOTH_SYN   (TH_SYN | (TH_SYN << 8))
 #define BOTH_FIN   (TH_FIN | (TH_FIN << 8))
+#defineTCP_FLAGS   (TH_FLAGS | (TH_FLAGS << 8))
+#defineACK_FWD 0x1 /* fwd ack seen */
+#defineACK_REV 0x2 /* rev ack seen */
+
q->state |= (dir == MATCH_FORWARD) ? flags : (flags << 8);
-   switch (q->state) {
+   switch (q->state & TCP_FLAGS) {
case TH_SYN:/* opening */
q->expire = time_uptime + V_dyn_syn_lifetime;
break;
@@ -482,24 +486,28 @@ next:
case BOTH_SYN | TH_FIN: /* one side tries to close */
case BOTH_SYN | (TH_FIN << 8):
 #define _SEQ_GE(a,b) ((int)(a) - (int)(b) >= 0)
-   if (tcp == NULL) {
-   q->expire = time_uptime + V_dyn_ack_lifetime;
+   if (tcp == NULL)
break;
-   }
 
ack = ntohl(tcp->th_ack);
if (dir == MATCH_FORWARD) {
-   if (q->ack_fwd == 0 || _SEQ_GE(ack, q->ack_fwd))
+   if (q->ack_fwd == 0 ||
+   _SEQ_GE(ack, q->ack_fwd)) {
q->ack_fwd = ack;
-   else/* ignore out-of-sequence */
-   break;
+   q->state |= ACK_FWD;
+   }
} else {
-   if (q->ack_rev == 0 || _SEQ_GE(ack, q->ack_rev))
+   if (q->ack_rev == 0 ||
+   _SEQ_GE(ack, q->ack_rev)) {
q->ack_rev = ack;
-   else/* ignore out-of-sequence */
-   break;
+   q->state |= ACK_REV;
+   }
+   }
+   if ((q->state & (ACK_FWD | ACK_REV)) ==
+   (ACK_FWD | ACK_REV)) {
+   q->expire = time_uptime + V_dyn_ack_lifetime;
+   q->state &= ~(ACK_FWD | ACK_REV);
}
-   q->expire = time_uptime + V_dyn_ack_lifetime;
break;
 
case BOTH_SYN | BOTH_FIN:   /* both sides closed */
@@ -1074,10 +1082,12 @@ ipfw_tick(void * vnetx) 
if (TIME_LEQ(q->expire, time_uptime))
continue;   /* too late, rule expired */
 
-   m = ipfw_send_pkt(NULL, &(q->id), q->ack_rev - 1,
-   q->ack_fwd, TH_SYN);
-   mnext = ipfw_send_pkt(NULL, &(q->id), q->ack_fwd - 1,
-   q->ack_rev, 0);
+   m = (q->state & ACK_REV) ? NULL :
+   ipfw_send_pkt(NULL, &(q->id), q->ack_rev - 1,
+   q->ack_fwd, TH_SYN);
+   mnext = (q->state & ACK_FWD) ? NULL :
+   ipfw_send_pkt(NULL, &(q->id), q->ack_fwd - 1,
+   q->ack_rev, 0);
 
switch (q->id.addr_type) {
case 4:
@@ -1103,18 +1113,16 @@ ipfw_tick(void * vnetx) 
break;
 #endif
}
-
-   m = mnext = NULL;
}
}
IPFW_DYN_UNLOCK();
-   for (m = mnext = m0; m != NULL; m = mnext) {
+   for (m = m0; m != NULL; m = mnext) {
mnext = m->m_nextpkt;
m->m_nextpkt = NULL;
ip_output(m, NULL, NULL, 0, NULL, NULL);
}
 #ifdef INET6
-   for (m = mnext = m6; m != NULL; m = mnext) {
+   for (m = m6; m != NULL; m = mnext) {
mnext = m->m_nextpkt;
m->m_nextpkt = NULL;
ip6_output(m, NULL, NULL, 0, NULL, NULL, NULL);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listin

Re: svn commit: r232272 - head/sys/netinet/ipfw

2012-02-28 Thread Oleg Bulyzhin
On Tue, Feb 28, 2012 at 11:22:52PM +0100, Luigi Rizzo wrote:
> On Tue, Feb 28, 2012 at 09:53:39PM +0000, Oleg Bulyzhin wrote:
> > Author: oleg
> > Date: Tue Feb 28 21:53:39 2012
> > New Revision: 232272
> > URL: http://svn.freebsd.org/changeset/base/232272
> > 
> > Log:
> >   lookup_dyn_rule_locked(): style(9) cleanup
> >   
> >   MFC after:1 month
> 
> is there a reason for delaying the MFC, such as this is
> preparatory work for further changes ?
> Otherwise i'd suggest that whitespace changes like this
> are quickly pushed to the stable branch so that the code
> versions do not diverge.
> 
> cheers
> luigi

Actual commit is r232273, this one used for reduce diff
of meaningful commit.

-- 
Oleg.


=== Oleg Bulyzhin -- OBUL-RIPN -- OBUL-RIPE -- o...@rinet.ru ===


___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r236692 - stable/9/sys/netinet/ipfw

2012-06-06 Thread Oleg Bulyzhin
Author: oleg
Date: Wed Jun  6 18:00:19 2012
New Revision: 236692
URL: http://svn.freebsd.org/changeset/base/236692

Log:
  MFC: r232272, r232273
  
  - lookup_dyn_rule_locked(): style(9) cleanup
  - Refresh dynamic tcp rule only if both sides answered keepalive packets.
  - Remove some useless assignments.

Modified:
  stable/9/sys/netinet/ipfw/ip_fw_dynamic.c
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/netinet/ipfw/ip_fw_dynamic.c
==
--- stable/9/sys/netinet/ipfw/ip_fw_dynamic.c   Wed Jun  6 17:28:46 2012
(r236691)
+++ stable/9/sys/netinet/ipfw/ip_fw_dynamic.c   Wed Jun  6 18:00:19 2012
(r236692)
@@ -390,72 +390,68 @@ ipfw_remove_dyn_children(struct ip_fw *r
IPFW_DYN_UNLOCK();
 }
 
-/**
- * lookup a dynamic rule, locked version
+/*
+ * Lookup a dynamic rule, locked version.
  */
 static ipfw_dyn_rule *
 lookup_dyn_rule_locked(struct ipfw_flow_id *pkt, int *match_direction,
 struct tcphdr *tcp)
 {
/*
-* stateful ipfw extensions.
-* Lookup into dynamic session queue
+* Stateful ipfw extensions.
+* Lookup into dynamic session queue.
 */
 #define MATCH_REVERSE  0
 #define MATCH_FORWARD  1
 #define MATCH_NONE 2
 #define MATCH_UNKNOWN  3
int i, dir = MATCH_NONE;
-   ipfw_dyn_rule *prev, *q=NULL;
+   ipfw_dyn_rule *prev, *q = NULL;
 
IPFW_DYN_LOCK_ASSERT();
 
if (V_ipfw_dyn_v == NULL)
-   goto done;  /* not found */
-   i = hash_packet( pkt );
-   for (prev=NULL, q = V_ipfw_dyn_v[i] ; q != NULL ; ) {
+   goto done;  /* not found */
+   i = hash_packet(pkt);
+   for (prev = NULL, q = V_ipfw_dyn_v[i]; q != NULL;) {
if (q->dyn_type == O_LIMIT_PARENT && q->count)
goto next;
-   if (TIME_LEQ( q->expire, time_uptime)) { /* expire entry */
+   if (TIME_LEQ(q->expire, time_uptime)) { /* expire entry */
UNLINK_DYN_RULE(prev, V_ipfw_dyn_v[i], q);
continue;
}
-   if (pkt->proto == q->id.proto &&
-   q->dyn_type != O_LIMIT_PARENT) {
-   if (IS_IP6_FLOW_ID(pkt)) {
-   if (IN6_ARE_ADDR_EQUAL(&(pkt->src_ip6),
-   &(q->id.src_ip6)) &&
-   IN6_ARE_ADDR_EQUAL(&(pkt->dst_ip6),
-   &(q->id.dst_ip6)) &&
+   if (pkt->proto != q->id.proto || q->dyn_type == O_LIMIT_PARENT)
+   goto next;
+
+   if (IS_IP6_FLOW_ID(pkt)) {
+   if (IN6_ARE_ADDR_EQUAL(&pkt->src_ip6, &q->id.src_ip6) &&
+   IN6_ARE_ADDR_EQUAL(&pkt->dst_ip6, &q->id.dst_ip6) &&
pkt->src_port == q->id.src_port &&
-   pkt->dst_port == q->id.dst_port ) {
+   pkt->dst_port == q->id.dst_port) {
+   dir = MATCH_FORWARD;
+   break;
+   }
+   if (IN6_ARE_ADDR_EQUAL(&pkt->src_ip6, &q->id.dst_ip6) &&
+   IN6_ARE_ADDR_EQUAL(&pkt->dst_ip6, &q->id.src_ip6) &&
+   pkt->src_port == q->id.dst_port &&
+   pkt->dst_port == q->id.src_port) {
+   dir = MATCH_REVERSE;
+   break;
+   }
+   } else {
+   if (pkt->src_ip == q->id.src_ip &&
+   pkt->dst_ip == q->id.dst_ip &&
+   pkt->src_port == q->id.src_port &&
+   pkt->dst_port == q->id.dst_port) {
dir = MATCH_FORWARD;
break;
-   }
-   if (IN6_ARE_ADDR_EQUAL(&(pkt->src_ip6),
-   &(q->id.dst_ip6)) &&
-   IN6_ARE_ADDR_EQUAL(&(pkt->dst_ip6),
-   &(q->id.src_ip6)) &&
-   pkt->src_port == q->id.dst_port &&
-   pkt->dst_port == q->id.src_port ) {
-   dir = MATCH_REVERSE;
-   break;
-   }
-   } else {
-   if (pkt->src_ip == q->id.src_ip &&
-   pkt->dst_ip == q->id.dst_ip &&
-   pkt->src_port == q->id.src_port &&
-   pkt->dst_port == q->id.dst_port ) {
-   dir = MATCH_FORWARD;
-   break;
-   }
-   if (pkt->src_ip =

svn commit: r236694 - stable/8/sys/netinet/ipfw

2012-06-06 Thread Oleg Bulyzhin
Author: oleg
Date: Wed Jun  6 18:04:49 2012
New Revision: 236694
URL: http://svn.freebsd.org/changeset/base/236694

Log:
  MFC: r232272, r232273
  
  - lookup_dyn_rule_locked(): style(9) cleanup
  - Refresh dynamic tcp rule only if both sides answered keepalive packets.
  - Remove some useless assignments.

Modified:
  stable/8/sys/netinet/ipfw/ip_fw_dynamic.c
Directory Properties:
  stable/8/sys/   (props changed)

Modified: stable/8/sys/netinet/ipfw/ip_fw_dynamic.c
==
--- stable/8/sys/netinet/ipfw/ip_fw_dynamic.c   Wed Jun  6 18:00:38 2012
(r236693)
+++ stable/8/sys/netinet/ipfw/ip_fw_dynamic.c   Wed Jun  6 18:04:49 2012
(r236694)
@@ -390,72 +390,68 @@ ipfw_remove_dyn_children(struct ip_fw *r
IPFW_DYN_UNLOCK();
 }
 
-/**
- * lookup a dynamic rule, locked version
+/*
+ * Lookup a dynamic rule, locked version.
  */
 static ipfw_dyn_rule *
 lookup_dyn_rule_locked(struct ipfw_flow_id *pkt, int *match_direction,
 struct tcphdr *tcp)
 {
/*
-* stateful ipfw extensions.
-* Lookup into dynamic session queue
+* Stateful ipfw extensions.
+* Lookup into dynamic session queue.
 */
 #define MATCH_REVERSE  0
 #define MATCH_FORWARD  1
 #define MATCH_NONE 2
 #define MATCH_UNKNOWN  3
int i, dir = MATCH_NONE;
-   ipfw_dyn_rule *prev, *q=NULL;
+   ipfw_dyn_rule *prev, *q = NULL;
 
IPFW_DYN_LOCK_ASSERT();
 
if (V_ipfw_dyn_v == NULL)
-   goto done;  /* not found */
-   i = hash_packet( pkt );
-   for (prev=NULL, q = V_ipfw_dyn_v[i] ; q != NULL ; ) {
+   goto done;  /* not found */
+   i = hash_packet(pkt);
+   for (prev = NULL, q = V_ipfw_dyn_v[i]; q != NULL;) {
if (q->dyn_type == O_LIMIT_PARENT && q->count)
goto next;
-   if (TIME_LEQ( q->expire, time_uptime)) { /* expire entry */
+   if (TIME_LEQ(q->expire, time_uptime)) { /* expire entry */
UNLINK_DYN_RULE(prev, V_ipfw_dyn_v[i], q);
continue;
}
-   if (pkt->proto == q->id.proto &&
-   q->dyn_type != O_LIMIT_PARENT) {
-   if (IS_IP6_FLOW_ID(pkt)) {
-   if (IN6_ARE_ADDR_EQUAL(&(pkt->src_ip6),
-   &(q->id.src_ip6)) &&
-   IN6_ARE_ADDR_EQUAL(&(pkt->dst_ip6),
-   &(q->id.dst_ip6)) &&
+   if (pkt->proto != q->id.proto || q->dyn_type == O_LIMIT_PARENT)
+   goto next;
+
+   if (IS_IP6_FLOW_ID(pkt)) {
+   if (IN6_ARE_ADDR_EQUAL(&pkt->src_ip6, &q->id.src_ip6) &&
+   IN6_ARE_ADDR_EQUAL(&pkt->dst_ip6, &q->id.dst_ip6) &&
pkt->src_port == q->id.src_port &&
-   pkt->dst_port == q->id.dst_port ) {
+   pkt->dst_port == q->id.dst_port) {
+   dir = MATCH_FORWARD;
+   break;
+   }
+   if (IN6_ARE_ADDR_EQUAL(&pkt->src_ip6, &q->id.dst_ip6) &&
+   IN6_ARE_ADDR_EQUAL(&pkt->dst_ip6, &q->id.src_ip6) &&
+   pkt->src_port == q->id.dst_port &&
+   pkt->dst_port == q->id.src_port) {
+   dir = MATCH_REVERSE;
+   break;
+   }
+   } else {
+   if (pkt->src_ip == q->id.src_ip &&
+   pkt->dst_ip == q->id.dst_ip &&
+   pkt->src_port == q->id.src_port &&
+   pkt->dst_port == q->id.dst_port) {
dir = MATCH_FORWARD;
break;
-   }
-   if (IN6_ARE_ADDR_EQUAL(&(pkt->src_ip6),
-   &(q->id.dst_ip6)) &&
-   IN6_ARE_ADDR_EQUAL(&(pkt->dst_ip6),
-   &(q->id.src_ip6)) &&
-   pkt->src_port == q->id.dst_port &&
-   pkt->dst_port == q->id.src_port ) {
-   dir = MATCH_REVERSE;
-   break;
-   }
-   } else {
-   if (pkt->src_ip == q->id.src_ip &&
-   pkt->dst_ip == q->id.dst_ip &&
-   pkt->src_port == q->id.src_port &&
-   pkt->dst_port == q->id.dst_port ) {
-   dir = MATCH_FORWARD;
-   break;
-   }
-   if (pkt->src_ip =

svn commit: r200170 - head/sys/netinet/ipfw

2009-12-05 Thread Oleg Bulyzhin
Author: oleg
Date: Sat Dec  5 23:27:21 2009
New Revision: 200170
URL: http://svn.freebsd.org/changeset/base/200170

Log:
  Fix burst processing for WF2Q pipes - do not increase available burst size
  unless pipe is idle. This should fix follwing issues:
  - 'dummynet: OUCH! pipe should have been idle!' log messages.
  - exceeding configured pipe bandwidth.
  
  MFC after:1 week

Modified:
  head/sys/netinet/ipfw/ip_dummynet.c

Modified: head/sys/netinet/ipfw/ip_dummynet.c
==
--- head/sys/netinet/ipfw/ip_dummynet.c Sat Dec  5 23:23:46 2009
(r200169)
+++ head/sys/netinet/ipfw/ip_dummynet.c Sat Dec  5 23:27:21 2009
(r200170)
@@ -1447,7 +1447,9 @@ dummynet_io(struct mbuf **m0, int dir, s
q->numbytes += pipe->bandwidth;
}
} else {/* WF2Q. */
-   if (pipe->idle_time < curr_time) {
+   if (pipe->idle_time < curr_time &&
+   pipe->scheduler_heap.elements == 0 &&
+   pipe->not_eligible_heap.elements == 0) {
/* Calculate available burst size. */
pipe->numbytes +=
(curr_time - pipe->idle_time - 1) * pipe->bandwidth;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r194245 - head/sys/netinet/ipfw

2009-06-15 Thread Oleg Bulyzhin
Author: oleg
Date: Mon Jun 15 17:14:47 2009
New Revision: 194245
URL: http://svn.freebsd.org/changeset/base/194245

Log:
  Since dn_pipe.numbytes is int64_t now - remove unnecessary overflow detection
  code in ready_event_wfq().

Modified:
  head/sys/netinet/ipfw/ip_dummynet.c

Modified: head/sys/netinet/ipfw/ip_dummynet.c
==
--- head/sys/netinet/ipfw/ip_dummynet.c Mon Jun 15 16:51:07 2009
(r194244)
+++ head/sys/netinet/ipfw/ip_dummynet.c Mon Jun 15 17:14:47 2009
(r194245)
@@ -56,7 +56,6 @@ __FBSDID("$FreeBSD$");
  * include files marked with XXX are probably not needed
  */
 
-#include 
 #include 
 #include 
 #include 
@@ -686,16 +685,11 @@ ready_event_wfq(struct dn_pipe *p, struc
int p_was_empty = (p->head == NULL);
struct dn_heap *sch = &(p->scheduler_heap);
struct dn_heap *neh = &(p->not_eligible_heap);
-   int64_t p_numbytes = p->numbytes;
 
DUMMYNET_LOCK_ASSERT();
 
if (p->if_name[0] == 0) /* tx clock is simulated */
-   /*
-* Since result may not fit into p->numbytes (32bit) we
-* are using 64bit var here.
-*/
-   p_numbytes += (curr_time - p->sched_time) * p->bandwidth;
+   p->numbytes += (curr_time - p->sched_time) * p->bandwidth;
else {  /*
 * tx clock is for real,
 * the ifq must be empty or this is a NOP.
@@ -712,7 +706,7 @@ ready_event_wfq(struct dn_pipe *p, struc
 * While we have backlogged traffic AND credit, we need to do
 * something on the queue.
 */
-   while (p_numbytes >= 0 && (sch->elements > 0 || neh->elements > 0)) {
+   while (p->numbytes >= 0 && (sch->elements > 0 || neh->elements > 0)) {
if (sch->elements > 0) {
/* Have some eligible pkts to send out. */
struct dn_flow_queue *q = sch->p[0].object;
@@ -722,7 +716,7 @@ ready_event_wfq(struct dn_pipe *p, struc
int len_scaled = p->bandwidth ? len * 8 * hz : 0;
 
heap_extract(sch, NULL); /* Remove queue from heap. */
-   p_numbytes -= len_scaled;
+   p->numbytes -= len_scaled;
move_pkt(pkt, q, p, len);
 
p->V += (len << MY_M) / p->sum; /* Update V. */
@@ -763,11 +757,11 @@ ready_event_wfq(struct dn_pipe *p, struc
}
 
if (p->if_name[0] != '\0') { /* Tx clock is from a real thing */
-   p_numbytes = -1;/* Mark not ready for I/O. */
+   p->numbytes = -1;   /* Mark not ready for I/O. */
break;
}
}
-   if (sch->elements == 0 && neh->elements == 0 && p_numbytes >= 0 &&
+   if (sch->elements == 0 && neh->elements == 0 && p->numbytes >= 0 &&
p->idle_heap.elements > 0) {
/*
 * No traffic and no events scheduled.
@@ -790,11 +784,11 @@ ready_event_wfq(struct dn_pipe *p, struc
 * If we are under credit, schedule the next ready event.
 * Also fix the delivery time of the last packet.
 */
-   if (p->if_name[0]==0 && p_numbytes < 0) { /* This implies bw > 0. */
+   if (p->if_name[0]==0 && p->numbytes < 0) { /* This implies bw > 0. */
dn_key t = 0;   /* Number of ticks i have to wait. */
 
if (p->bandwidth > 0)
-   t = (p->bandwidth - 1 - p_numbytes) / p->bandwidth;
+   t = (p->bandwidth - 1 - p->numbytes) / p->bandwidth;
dn_tag_get(p->tail)->output_time += t;
p->sched_time = curr_time;
heap_insert(&wfq_ready_heap, curr_time + t, (void *)p);
@@ -804,14 +798,6 @@ ready_event_wfq(struct dn_pipe *p, struc
 */
}
 
-   /* Fit (adjust if necessary) 64bit result into 32bit variable. */
-   if (p_numbytes > INT_MAX)
-   p->numbytes = INT_MAX;
-   else if (p_numbytes < INT_MIN)
-   p->numbytes = INT_MIN;
-   else
-   p->numbytes = p_numbytes;
-
/*
 * If the delay line was empty call transmit_event() now.
 * Otherwise, the scheduler will take care of it.
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r194930 - in head: sbin/ipfw sys/netinet sys/netinet/ipfw

2009-06-24 Thread Oleg Bulyzhin
Author: oleg
Date: Wed Jun 24 22:57:07 2009
New Revision: 194930
URL: http://svn.freebsd.org/changeset/base/194930

Log:
  - fix dummynet 'fast' mode for WF2Q case.
  - fix printing of pipe profile data.
  - introduce new pipe parameter: 'burst' - how much data can be sent through
pipe bypassing bandwidth limit.

Modified:
  head/sbin/ipfw/Makefile
  head/sbin/ipfw/dummynet.c
  head/sbin/ipfw/ipfw.8
  head/sbin/ipfw/ipfw2.h
  head/sys/netinet/ip_dummynet.h
  head/sys/netinet/ipfw/ip_dummynet.c

Modified: head/sbin/ipfw/Makefile
==
--- head/sbin/ipfw/Makefile Wed Jun 24 22:42:52 2009(r194929)
+++ head/sbin/ipfw/Makefile Wed Jun 24 22:57:07 2009(r194930)
@@ -3,6 +3,7 @@
 PROG=  ipfw
 SRCS=  ipfw2.c dummynet.c ipv6.c main.c nat.c altq.c
 WARNS?=2
+LDADD= -lutil
 MAN=   ipfw.8
 
 .include 

Modified: head/sbin/ipfw/dummynet.c
==
--- head/sbin/ipfw/dummynet.c   Wed Jun 24 22:42:52 2009(r194929)
+++ head/sbin/ipfw/dummynet.c   Wed Jun 24 22:57:07 2009(r194930)
@@ -32,6 +32,8 @@
 
 #include 
 #include 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -70,6 +72,7 @@ static struct _s_x dummynet_params[] = {
{ "src-ipv6",   TOK_SRCIP6},
{ "src-ip6",TOK_SRCIP6},
{ "profile",TOK_PIPE_PROFILE},
+   { "burst",  TOK_BURST},
{ "dummynet-params",TOK_NULL },
{ NULL, 0 } /* terminator */
 };
@@ -236,7 +239,7 @@ print_flowset_parms(struct dn_flow_set *
plr[0] = '\0';
if (fs->flags_fs & DN_IS_RED)   /* RED parameters */
sprintf(red,
-   "\n\t  %cRED w_q %f min_th %d max_th %d max_p %f",
+   "\n\t %cRED w_q %f min_th %d max_th %d max_p %f",
(fs->flags_fs & DN_IS_GENTLE_RED) ? 'G' : ' ',
1.0 * fs->w_q / (double)(1 << SCALE_RED),
SCALE_VAL(fs->min_th),
@@ -250,7 +253,7 @@ print_flowset_parms(struct dn_flow_set *
 }
 
 static void
-print_extra_delay_parms(struct dn_pipe *p, char *prefix)
+print_extra_delay_parms(struct dn_pipe *p)
 {
double loss;
if (p->samples_no <= 0)
@@ -258,8 +261,8 @@ print_extra_delay_parms(struct dn_pipe *
 
loss = p->loss_level;
loss /= p->samples_no;
-   printf("%s profile: name \"%s\" loss %f samples %d\n",
-   prefix, p->name, loss, p->samples_no);
+   printf("\t profile: name \"%s\" loss %f samples %d\n",
+   p->name, loss, p->samples_no);
 }
 
 void
@@ -280,6 +283,7 @@ ipfw_list_pipes(void *data, uint nbytes,
double b = p->bandwidth;
char buf[30];
char prefix[80];
+   char burst[5 + 7];
 
if (SLIST_NEXT(p, next) != (struct dn_pipe *)DN_IS_PIPE)
break;  /* done with pipes, now queues */
@@ -311,10 +315,16 @@ ipfw_list_pipes(void *data, uint nbytes,
sprintf(prefix, "%05d: %s %4d ms ",
p->pipe_nr, buf, p->delay);
 
-   print_extra_delay_parms(p, prefix);
-
print_flowset_parms(&(p->fs), prefix);
 
+   if (humanize_number(burst, sizeof(burst), p->burst,
+   "Byte", HN_AUTOSCALE, 0) < 0 || co.verbose)
+   printf("\t burst: %ju Byte\n", p->burst);
+   else
+   printf("\t burst: %s\n", burst);
+
+   print_extra_delay_parms(p);
+
q = (struct dn_flow_queue *)(p+1);
list_queues(&(p->fs), q);
}
@@ -933,6 +943,21 @@ end_mask:
--ac; ++av;
break;
 
+   case TOK_BURST:
+   if (co.do_pipe != 1)
+   errx(EX_DATAERR, "burst only valid for pipes");
+   NEED1("burst needs argument\n");
+   errno = 0;
+   if (expand_number(av[0], &p.burst) < 0)
+   if (errno != ERANGE)
+   errx(EX_DATAERR,
+   "burst: invalid argument");
+   if (errno || p.burst > (1ULL << 48) - 1)
+   errx(EX_DATAERR,
+   "burst: out of range (0..2^48-1)");
+   ac--; av++;
+   break;
+
default:
errx(EX_DATAERR, "unrecognised option ``%s''", av[-1]);
}

Modified: head/sbin/ipfw/ipfw.8
==
--- head/sbin/ipfw/ipfw.8   Wed Jun 24 22:42:52 2009(r194929)
+++ head/sbin/ipfw/ipfw.8   Wed Jun 24 22:57:07 2009(r194930)
@@ -1,7 +1,7 @@
 .\"
 .\

Re: svn commit: r194930 - in head: sbin/ipfw sys/netinet sys/netinet/ipfw

2009-06-25 Thread Oleg Bulyzhin
On Wed, Jun 24, 2009 at 07:44:04PM -0400, Ben Kaduk wrote:

> There's a grammar error and a style error, here.  I'm actually not
> entirely sure what
> the intended meaning is, so it's a bit hard to fix the grammar error.

It's no wonder - my english writing skill is poor.

> Looking at the code, it seems that in burst mode, extra data will be
> allowed to be sent, though
> it is capped to not exceed the pipe bandwidth.
> Perhaps "... bytes of data is allowed to bypass the dummynet scheduler
> (...), though
> the transmission rate will still be capped so as to not exceed the
> pipe's bandwidth."?

Let me explain.  For example, we have pipe with bw 1Mbit/s and burst size is
5GByte. If we try to download 10Gbyte through this pipe following will happen:
1) 1st 5Gbyte of data will go with 'wire speed'.
2) last 5Gbyte will be shaped to 1Mbit/s

Could you please mail me whole 'burst' part (as it should be), and i will fix
it.

> 
> The style error is that the new sentence ("Effective burst size ...")
> should start
> on a new line.
> 
> I would also prefer to see the new sentence be an actual complete sentence
> (i.e., "The effective burst size is calculated as follows"), though
> there appears
> to be at least one other bug of this form in the file already (see,
> for example, the
> quoted text at the beginning of this hunk: "Default value is no delay.", which
> would benefit from a "the".)
> 
> 
> Unrelated to this commit, there is a grammar error early in the file:
> 
> 312 Once
> 313 .Fl p
> 314 has been specified, any additional arguments as passed on to the 
> preproc
> essor
> 315 for interpretation.
> 
> The 'as' in line 314 should be 'are'.
> (This is from CVS r1.220, so the line numbers may not be current.)
> 
> 
> Thanks,
> 
> Ben Kaduk
> 
> 
> > +MAX(
> > +.Ar size
> > +,
> > +.Nm bw
> > +* pipe_idle_time).
> > +.Pp
> >  .It Cm profile Ar filename
> >  A file specifying the additional overhead incurred in the transmission
> >  of a packet on the link.
> >

-- 
Oleg.


=== Oleg Bulyzhin -- OBUL-RIPN -- OBUL-RIPE -- o...@rinet.ru ===


___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r195075 - head/sbin/ipfw

2009-06-26 Thread Oleg Bulyzhin
Author: oleg
Date: Fri Jun 26 19:49:06 2009
New Revision: 195075
URL: http://svn.freebsd.org/changeset/base/195075

Log:
  - 'burst' description rewritten.
  
  Submitted by: Ben Kaduk
  Approved by:  re (kib)

Modified:
  head/sbin/ipfw/ipfw.8

Modified: head/sbin/ipfw/ipfw.8
==
--- head/sbin/ipfw/ipfw.8   Fri Jun 26 19:39:33 2009(r195074)
+++ head/sbin/ipfw/ipfw.8   Fri Jun 26 19:49:06 2009(r195075)
@@ -1944,13 +1944,18 @@ the granularity to 1ms or less).
 The default value is 0, meaning no delay.
 .Pp
 .It Cm burst Ar size
-If the data rate exceeds the pipe bandwith limit
-(and pipe was idle long enough),
+If the data to be sent exceeds the pipe's bandwidth limit
+(and the pipe was previously idle), up to
 .Ar size
-bytes of data is allowed to bypass the
+bytes of data are allowed to bypass the
 .Nm dummynet
-scheduler (i.e. it will be sent without shaping), then transmission rate
-will not exceed pipe bandwidth. Effective burst size calculated as follows:
+scheduler, and will be sent as fast as the physical link allows.
+Any additional data will be transmitted at the rate specified
+by the
+.Nm pipe
+bandwidth.
+The burst size depends on how long the pipe has been idle;
+the effective burst size is calculated as follows:
 MAX(
 .Ar size
 ,
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r184414 - in head: . sys/netinet

2008-10-28 Thread Oleg Bulyzhin
Author: oleg
Date: Tue Oct 28 14:14:57 2008
New Revision: 184414
URL: http://svn.freebsd.org/changeset/base/184414

Log:
  Type of q_time (start of queue idle time) has changed: uint32_t -> uint64_t.
  This should fix q_time overflow, which happens after 2^32/(86400*hz) days of
  uptime (~50days for hz = 1000).
  q_time overflow cause following:
  - traffic shaping may not work in 'fast' mode (not enabled by default).
  - incorrect average queue length calculation in RED/GRED algorithm.
  
  NB: due to ABI change this change is not applicable to stable.
  
  PR:   kern/128401

Modified:
  head/UPDATING
  head/sys/netinet/ip_dummynet.h

Modified: head/UPDATING
==
--- head/UPDATING   Tue Oct 28 13:44:11 2008(r184413)
+++ head/UPDATING   Tue Oct 28 14:14:57 2008(r184414)
@@ -22,6 +22,9 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 8.
to maximize performance.  (To disable malloc debugging, run
ln -s aj /etc/malloc.conf.)
 
+20081028:
+   dummynet(4) ABI has changed. ipfw(8) needs to be recompiled.
+
 20081009:
The uhci, ohci, ehci and slhci USB Host controller drivers have
been put into separate modules. If you load the usb module

Modified: head/sys/netinet/ip_dummynet.h
==
--- head/sys/netinet/ip_dummynet.h  Tue Oct 28 13:44:11 2008
(r184413)
+++ head/sys/netinet/ip_dummynet.h  Tue Oct 28 14:14:57 2008
(r184414)
@@ -216,7 +216,7 @@ struct dn_flow_queue {
 int avg ;   /* average queue length est. (scaled) */
 int count ; /* arrivals since last RED drop */
 int random ;/* random value (scaled) */
-u_int32_t q_time ;  /* start of queue idle time */
+dn_key q_time; /* start of queue idle time */
 
 /* WF2Q+ support */
 struct dn_flow_set *fs ;   /* parent flow set */
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


svn commit: r184504 - stable/7/sys/netinet

2008-10-31 Thread Oleg Bulyzhin
Author: oleg
Date: Fri Oct 31 12:58:12 2008
New Revision: 184504
URL: http://svn.freebsd.org/changeset/base/184504

Log:
  Direct commit (r184414 is not applicable to stable due to ABI change):
  
  Workaround possible q_time overflow (will happen after 2^32/(86400*hz)
  days of uptime (~50days for hz = 1000)), which may lead to:
  - broken shaping in 'fast' io mode.
  - incorrect average queue length calculation in RED/GRED algorithm.
  
  PR:   kern/128401
  Approved by:  re (kensmith)

Modified:
  stable/7/sys/netinet/ip_dummynet.c

Modified: stable/7/sys/netinet/ip_dummynet.c
==
--- stable/7/sys/netinet/ip_dummynet.c  Fri Oct 31 11:47:51 2008
(r184503)
+++ stable/7/sys/netinet/ip_dummynet.c  Fri Oct 31 12:58:12 2008
(r184504)
@@ -1155,7 +1155,8 @@ red_drops(struct dn_flow_set *fs, struct
 * XXX check wraps...
 */
if (q->avg) {
-   u_int t = (curr_time - q->q_time) / fs->lookup_step;
+   u_int t = ((uint32_t)curr_time - q->q_time) /
+   fs->lookup_step;
 
q->avg = (t < fs->lookup_depth) ?
SCALE_MUL(q->avg, fs->w_q_lookup[t]) : 0;
@@ -1350,7 +1351,7 @@ dummynet_io(struct mbuf **m0, int dir, s
if (q->head != m)   /* Flow was not idle, we are done. */
goto done;
 
-   if (q->q_time < curr_time)
+   if (q->q_time < (uint32_t)curr_time)
q->numbytes = io_fast ? fs->pipe->bandwidth : 0;
q->q_time = curr_time;
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


svn commit: r184505 - stable/6/sys/netinet

2008-10-31 Thread Oleg Bulyzhin
Author: oleg
Date: Fri Oct 31 13:00:34 2008
New Revision: 184505
URL: http://svn.freebsd.org/changeset/base/184505

Log:
  Direct commit (r184414 is not applicable to stable due to ABI change):
  
  Workaround possible q_time overflow (will happen after 2^32/(86400*hz)
  days of uptime (~50days for hz = 1000)), which may lead to:
  - broken shaping in 'fast' io mode.
  - incorrect average queue length calculation in RED/GRED algorithm.
  
  PR:   kern/128401
  Approved by:  re (kensmith)

Modified:
  stable/6/sys/netinet/ip_dummynet.c

Modified: stable/6/sys/netinet/ip_dummynet.c
==
--- stable/6/sys/netinet/ip_dummynet.c  Fri Oct 31 12:58:12 2008
(r184504)
+++ stable/6/sys/netinet/ip_dummynet.c  Fri Oct 31 13:00:34 2008
(r184505)
@@ -1186,7 +1186,8 @@ red_drops(struct dn_flow_set *fs, struct
 * XXX check wraps...
 */
if (q->avg) {
-   u_int t = (curr_time - q->q_time) / fs->lookup_step;
+   u_int t = ((uint32_t)curr_time - q->q_time) /
+   fs->lookup_step;
 
q->avg = (t < fs->lookup_depth) ?
SCALE_MUL(q->avg, fs->w_q_lookup[t]) : 0;
@@ -1382,7 +1383,7 @@ dummynet_io(struct mbuf **m0, int dir, s
if (q->head != m)   /* Flow was not idle, we are done. */
goto done;
 
-   if (q->q_time < curr_time)
+   if (q->q_time < (uint32_t)curr_time)
q->numbytes = io_fast ? fs->pipe->bandwidth : 0;
q->q_time = curr_time;
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


svn commit: r184506 - releng/6.4/sys/netinet

2008-10-31 Thread Oleg Bulyzhin
Author: oleg
Date: Fri Oct 31 13:01:31 2008
New Revision: 184506
URL: http://svn.freebsd.org/changeset/base/184506

Log:
  Direct commit (r184414 is not applicable to stable due to ABI change):
  
  Workaround possible q_time overflow (will happen after 2^32/(86400*hz)
  days of uptime (~50days for hz = 1000)), which may lead to:
  - broken shaping in 'fast' io mode.
  - incorrect average queue length calculation in RED/GRED algorithm.
  
  PR:   kern/128401
  Approved by:  re (kensmith)

Modified:
  releng/6.4/sys/netinet/ip_dummynet.c

Modified: releng/6.4/sys/netinet/ip_dummynet.c
==
--- releng/6.4/sys/netinet/ip_dummynet.cFri Oct 31 13:00:34 2008
(r184505)
+++ releng/6.4/sys/netinet/ip_dummynet.cFri Oct 31 13:01:31 2008
(r184506)
@@ -1186,7 +1186,8 @@ red_drops(struct dn_flow_set *fs, struct
 * XXX check wraps...
 */
if (q->avg) {
-   u_int t = (curr_time - q->q_time) / fs->lookup_step;
+   u_int t = ((uint32_t)curr_time - q->q_time) /
+   fs->lookup_step;
 
q->avg = (t < fs->lookup_depth) ?
SCALE_MUL(q->avg, fs->w_q_lookup[t]) : 0;
@@ -1382,7 +1383,7 @@ dummynet_io(struct mbuf **m0, int dir, s
if (q->head != m)   /* Flow was not idle, we are done. */
goto done;
 
-   if (q->q_time < curr_time)
+   if (q->q_time < (uint32_t)curr_time)
q->numbytes = io_fast ? fs->pipe->bandwidth : 0;
q->q_time = curr_time;
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


svn commit: r193859 - in head/sys: net netgraph netinet netinet/ipfw

2009-06-09 Thread Oleg Bulyzhin
Author: oleg
Date: Tue Jun  9 21:27:11 2009
New Revision: 193859
URL: http://svn.freebsd.org/changeset/base/193859

Log:
  Close long existed race with net.inet.ip.fw.one_pass = 0:
  If packet leaves ipfw to other kernel subsystem (dummynet, netgraph, etc)
  it carries pointer to matching ipfw rule. If this packet then reinjected back
  to ipfw, ruleset processing starts from that rule. If rule was deleted
  meanwhile, due to existed race condition panic was possible (as well as
  other odd effects like parsing rules in 'reap list').
  
  P.S. this commit changes ABI so userland ipfw related binaries should be
  recompiled.
  
  MFC after:1 month
  Tested by:Mikolaj Golub

Modified:
  head/sys/net/if_bridge.c
  head/sys/net/if_ethersubr.c
  head/sys/netgraph/ng_ipfw.c
  head/sys/netgraph/ng_ipfw.h
  head/sys/netinet/ip_dummynet.h
  head/sys/netinet/ip_fw.h
  head/sys/netinet/ipfw/ip_dummynet.c
  head/sys/netinet/ipfw/ip_fw2.c
  head/sys/netinet/ipfw/ip_fw_pfil.c

Modified: head/sys/net/if_bridge.c
==
--- head/sys/net/if_bridge.cTue Jun  9 21:17:57 2009(r193858)
+++ head/sys/net/if_bridge.cTue Jun  9 21:27:11 2009(r193859)
@@ -3041,11 +3041,19 @@ bridge_pfil(struct mbuf **mp, struct ifn
 
if (ip_fw_chk_ptr && pfil_ipfw != 0 && dir == PFIL_OUT && ifp != NULL) {
INIT_VNET_INET(curvnet);
+   struct dn_pkt_tag *dn_tag;
 
error = -1;
-   args.rule = ip_dn_claim_rule(*mp);
-   if (args.rule != NULL && V_fw_one_pass)
-   goto ipfwpass; /* packet already partially processed */
+   dn_tag = ip_dn_claim_tag(*mp);
+   if (dn_tag != NULL) {
+   if (dn_tag->rule != NULL && V_fw_one_pass)
+   /* packet already partially processed */
+   goto ipfwpass;
+   args.rule = dn_tag->rule; /* matching rule to restart */
+   args.rule_id = dn_tag->rule_id;
+   args.chain_id = dn_tag->chain_id;
+   } else
+   args.rule = NULL;
 
args.m = *mp;
args.oif = ifp;

Modified: head/sys/net/if_ethersubr.c
==
--- head/sys/net/if_ethersubr.c Tue Jun  9 21:17:57 2009(r193858)
+++ head/sys/net/if_ethersubr.c Tue Jun  9 21:27:11 2009(r193859)
@@ -145,8 +145,7 @@ MALLOC_DEFINE(M_ARPCOM, "arpcom", "802.*
 
 #if defined(INET) || defined(INET6)
 int
-ether_ipfw_chk(struct mbuf **m0, struct ifnet *dst,
-   struct ip_fw **rule, int shared);
+ether_ipfw_chk(struct mbuf **m0, struct ifnet *dst, int shared);
 #ifdef VIMAGE_GLOBALS
 static int ether_ipfw;
 #endif
@@ -428,10 +427,9 @@ ether_output_frame(struct ifnet *ifp, st
 {
 #if defined(INET) || defined(INET6)
INIT_VNET_NET(ifp->if_vnet);
-   struct ip_fw *rule = ip_dn_claim_rule(m);
 
if (ip_fw_chk_ptr && V_ether_ipfw != 0) {
-   if (ether_ipfw_chk(&m, ifp, &rule, 0) == 0) {
+   if (ether_ipfw_chk(&m, ifp, 0) == 0) {
if (m) {
m_freem(m);
return EACCES;  /* pkt dropped */
@@ -455,8 +453,7 @@ ether_output_frame(struct ifnet *ifp, st
  * ether_output_frame.
  */
 int
-ether_ipfw_chk(struct mbuf **m0, struct ifnet *dst,
-   struct ip_fw **rule, int shared)
+ether_ipfw_chk(struct mbuf **m0, struct ifnet *dst, int shared)
 {
INIT_VNET_INET(dst->if_vnet);
struct ether_header *eh;
@@ -464,9 +461,19 @@ ether_ipfw_chk(struct mbuf **m0, struct 
struct mbuf *m;
int i;
struct ip_fw_args args;
+   struct dn_pkt_tag *dn_tag;
 
-   if (*rule != NULL && V_fw_one_pass)
-   return 1; /* dummynet packet, already partially processed */
+   dn_tag = ip_dn_claim_tag(*m0);
+
+   if (dn_tag != NULL) {
+   if (dn_tag->rule != NULL && V_fw_one_pass)
+   /* dummynet packet, already partially processed */
+   return (1);
+   args.rule = dn_tag->rule;   /* matching rule to restart */
+   args.rule_id = dn_tag->rule_id;
+   args.chain_id = dn_tag->chain_id;
+   } else
+   args.rule = NULL;
 
/*
 * I need some amt of data to be contiguous, and in case others need
@@ -487,7 +494,6 @@ ether_ipfw_chk(struct mbuf **m0, struct 
 
args.m = m; /* the packet we are looking at */
args.oif = dst; /* destination, if any  */
-   args.rule = *rule;  /* matching rule to restart */
args.next_hop = NULL;   /* we do not support forward yet*/
args.eh = &save_eh; /* MAC header for bridged/MAC packets   */

svn commit: r193861 - head/share/man/man4

2009-06-09 Thread Oleg Bulyzhin
Author: oleg
Date: Tue Jun  9 21:35:32 2009
New Revision: 193861
URL: http://svn.freebsd.org/changeset/base/193861

Log:
  Sync struct ng_ipfw_tag description with sources.
  
  Submitted by: Mikolaj Golub

Modified:
  head/share/man/man4/ng_ipfw.4

Modified: head/share/man/man4/ng_ipfw.4
==
--- head/share/man/man4/ng_ipfw.4   Tue Jun  9 21:29:16 2009
(r193860)
+++ head/share/man/man4/ng_ipfw.4   Tue Jun  9 21:35:32 2009
(r193861)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd February 5, 2005
+.Dd June 10, 2009
 .Dt NG_IPFW 4
 .Os
 .Sh NAME
@@ -84,11 +84,12 @@ to
 struct ng_ipfw_tag {
struct m_tagmt; /* tag header */
struct ip_fw*rule;  /* matching rule */
+   uint32_trule_id;/* matching rule id */
+   uint32_tchain_id;   /* ruleset id */
 struct ifnet   *ifp;   /* interface, for ip_output */
int dir;/* packet direction */
 #defineNG_IPFW_OUT 0
 #defineNG_IPFW_IN  1
-   int flags;  /* flags, for ip_output() */
 };
 .Ed
 .Pp
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r340724 - head/sys/net

2018-11-21 Thread Oleg Bulyzhin
Author: oleg
Date: Wed Nov 21 13:34:21 2018
New Revision: 340724
URL: https://svnweb.freebsd.org/changeset/base/340724

Log:
  Unbreak kernel build with VLAN_ARRAY defined.
  
  MFC after:1 week

Modified:
  head/sys/net/if_vlan.c

Modified: head/sys/net/if_vlan.c
==
--- head/sys/net/if_vlan.c  Wed Nov 21 12:46:28 2018(r340723)
+++ head/sys/net/if_vlan.c  Wed Nov 21 13:34:21 2018(r340724)
@@ -314,15 +314,15 @@ VNET_DEFINE_STATIC(struct if_clone *, vlan_cloner);
 #defineV_vlan_cloner   VNET(vlan_cloner)
 #endif
 
-#ifndef VLAN_ARRAY
-#define HASH(n, m) n) >> 8) ^ ((n) >> 4) ^ (n)) & (m))
-
 static void
 vlan_mc_free(struct epoch_context *ctx)
 {
struct vlan_mc_entry *mc = __containerof(ctx, struct vlan_mc_entry, 
mc_epoch_ctx);
free(mc, M_VLAN);
 }
+
+#ifndef VLAN_ARRAY
+#define HASH(n, m) n) >> 8) ^ ((n) >> 4) ^ (n)) & (m))
 
 static void
 vlan_inithash(struct ifvlantrunk *trunk)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r341139 - stable/12/sys/net

2018-11-28 Thread Oleg Bulyzhin
Author: oleg
Date: Wed Nov 28 11:58:40 2018
New Revision: 341139
URL: https://svnweb.freebsd.org/changeset/base/341139

Log:
  MFC r340724:
  
  Unbreak kernel build with VLAN_ARRAY defined.

Modified:
  stable/12/sys/net/if_vlan.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/net/if_vlan.c
==
--- stable/12/sys/net/if_vlan.c Wed Nov 28 09:25:43 2018(r341138)
+++ stable/12/sys/net/if_vlan.c Wed Nov 28 11:58:40 2018(r341139)
@@ -314,15 +314,15 @@ VNET_DEFINE_STATIC(struct if_clone *, vlan_cloner);
 #defineV_vlan_cloner   VNET(vlan_cloner)
 #endif
 
-#ifndef VLAN_ARRAY
-#define HASH(n, m) n) >> 8) ^ ((n) >> 4) ^ (n)) & (m))
-
 static void
 vlan_mc_free(struct epoch_context *ctx)
 {
struct vlan_mc_entry *mc = __containerof(ctx, struct vlan_mc_entry, 
mc_epoch_ctx);
free(mc, M_VLAN);
 }
+
+#ifndef VLAN_ARRAY
+#define HASH(n, m) n) >> 8) ^ ((n) >> 4) ^ (n)) & (m))
 
 static void
 vlan_inithash(struct ifvlantrunk *trunk)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r341236 - releng/12.0/sys/net

2018-11-29 Thread Oleg Bulyzhin
Author: oleg
Date: Thu Nov 29 15:26:07 2018
New Revision: 341236
URL: https://svnweb.freebsd.org/changeset/base/341236

Log:
  MFS r341139:
  MFC r340724:
  
  Unbreak kernel build with VLAN_ARRAY defined.
  
  Approved by:  re (gjb)

Modified:
  releng/12.0/sys/net/if_vlan.c
Directory Properties:
  releng/12.0/   (props changed)

Modified: releng/12.0/sys/net/if_vlan.c
==
--- releng/12.0/sys/net/if_vlan.c   Thu Nov 29 15:07:59 2018
(r341235)
+++ releng/12.0/sys/net/if_vlan.c   Thu Nov 29 15:26:07 2018
(r341236)
@@ -314,15 +314,15 @@ VNET_DEFINE_STATIC(struct if_clone *, vlan_cloner);
 #defineV_vlan_cloner   VNET(vlan_cloner)
 #endif
 
-#ifndef VLAN_ARRAY
-#define HASH(n, m) n) >> 8) ^ ((n) >> 4) ^ (n)) & (m))
-
 static void
 vlan_mc_free(struct epoch_context *ctx)
 {
struct vlan_mc_entry *mc = __containerof(ctx, struct vlan_mc_entry, 
mc_epoch_ctx);
free(mc, M_VLAN);
 }
+
+#ifndef VLAN_ARRAY
+#define HASH(n, m) n) >> 8) ^ ((n) >> 4) ^ (n)) & (m))
 
 static void
 vlan_inithash(struct ifvlantrunk *trunk)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r304154 - head/sys/netpfil/ipfw

2016-08-15 Thread Oleg Bulyzhin
Author: oleg
Date: Mon Aug 15 13:06:29 2016
New Revision: 304154
URL: https://svnweb.freebsd.org/changeset/base/304154

Log:
  Fix command: ipfw set (enable|disable) N (where N > 4).
  enable_sets() expects set bitmasks, not set numbers.
  
  MFC after:3 days

Modified:
  head/sys/netpfil/ipfw/ip_fw_sockopt.c

Modified: head/sys/netpfil/ipfw/ip_fw_sockopt.c
==
--- head/sys/netpfil/ipfw/ip_fw_sockopt.c   Mon Aug 15 12:56:45 2016
(r304153)
+++ head/sys/netpfil/ipfw/ip_fw_sockopt.c   Mon Aug 15 13:06:29 2016
(r304154)
@@ -1420,8 +1420,10 @@ manage_sets(struct ip_fw_chain *chain, i
 
if (rh->range.head.length != sizeof(ipfw_range_tlv))
return (1);
-   if (rh->range.set >= IPFW_MAX_SETS ||
-   rh->range.new_set >= IPFW_MAX_SETS)
+   /* enable_sets() expects bitmasks. */
+   if (op3->opcode != IP_FW_SET_ENABLE &&
+   (rh->range.set >= IPFW_MAX_SETS ||
+   rh->range.new_set >= IPFW_MAX_SETS))
return (EINVAL);
 
ret = 0;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r304415 - stable/11/sys/netpfil/ipfw

2016-08-18 Thread Oleg Bulyzhin
Author: oleg
Date: Thu Aug 18 11:23:02 2016
New Revision: 304415
URL: https://svnweb.freebsd.org/changeset/base/304415

Log:
  MFC r304154
  
  Fix command: ipfw set (enable|disable) N (where N > 4).

Modified:
  stable/11/sys/netpfil/ipfw/ip_fw_sockopt.c

Modified: stable/11/sys/netpfil/ipfw/ip_fw_sockopt.c
==
--- stable/11/sys/netpfil/ipfw/ip_fw_sockopt.c  Thu Aug 18 11:17:36 2016
(r304414)
+++ stable/11/sys/netpfil/ipfw/ip_fw_sockopt.c  Thu Aug 18 11:23:02 2016
(r304415)
@@ -1414,8 +1414,10 @@ manage_sets(struct ip_fw_chain *chain, i
 
if (rh->range.head.length != sizeof(ipfw_range_tlv))
return (1);
-   if (rh->range.set >= IPFW_MAX_SETS ||
-   rh->range.new_set >= IPFW_MAX_SETS)
+   /* enable_sets() expects bitmasks. */
+   if (op3->opcode != IP_FW_SET_ENABLE &&
+   (rh->range.set >= IPFW_MAX_SETS ||
+   rh->range.new_set >= IPFW_MAX_SETS))
return (EINVAL);
 
ret = 0;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r304419 - stable/11

2016-08-18 Thread Oleg Bulyzhin
Author: oleg
Date: Thu Aug 18 11:41:58 2016
New Revision: 304419
URL: https://svnweb.freebsd.org/changeset/base/304419

Log:
  Fix directory  properties missing in previous (r304415) commit.

Modified:
Directory Properties:
  stable/11/   (props changed)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r339358 - head/sys/net

2018-11-13 Thread Oleg Bulyzhin


btw, this breaks kernel build with VLAN_ARRAY option defined.

-- 
Oleg.


=== Oleg Bulyzhin -- OBUL-RIPN -- OBUL-RIPE -- o...@rinet.ru ===


___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r309143 - head/sys/libkern

2016-11-25 Thread Oleg Bulyzhin
On Fri, Nov 25, 2016 at 01:49:33PM +, Fabien Thomas wrote:

> + if (reseed || atomic_cmpset_int(&arc4rand_iniseed_state,
> + ARC4_ENTR_HAVE, ARC4_ENTR_SEED)) {
> + ARC4_FOREACH(arc4)
> + arc4_randomstir(arc4);
> + }

How about eliminating this atomic? Converting it to:

if (reseed || arc4rand_iniseed_state == ARC4_ENTR_HAVE) {
arc4rand_iniseed_state = ARC4_ENTR_SEED;
ARC4_FOREACH(arc4);
arc4_randomstir(arc4);
}
should give you free performance boost. Having locked cmpxchg in main path is
not cheap (and as i can see it's really used only once,
when randomdev unblocks).

P.S. quick and dirty test gives me 10-30% of extra perfomance.

-- 
Oleg.

====
=== Oleg Bulyzhin -- OBUL-RIPN -- OBUL-RIPE -- o...@rinet.ru ===


___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r309281 - head/sbin/ipfw

2016-11-29 Thread Oleg Bulyzhin
Author: oleg
Date: Tue Nov 29 10:43:58 2016
New Revision: 309281
URL: https://svnweb.freebsd.org/changeset/base/309281

Log:
  Fix 'ipfw delete set N':
  do not emit meaningless 'rule 0 not found' warning if set was already empty.
  
  MFC after:1 week

Modified:
  head/sbin/ipfw/ipfw2.c

Modified: head/sbin/ipfw/ipfw2.c
==
--- head/sbin/ipfw/ipfw2.c  Tue Nov 29 08:20:55 2016(r309280)
+++ head/sbin/ipfw/ipfw2.c  Tue Nov 29 10:43:58 2016(r309281)
@@ -3221,7 +3221,7 @@ ipfw_delete(char *av[])
exitval = EX_UNAVAILABLE;
warn("rule %u: setsockopt(IP_FW_XDEL)",
rt.start_rule);
-   } else if (rt.new_set == 0) {
+   } else if (rt.new_set == 0 && do_set == 0) {
exitval = EX_UNAVAILABLE;
if (rt.start_rule != rt.end_rule)
warnx("no rules rules in %u-%u range",
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r309372 - head/sys/sys

2016-12-05 Thread Oleg Bulyzhin
On Fri, Dec 02, 2016 at 04:11:32PM +0800, Sepherosa Ziehau wrote:
> peek_clear_sc is added to address the issue you mentioned.  IMHO, this
> commit weakens the proper assertion.

I would say this check:

#ifdef DEBUG_BUFRING
int i;
for (i = br->br_cons_head; i != br->br_prod_head;
 i = ((i + 1) & br->br_cons_mask))
if(br->br_ring[i] == buf)
panic("buf=%p already enqueue at %d prod=%d cons=%d",
buf, i, br->br_prod_tail, br->br_cons_tail);
#endif

can't be relied upon:

1) it does not synchronize with anything, neither consumers nor producers.
   So you can read inconsistent data. For example, you are storing
   NULL in buf_ring_peek_clear_sc() but there is no guarantee you will see
   it here.
2) it's not covered by critical section so thread running this check can be
   preempted. Consider the following scenario: 
   a) thread is running this check and gets preempted by other producer
  before i != br->br_prod_head check.
   b) other producer moves br->br_prod_head forward.
   c) if we are unlucky we can spin forever.

Current buf_ring implementation has insufficient memory ordering constraints.
I've tried to fix acq/rel usage here:
https://reviews.freebsd.org/D8637
but didn't get any review yet.

> 
> On Fri, Dec 2, 2016 at 5:08 AM, Ryan Stone  wrote:
> > Author: rstone
> > Date: Thu Dec  1 21:08:42 2016
> > New Revision: 309372
> > URL: https://svnweb.freebsd.org/changeset/base/309372
> >
> > Log:
> >   Fix a false positive in a buf_ring assert
> >
> >   buf_ring contains an assert that checks whether an item being
> >   enqueued already exists on the ring.  There is a subtle bug in
> >   this assert.  An item can be returned by a peek() function and
> >   freed, and then the consumer thread can be preempted before
> >   calling advance().  If this happens the item appears to still be
> >   on the queue, but another thread may allocate the item from the
> >   free pool and wind up trying to enqueue it again, causing the
> >   assert to trigger incorrectly.
> >
> >   Fix this by skipping the head of the consumer's portion of the
> >   ring, as this index is what will be returned by peek().
> >
> >   Sponsored by: Dell EMC Isilon
> >   MFC After:1 week
> >   Differential Revision:https://reviews.freebsd.org/D8685
> >   Reviewed by:  hselasky
> >
> > Modified:
> >   head/sys/sys/buf_ring.h
> >
> > Modified: head/sys/sys/buf_ring.h
> > ==
> > --- head/sys/sys/buf_ring.h Thu Dec  1 20:36:48 2016(r309371)
> > +++ head/sys/sys/buf_ring.h Thu Dec  1 21:08:42 2016(r309372)
> > @@ -67,11 +67,13 @@ buf_ring_enqueue(struct buf_ring *br, vo
> > uint32_t prod_head, prod_next, cons_tail;
> >  #ifdef DEBUG_BUFRING
> > int i;
> > -   for (i = br->br_cons_head; i != br->br_prod_head;
> > -i = ((i + 1) & br->br_cons_mask))
> > -   if(br->br_ring[i] == buf)
> > -   panic("buf=%p already enqueue at %d prod=%d 
> > cons=%d",
> > -   buf, i, br->br_prod_tail, br->br_cons_tail);
> > +   if (br->br_cons_head != br->br_prod_head) {
> > +   for (i = (br->br_cons_head + 1) & br->br_cons_mask; i != 
> > br->br_prod_head;
> > +   i = ((i + 1) & br->br_cons_mask))
> > +   if(br->br_ring[i] == buf)
> > +   panic("buf=%p already enqueue at %d prod=%d 
> > cons=%d",
> > +   buf, i, br->br_prod_tail, 
> > br->br_cons_tail);
> > +   }
> >  #endif
> > critical_enter();
> > do {
> > ___
> > svn-src-all@freebsd.org mailing list
> > https://lists.freebsd.org/mailman/listinfo/svn-src-all
> > To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
> 
> 
> 
> -- 
> Tomorrow Will Never Die

-- 
Oleg.


=== Oleg Bulyzhin -- OBUL-RIPN -- OBUL-RIPE -- o...@rinet.ru ===


___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r305738 - releng/11.0/sys/netpfil/ipfw

2016-09-13 Thread Oleg Bulyzhin
On Mon, Sep 12, 2016 at 03:57:35PM +, Andrey V. Elsukov wrote:
> Author: ae
> Date: Mon Sep 12 15:57:35 2016
> New Revision: 305738
> URL: https://svnweb.freebsd.org/changeset/base/305738
> 
> Log:
>   Merge from stable/11 r304415,304419 (by oleg):
> Fix command: ipfw set (enable|disable) N (where N > 4).
>   
>   PR: 212595
>   Approved by:re (kib)

Thank you.

-- 
Oleg.

====
=== Oleg Bulyzhin -- OBUL-RIPN -- OBUL-RIPE -- o...@rinet.ru ===


___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r332402 - head/sys/netpfil/ipfw

2018-04-11 Thread Oleg Bulyzhin
Author: oleg
Date: Wed Apr 11 11:12:20 2018
New Revision: 332402
URL: https://svnweb.freebsd.org/changeset/base/332402

Log:
  Fix ipfw table creation when net.inet.ip.fw.tables_sets = 0 and non zero set
  specified on table creation. This fixes following:
  
  # sysctl net.inet.ip.fw.tables_sets
  net.inet.ip.fw.tables_sets: 0
  # ipfw table all info
  # ipfw set 1 table 1 create type addr
  # ipfw set 1 table 1 create type addr
  # ipfw add 10 set 1 count ip from table\(1\) to any
  00010 count ip from table(1) to any
  # ipfw add 10 set 1 count ip from table\(1\) to any
  00010 count ip from table(1) to any
  # ipfw table all info
  --- table(1), set(1) ---
   kindex: 4, type: addr
   references: 1, valtype: legacy
   algorithm: addr:radix
   items: 0, size: 296
  --- table(1), set(1) ---
   kindex: 3, type: addr
   references: 1, valtype: legacy
   algorithm: addr:radix
   items: 0, size: 296
  --- table(1), set(1) ---
   kindex: 2, type: addr
   references: 0, valtype: legacy
   algorithm: addr:radix
   items: 0, size: 296
  --- table(1), set(1) ---
   kindex: 1, type: addr
   references: 0, valtype: legacy
   algorithm: addr:radix
   items: 0, size: 296
  #
  
  MFC after:1 week

Modified:
  head/sys/netpfil/ipfw/ip_fw_table.c

Modified: head/sys/netpfil/ipfw/ip_fw_table.c
==
--- head/sys/netpfil/ipfw/ip_fw_table.c Wed Apr 11 10:36:20 2018
(r332401)
+++ head/sys/netpfil/ipfw/ip_fw_table.c Wed Apr 11 11:12:20 2018
(r332402)
@@ -3171,7 +3171,7 @@ alloc_table_config(struct ip_fw_chain *ch, struct tid_
if (ntlv == NULL)
return (NULL);
name = ntlv->name;
-   set = ntlv->set;
+   set = (V_fw_tables_sets == 0) ? 0 : ntlv->set;
} else {
/* Compat part: convert number to string representation */
snprintf(bname, sizeof(bname), "%d", ti->uidx);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r332403 - head/sbin/ipfw

2018-04-11 Thread Oleg Bulyzhin
Author: oleg
Date: Wed Apr 11 11:17:57 2018
New Revision: 332403
URL: https://svnweb.freebsd.org/changeset/base/332403

Log:
  Fix typo.
  
  MFC after:1 week

Modified:
  head/sbin/ipfw/ipfw.8

Modified: head/sbin/ipfw/ipfw.8
==
--- head/sbin/ipfw/ipfw.8   Wed Apr 11 11:12:20 2018(r332402)
+++ head/sbin/ipfw/ipfw.8   Wed Apr 11 11:17:57 2018(r332403)
@@ -2233,7 +2233,7 @@ of the firewall and quickly (and atomically) switch be
 By default, tables from set 0 are referenced when adding rule with
 table opcodes regardless of rule set.
 This behavior can be changed by setting
-.Va net.inet.ip.fw.tables_set
+.Va net.inet.ip.fw.tables_sets
 variable to 1.
 Rule's set will then be used for table references.
 .Pp
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r332772 - stable/11/sys/netpfil/ipfw

2018-04-19 Thread Oleg Bulyzhin
Author: oleg
Date: Thu Apr 19 15:02:42 2018
New Revision: 332772
URL: https://svnweb.freebsd.org/changeset/base/332772

Log:
  Fix ipfw table creation when net.inet.ip.fw.tables_sets = 0 and non zero set
  specified on table creation. This fixes following:
  
  # sysctl net.inet.ip.fw.tables_sets
  net.inet.ip.fw.tables_sets: 0
  # ipfw table all info
  # ipfw set 1 table 1 create type addr
  # ipfw set 1 table 1 create type addr
  # ipfw add 10 set 1 count ip from table\(1\) to any
  00010 count ip from table(1) to any
  # ipfw add 10 set 1 count ip from table\(1\) to any
  00010 count ip from table(1) to any
  # ipfw table all info
   --- table(1), set(1) ---
kindex: 4, type: addr
references: 1, valtype: legacy
algorithm: addr:radix
items: 0, size: 296
   --- table(1), set(1) ---
kindex: 3, type: addr
references: 1, valtype: legacy
algorithm: addr:radix
items: 0, size: 296
   --- table(1), set(1) ---
kindex: 2, type: addr
references: 0, valtype: legacy
algorithm: addr:radix
items: 0, size: 296
   --- table(1), set(1) ---
kindex: 1, type: addr
references: 0, valtype: legacy
algorithm: addr:radix
items: 0, size: 296
  #

Modified:
  stable/11/sys/netpfil/ipfw/ip_fw_table.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/netpfil/ipfw/ip_fw_table.c
==
--- stable/11/sys/netpfil/ipfw/ip_fw_table.cThu Apr 19 14:09:44 2018
(r332771)
+++ stable/11/sys/netpfil/ipfw/ip_fw_table.cThu Apr 19 15:02:42 2018
(r332772)
@@ -3169,7 +3169,7 @@ alloc_table_config(struct ip_fw_chain *ch, struct tid_
if (ntlv == NULL)
return (NULL);
name = ntlv->name;
-   set = ntlv->set;
+   set = (V_fw_tables_sets == 0) ? 0 : ntlv->set;
} else {
/* Compat part: convert number to string representation */
snprintf(bname, sizeof(bname), "%d", ti->uidx);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r332775 - stable/11/sbin/ipfw

2018-04-19 Thread Oleg Bulyzhin
Author: oleg
Date: Thu Apr 19 15:07:53 2018
New Revision: 332775
URL: https://svnweb.freebsd.org/changeset/base/332775

Log:
  MFC r332403:
  
  Fix a typo.

Modified:
  stable/11/sbin/ipfw/ipfw.8
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sbin/ipfw/ipfw.8
==
--- stable/11/sbin/ipfw/ipfw.8  Thu Apr 19 15:03:48 2018(r332774)
+++ stable/11/sbin/ipfw/ipfw.8  Thu Apr 19 15:07:53 2018(r332775)
@@ -2233,7 +2233,7 @@ of the firewall and quickly (and atomically) switch be
 By default, tables from set 0 are referenced when adding rule with
 table opcodes regardless of rule set.
 This behavior can be changed by setting
-.Va net.inet.ip.fw.tables_set
+.Va net.inet.ip.fw.tables_sets
 variable to 1.
 Rule's set will then be used for table references.
 .Pp
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r327013 - head/sys/net

2017-12-22 Thread Oleg Bulyzhin
On Wed, Dec 20, 2017 at 01:03:34AM +, Stephen Hurd wrote:
> Author: shurd
> Date: Wed Dec 20 01:03:34 2017
> New Revision: 327013
> URL: https://svnweb.freebsd.org/changeset/base/327013
> 
> Log:
>   Support attaching tx queues to cpus
>   
>   This will attempt to use a different thread/core on the same L2
>   cache when possible, or use the same cpu as the rx thread when not.
>   If SMP isn't enabled, don't go looking for cores to use. This is mostly
>   useful when using shared TX/RX queues.
>   
>   Reviewed by:sbruno
>   Sponsored by:   Limelight Networks
>   Differential Revision:  https://reviews.freebsd.org/D12446

i'm getting this panic:

[skipped]
ix0:  port 0xcc00-0xcc1f mem 
0xfde8-0xfdef,0xfde7c000-0xfde7 irq 18 at device 0.0 on pci2
ix0: using 2048 tx descriptors and 2048 rx descriptors
ix0: msix_init qsets capped at 16
ix0: pxm cpus: 4 queue msgs: 63 admincnt: 1
ix0: using 4 rx queues 4 tx queues 
ix0: attempting to allocate 5 MSI-X vectors (64 supported)
msi: routing MSI-X IRQ 259 to local APIC 0 vector 54
msi: routing MSI-X IRQ 260 to local APIC 0 vector 55
msi: routing MSI-X IRQ 261 to local APIC 0 vector 56
msi: routing MSI-X IRQ 262 to local APIC 0 vector 57
msi: routing MSI-X IRQ 263 to local APIC 0 vector 58
ix0: using IRQs 259-263 for MSI-X
ix0: Using MSIX interrupts with 5 vectors
ix0: allocated for 4 queues
ix0: allocated for 4 rx queues
panic: Assertion gtask->gt_taskqueue != NULL failed at 
/usr/src/sys/net/iflib.c:5177
cpuid = 0
time = 1
KDB: enter: panic
[ thread pid 0 tid 10 ]
Stopped at  kdb_enter+0x3b: movq$0,kdb_why
db> bt
Tracing pid 0 tid 10 td 0x80bf63c0
kdb_enter() at kdb_enter+0x3b/frame 0x81004130
vpanic() at vpanic+0x1b9/frame 0x810041b0
kassert_panic() at kassert_panic+0x173/frame 0x81004220
iflib_irq_set_affinity() at iflib_irq_set_affinity+0xae2/frame 
0x810042e0
iflib_irq_alloc_generic() at iflib_irq_alloc_generic+0x1f7/frame 
0x81004350
ixgbe_if_msix_intr_assign() at ixgbe_if_msix_intr_assign+0xa2/frame 
0x810043d0
iflib_device_register() at iflib_device_register+0x2a6a/frame 0x810046f0
iflib_device_attach() at iflib_device_attach+0xb7/frame 0x81004720
device_attach() at device_attach+0x3f7/frame 0x81004770
bus_generic_attach() at bus_generic_attach+0x5a/frame 0x81004790
pci_attach() at pci_attach+0xd5/frame 0x810047d0
device_attach() at device_attach+0x3f7/frame 0x81004820
bus_generic_attach() at bus_generic_attach+0x5a/frame 0x81004840
acpi_pcib_pci_attach() at acpi_pcib_pci_attach+0xa1/frame 0x81004880
device_attach() at device_attach+0x3f7/frame 0x810048d0
bus_generic_attach() at bus_generic_attach+0x5a/frame 0x810048f0
pci_attach() at pci_attach+0xd5/frame 0x81004930
device_attach() at device_attach+0x3f7/frame 0x81004980
bus_generic_attach() at bus_generic_attach+0x5a/frame 0x810049a0
acpi_pcib_acpi_attach() at acpi_pcib_acpi_attach+0x3bc/frame 0x81004a10
device_attach() at device_attach+0x3f7/frame 0x81004a60
bus_generic_attach() at bus_generic_attach+0x5a/frame 0x81004a80
acpi_attach() at acpi_attach+0xe85/frame 0x81004b30
device_attach() at device_attach+0x3f7/frame 0x81004b80
bus_generic_attach() at bus_generic_attach+0x5a/frame 0x81004ba0
nexus_acpi_attach() at nexus_acpi_attach+0x73/frame 0x81004bd0
device_attach() at device_attach+0x3f7/frame 0x81004c20
bus_generic_new_pass() at bus_generic_new_pass+0x116/frame 0x81004c50
bus_set_pass() at bus_set_pass+0x8c/frame 0x81004c80
configure() at configure+0x9/frame 0x81004c90
mi_startup() at mi_startup+0x9c/frame 0x81004cb0
btext() at btext+0x2c

-- 
Oleg.

====
=== Oleg Bulyzhin -- OBUL-RIPN -- OBUL-RIPE -- o...@rinet.ru ===


___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r327013 - head/sys/net

2017-12-22 Thread Oleg Bulyzhin
On Fri, Dec 22, 2017 at 01:22:20PM -0500, Stephen Hurd wrote:
> Can you provide me with the output of ``sysctl kern.sched.topology_spec''?

# sysctl kern.sched.topology_spec
kern.sched.topology_spec: 
 
  0, 1, 2, 3
  
   
0
   
   
1
   
   
2
   
   
3
   
  
 


> And provide the new dmesg with this added output.

ix0:  port 0xcc00-0xcc1f mem 
0xfde8-0xfdef,0xfde7c000-0xfde7 irq 18 at device 0.0 on pci2
ix0: using 2048 tx descriptors and 2048 rx descriptors
ix0: msix_init qsets capped at 16
ix0: pxm cpus: 4 queue msgs: 63 admincnt: 1
ix0: using 4 rx queues 4 tx queues
ix0: attempting to allocate 5 MSI-X vectors (64 supported)
msi: routing MSI-X IRQ 259 to local APIC 0 vector 54
msi: routing MSI-X IRQ 260 to local APIC 0 vector 55
msi: routing MSI-X IRQ 261 to local APIC 0 vector 56
msi: routing MSI-X IRQ 262 to local APIC 0 vector 57
msi: routing MSI-X IRQ 263 to local APIC 0 vector 58
ix0: using IRQs 259-263 for MSI-X
ix0: Using MSIX interrupts with 5 vectors
ix0: allocated for 4 queues
ix0: allocated for 4 rx queues
ix0: irq=259, type=0, qid=0, name=rxq0
panic: Assertion gtask->gt_taskqueue != NULL failed at 
/usr/src/sys/net/iflib.c:5178
cpuid = 0
time = 1
KDB: enter: panic

-- 
Oleg.

====
=== Oleg Bulyzhin -- OBUL-RIPN -- OBUL-RIPE -- o...@rinet.ru ===


___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r327013 - head/sys/net

2017-12-23 Thread Oleg Bulyzhin
On Fri, Dec 22, 2017 at 07:11:36PM -0500, Stephen Hurd wrote:

> Interesting... is this a standard GENERIC kernel, or is this a custom 
> config?  If a custom config, can you send it to me?
> 
> Also, does this system have any other iflib drivers?  igb, em, or bnxt?  
> Can you include the log info (if any) for them as well?

It's custom kernel on my testing machine. It has em too but ix is probed first..
If i comment out if_ix.ko load - it boots just fine (looks like if_em is
not calling iflib_irq_set_affinity()):

em0:  port 0xdc00-0xdc1f mem 0xfeae-0x
feaf,0xfeac-0xfead irq 17 at device 0.0 on pci3
em0: attach_pre capping queues at 1
em0: using 1024 tx descriptors and 1024 rx descriptors
em0: msix_init qsets capped at 1
em0: PCIY_MSIX capability not found; or rid 0 == 0.
em0: Using a Legacy interrupt
em0: allocated for 1 tx_queues
em0: allocated for 1 rx_queues
ioapic0: routing intpin 17 (PCI IRQ 17) to lapic 0 vector 54
em0: bpf attached
em0: Ethernet address: 00:15:17:3a:0c:7a
em0: netmap queues/slots: TX 1/1024, RX 1/1024

P.S. verbose dmesg & kernel conf attached

-- 
Oleg.

====
=== Oleg Bulyzhin -- OBUL-RIPN -- OBUL-RIPE -- o...@rinet.ru ===


/boot/config: 0:ad(0,a)/boot/loader -Dh -S115200

FreeBSD/x86 boot
Default: 0:ad(0,a)/boot/loader
boot:
Consoles: internal video/keyboard  serial port
BIOS drive C: is disk0
BIOS 619kB/3111360kB available memory

FreeBSD/x86 bootstrap loader, Revision 1.1
(Thu Dec 21 19:31:04 MSK 2017 r...@slave.rinet.ru)
Loading /boot/defaults/loader.conf
/boot/kernel/kernel text=0x5826b8 data=0x7d500+0x2b3378 
syms=[0x8+0x9e880+0x8+0xa0fbf]
/boot/entropy size=0x1000
/boot/kernel/nullfs.ko size 0xbd30 at 0xdf4000
/boot/kernel/geom_mirror.ko size 0x2c968 at 0xe0
/boot/kernel/ipfw.ko size 0x47820 at 0xe2d000
/boot/kernel/carp.ko size 0x13420 at 0xe75000
/boot/kernel/if_bge.ko size 0x247c8 at 0xe89000
loading required module 'miibus'
/boot/kernel/miibus.ko size 0x414b8 at 0xeae000
/boot/kernel/if_em.ko size 0x6ca88 at 0xef
/boot/kernel/if_nfe.ko size 0x13480 at 0xf5d000
/boot/kernel/if_re.ko size 0x13e98 at 0xf71000
/boot/kernel/if_ix.ko size 0x52bc0 at 0xf85000
/boot/kernel/libalias.ko size 0x19dd8 at 0xfd8000

Hit [Enter] to boot immediately, or any other key for command prompt.
Booting [/boot/kernel/kernel]...
GDB: no debug ports present
KDB: debugger backends: ddb
KDB: current backend: ddb
Table 'FACP' at 0xbdf70290
Table 'APIC' at 0xbdf70390
APIC: Found table at 0xbdf70390
APIC: Using the MADT enumerator.
Copyright (c) 1992-2017 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
The Regents of the University of California. All rights reserved.
FreeBSD is a registered trademark of The FreeBSD Foundation.
FreeBSD 12.0-CURRENT #5 r327061M: Sat Dec 23 01:53:58 MSK 2017
r...@slave.rinet.ru:/usr/obj/usr/src/amd64.amd64/sys/slave-amd64-smp-debug 
amd64
FreeBSD clang version 5.0.1 (tags/RELEASE_501/final 320880) (based on LLVM 
5.0.1)
WARNING: WITNESS option enabled, expect reduced performance.
WARNING: DIAGNOSTIC option enabled, expect reduced performance.
Table 'FACP' at 0xbdf70290
Table 'APIC' at 0xbdf70390
Table 'MCFG' at 0xbdf70420
Table 'OEMB' at 0xbdf88040
Table 'HPET' at 0xbdf7f8b0
Table 'SSDT' at 0xbdf7f8f0
ACPI: No SRAT table found
Preloaded elf kernel "/boot/kernel/kernel" at 0x80ff2000.
Preloaded boot_entropy_cache "/boot/entropy" at 0x80ffacd8.
Preloaded elf obj module "/boot/kernel/nullfs.ko" at 0x80ffad30.
Preloaded elf obj module "/boot/kernel/geom_mirror.ko" at 0x80ffb358.
Preloaded elf obj module "/boot/kernel/ipfw.ko" at 0x80ffba48.
Preloaded elf obj module "/boot/kernel/carp.ko" at 0x80ffc0f0.
Preloaded elf obj module "/boot/kernel/if_bge.ko" at 0x80ffc7d8.
Preloaded elf obj module "/boot/kernel/miibus.ko" at 0x80ffce40.
Preloaded elf obj module "/boot/kernel/if_em.ko" at 0x80ffd428.
Preloaded elf obj module "/boot/kernel/if_nfe.ko" at 0x80ffda90.
Preloaded elf obj module "/boot/kernel/if_re.ko" at 0x80ffe038.
Preloaded elf obj module "/boot/kernel/if_ix.ko" at 0x80ffe5e0.
Preloaded elf obj module "/boot/kernel/libalias.ko" at 0x80ffed08.
link_elf_obj: symbol sctp_calculate_cksum undefined
KLD file ipfw.ko - could not finalize loading
Calibrating TSC clock ... TSC clock: 3515725584 Hz
CPU: AMD Phenom(tm) II X4 970 Processor (3515.73-MHz K8-class CPU)
  Origin="AuthenticAMD"  Id=0x100f43  Family=0x10  Model=0x4  Stepping=3
  
Features=0x178bfbff
  Features2=0x802009
  AMD 
Features=0xee500800
  AMD 
Fea

Re: svn commit: r327013 - head/sys/net

2017-12-24 Thread Oleg Bulyzhin
On Sat, Dec 23, 2017 at 11:13:37PM -0500, Stephen Hurd wrote:

> Hrm, can you try it with:
> optionsEARLY_AP_STARTUP
> 
> In slave-amd64-smp-debug?

yes, it does boot now:

ix0:  port 0xcc00-0xcc1f mem 0xfd
e8-0xfdef,0xfde7c000-0xfde7 irq 18 at device 0.0 on pci2
ix0: using 2048 tx descriptors and 2048 rx descriptors
ix0: msix_init qsets capped at 16
ix0: pxm cpus: 4 queue msgs: 63 admincnt: 1
ix0: using 4 rx queues 4 tx queues
ix0: attempting to allocate 5 MSI-X vectors (64 supported)
msi: routing MSI-X IRQ 259 to local APIC 2 vector 48
msi: routing MSI-X IRQ 260 to local APIC 3 vector 48
msi: routing MSI-X IRQ 261 to local APIC 0 vector 53
msi: routing MSI-X IRQ 262 to local APIC 1 vector 49
msi: routing MSI-X IRQ 263 to local APIC 2 vector 49
ix0: using IRQs 259-263 for MSI-X
ix0: Using MSIX interrupts with 5 vectors
ix0: allocated for 4 queues
ix0: allocated for 4 rx queues
ix0: irq=259, type=0, qid=0, name=rxq0
msi: Assigning MSI-X IRQ 259 to local APIC 0 vector 54
ix0: irq=260, type=0, qid=1, name=rxq1
msi: Assigning MSI-X IRQ 260 to local APIC 1 vector 50
ix0: irq=261, type=0, qid=2, name=rxq2
msi: Assigning MSI-X IRQ 261 to local APIC 2 vector 48
ix0: irq=262, type=0, qid=3, name=rxq3
msi: Assigning MSI-X IRQ 262 to local APIC 3 vector 48
ix0: irq=259, type=1, qid=0, name=txq0
ix0: irq=260, type=1, qid=1, name=txq1
ix0: irq=261, type=1, qid=2, name=txq2
ix0: irq=262, type=1, qid=3, name=txq3
ix0: bpf attached
ix0: Ethernet address: 90:e2:ba:49:ab:70
ix0: PCI Express Bus: Speed 5.0GT/s Width x8
ix0: netmap queues/slots: TX 4/2048, RX 4/2048
random: harvesting attach, 8 bytes (4 bits) from ix0
ix1:  port 0xc880-0xc89f mem 
0xfdd8-0xfddf,0xfde78000-0xfde7bfff irq 19 at device 0.1 on pci2
ix1: using 2048 tx descriptors and 2048 rx descriptors
ix1: msix_init qsets capped at 16
ix1: pxm cpus: 4 queue msgs: 63 admincnt: 1
ix1: using 4 rx queues 4 tx queues
ix1: attempting to allocate 5 MSI-X vectors (64 supported)
msi: routing MSI-X IRQ 264 to local APIC 3 vector 49
msi: routing MSI-X IRQ 265 to local APIC 0 vector 53
msi: routing MSI-X IRQ 266 to local APIC 1 vector 49
msi: routing MSI-X IRQ 267 to local APIC 2 vector 50
msi: routing MSI-X IRQ 268 to local APIC 3 vector 50
ix1: using IRQs 264-268 for MSI-X
ix1: Using MSIX interrupts with 5 vectors
ix1: allocated for 4 queues
ix1: allocated for 4 rx queues
ix1: irq=264, type=0, qid=0, name=rxq0
msi: Assigning MSI-X IRQ 264 to local APIC 0 vector 55
ix1: irq=265, type=0, qid=1, name=rxq1
msi: Assigning MSI-X IRQ 265 to local APIC 1 vector 51
ix1: irq=266, type=0, qid=2, name=rxq2
msi: Assigning MSI-X IRQ 266 to local APIC 2 vector 51
ix1: irq=267, type=0, qid=3, name=rxq3
msi: Assigning MSI-X IRQ 267 to local APIC 3 vector 49
ix1: irq=264, type=1, qid=0, name=txq0
ix1: irq=265, type=1, qid=1, name=txq1
ix1: irq=266, type=1, qid=2, name=txq2
ix1: irq=267, type=1, qid=3, name=txq3
ix1: bpf attached
ix1: Ethernet address: 90:e2:ba:49:ab:71
ix1: PCI Express Bus: Speed 5.0GT/s Width x8
ix1: netmap queues/slots: TX 4/2048, RX 4/2048
random: harvesting attach, 8 bytes (4 bits) from ix1
random: harvesting attach, 8 bytes (4 bits) from pci2
random: harvesting attach, 8 bytes (4 bits) from pcib2

-- 
Oleg.

====
=== Oleg Bulyzhin -- OBUL-RIPN -- OBUL-RIPE -- o...@rinet.ru ===


___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r309713 - stable/11/sbin/ipfw

2016-12-08 Thread Oleg Bulyzhin
Author: oleg
Date: Thu Dec  8 12:42:36 2016
New Revision: 309713
URL: https://svnweb.freebsd.org/changeset/base/309713

Log:
  MFC r309281:
  
  Fix 'ipfw delete set N':
  do not emit meaningless 'rule 0 not found' warning if set was already empty.

Modified:
  stable/11/sbin/ipfw/ipfw2.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sbin/ipfw/ipfw2.c
==
--- stable/11/sbin/ipfw/ipfw2.c Thu Dec  8 11:39:08 2016(r309712)
+++ stable/11/sbin/ipfw/ipfw2.c Thu Dec  8 12:42:36 2016(r309713)
@@ -3194,7 +3194,7 @@ ipfw_delete(char *av[])
exitval = EX_UNAVAILABLE;
warn("rule %u: setsockopt(IP_FW_XDEL)",
rt.start_rule);
-   } else if (rt.new_set == 0) {
+   } else if (rt.new_set == 0 && do_set == 0) {
exitval = EX_UNAVAILABLE;
if (rt.start_rule != rt.end_rule)
warnx("no rules rules in %u-%u range",
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r322307 - head/sys/netinet

2017-08-09 Thread Oleg Bulyzhin
Author: oleg
Date: Wed Aug  9 10:46:34 2017
New Revision: 322307
URL: https://svnweb.freebsd.org/changeset/base/322307

Log:
  Fix comment typo.

Modified:
  head/sys/netinet/if_ether.c

Modified: head/sys/netinet/if_ether.c
==
--- head/sys/netinet/if_ether.c Wed Aug  9 10:32:51 2017(r322306)
+++ head/sys/netinet/if_ether.c Wed Aug  9 10:46:34 2017(r322307)
@@ -1279,7 +1279,7 @@ arp_mark_lle_reachable(struct llentry *la)
 }
 
 /*
- * Add pernament link-layer record for given interface address.
+ * Add permanent link-layer record for given interface address.
  */
 static __noinline void
 arp_add_ifa_lle(struct ifnet *ifp, const struct sockaddr *dst)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r322353 - head/usr.bin/calendar/calendars

2017-08-10 Thread Oleg Bulyzhin
Author: oleg
Date: Thu Aug 10 12:31:55 2017
New Revision: 322353
URL: https://svnweb.freebsd.org/changeset/base/322353

Log:
  Add myself.
  
  Reported by:  mckusick

Modified:
  head/usr.bin/calendar/calendars/calendar.freebsd

Modified: head/usr.bin/calendar/calendars/calendar.freebsd
==
--- head/usr.bin/calendar/calendars/calendar.freebsdThu Aug 10 12:30:34 
2017(r322352)
+++ head/usr.bin/calendar/calendars/calendar.freebsdThu Aug 10 12:31:55 
2017(r322353)
@@ -155,6 +155,7 @@
 04/22  Jakub Klama  born in Blachownia, Silesia, Poland, 
1989
 04/25  Richard Gallamore  born in Kissimmee, Florida, 
United States, 1987
 04/26  Rene Ladan  born in Geldrop, the Netherlands, 1980
+04/28  Oleg Bulyzhin  born in Kharkov, USSR, 1976
 04/28  Andriy Voskoboinyk  born in Bila Tserkva, Ukraine, 
1992
 04/29  Adam Weinberger  born in Berkeley, California, 
United States, 1980
 04/29  Eric Anholt  born in Portland, Oregon, United 
States, 1983
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r322628 - head/sys/boot/common

2017-08-17 Thread Oleg Bulyzhin
Author: oleg
Date: Thu Aug 17 19:39:42 2017
New Revision: 322628
URL: https://svnweb.freebsd.org/changeset/base/322628

Log:
  Fix BSD label partition end sector calculation.
  
  Reviewed by:  ae
  MFC after:2 weeks
  Differential Revision:https://reviews.freebsd.org/D12066

Modified:
  head/sys/boot/common/part.c

Modified: head/sys/boot/common/part.c
==
--- head/sys/boot/common/part.c Thu Aug 17 19:16:23 2017(r322627)
+++ head/sys/boot/common/part.c Thu Aug 17 19:39:42 2017(r322628)
@@ -506,7 +506,7 @@ ptable_bsdread(struct ptable *table, void *dev, diskre
break;
entry->part.start = le32toh(part->p_offset) - raw_offset;
entry->part.end = entry->part.start +
-   le32toh(part->p_size) + 1;
+   le32toh(part->p_size) - 1;
entry->part.type = bsd_parttype(part->p_fstype);
entry->part.index = i; /* starts from zero */
entry->type.bsd = part->p_fstype;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r323027 - in head/sys: dev/e1000 net

2017-08-31 Thread Oleg Bulyzhin
On Wed, Aug 30, 2017 at 06:56:24PM +, Sean Bruno wrote:
> Author: sbruno
> Date: Wed Aug 30 18:56:24 2017
> New Revision: 323027
> URL: https://svnweb.freebsd.org/changeset/base/323027
> 
> Log:
>   Revert r323008 and its conversion of e1000/iflib to using SX locks.
>   
>   This seems to be missing something on the 82574L causing NFS root mounts
>   to hang.

JFYI: with r323008 my test machine keeps crashing during boot:

[skipped]

pcib3: allocated I/O port range (0xdc00-0xdc1f) for rid 18 of pci0:3:0:0
pcib3: matched entry for 3.0.INTA
pcib3: slot 0 INTA hardwired to IRQ 17
em0:  port 0xdc00-0xdc1f mem 
0xfeae-0xfeaf,0xfeac-0xfead irq 17 at device 0.0 on pci3
em0: attach_pre capping queues at 1
panic: unknown mac type e

cpuid = 0
time = 1
KDB: enter: panic
[ thread pid 0 tid 10 ]
Stopped at  kdb_enter+0x3b: movq$0,kdb_why
db> bt
Tracing pid 0 tid 10 td 0x80bd5c80
kdb_enter() at kdb_enter+0x3b/frame 0x80ffc2b0
vpanic() at vpanic+0x1b9/frame 0x80ffc330
panic() at panic+0x43/frame 0x80ffc390
e1000_reset_hw_82571() at e1000_reset_hw_82571+0x626/frame 0x80ffc3d0
em_if_attach_pre() at em_if_attach_pre+0xe49/frame 0x80ffc440
iflib_device_register() at iflib_device_register+0x74b/frame 0x80ffc760
iflib_device_attach() at iflib_device_attach+0xb7/frame 0x80ffc790
device_attach() at device_attach+0x3ee/frame 0x80ffc7d0
bus_generic_attach() at bus_generic_attach+0x5a/frame 0x80ffc7f0
pci_attach() at pci_attach+0xd5/frame 0x80ffc830
device_attach() at device_attach+0x3ee/frame 0x80ffc870
bus_generic_attach() at bus_generic_attach+0x5a/frame 0x80ffc890
acpi_pcib_pci_attach() at acpi_pcib_pci_attach+0xa1/frame 0x80ffc8d0
device_attach() at device_attach+0x3ee/frame 0x80ffc910
bus_generic_attach() at bus_generic_attach+0x5a/frame 0x80ffc930
pci_attach() at pci_attach+0xd5/frame 0x80ffc970
device_attach() at device_attach+0x3ee/frame 0x80ffc9b0
bus_generic_attach() at bus_generic_attach+0x5a/frame 0x80ffc9d0
acpi_pcib_acpi_attach() at acpi_pcib_acpi_attach+0x3bc/frame 0x80ffca40
--More--^M^Mdevice_attach() at device_attach+0x3ee/frame 
0x80ffca80
bus_generic_attach() at bus_generic_attach+0x5a/frame 0x80ffcaa0
acpi_attach() at acpi_attach+0xe85/frame 0x80ffcb50
device_attach() at device_attach+0x3ee/frame 0x80ffcb90
bus_generic_attach() at bus_generic_attach+0x5a/frame 0x80ffcbb0
nexus_acpi_attach() at nexus_acpi_attach+0x73/frame 0x80ffcbe0
device_attach() at device_attach+0x3ee/frame 0x80ffcc20
bus_generic_new_pass() at bus_generic_new_pass+0x116/frame 0x80ffcc50
bus_set_pass() at bus_set_pass+0x8c/frame 0x80ffcc80
configure() at configure+0x9/frame 0x80ffcc90
mi_startup() at mi_startup+0x9c/frame 0x80ffccb0
btext() at btext+0x2c
db>

Hardware is:
# pciconf -lv|grep -A4 em0
em0@pci0:3:0:0: class=0x02 card=0x10828086 chip=0x107d8086 rev=0x06 hdr=0x00
vendor = 'Intel Corporation'
device = '82572EI Gigabit Ethernet Controller (Copper)'
class  = network
subclass   = ethernet

-- 
Oleg.

====
=== Oleg Bulyzhin -- OBUL-RIPN -- OBUL-RIPE -- o...@rinet.ru ===


___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r323050 - stable/11/sys/boot/common

2017-08-31 Thread Oleg Bulyzhin
Author: oleg
Date: Thu Aug 31 12:36:09 2017
New Revision: 323050
URL: https://svnweb.freebsd.org/changeset/base/323050

Log:
  MFC r322628: Fix BSD label partition end sector calculation.
  
  Differential Revision:https://reviews.freebsd.org/D12066

Modified:
  stable/11/sys/boot/common/part.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/boot/common/part.c
==
--- stable/11/sys/boot/common/part.cThu Aug 31 12:02:14 2017
(r323049)
+++ stable/11/sys/boot/common/part.cThu Aug 31 12:36:09 2017
(r323050)
@@ -486,7 +486,7 @@ ptable_bsdread(struct ptable *table, void *dev, diskre
break;
entry->part.start = le32toh(part->p_offset) - raw_offset;
entry->part.end = entry->part.start +
-   le32toh(part->p_size) + 1;
+   le32toh(part->p_size) - 1;
entry->part.type = bsd_parttype(part->p_fstype);
entry->part.index = i; /* starts from zero */
entry->type.bsd = part->p_fstype;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r323052 - stable/10/sys/boot/common

2017-08-31 Thread Oleg Bulyzhin
Author: oleg
Date: Thu Aug 31 13:32:01 2017
New Revision: 323052
URL: https://svnweb.freebsd.org/changeset/base/323052

Log:
  MFC r322628: Fix BSD label partition end sector calculation.
  
  Approved by:  re (marius)
  Differential Revision:https://reviews.freebsd.org/D12066

Modified:
  stable/10/sys/boot/common/part.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/boot/common/part.c
==
--- stable/10/sys/boot/common/part.cThu Aug 31 13:02:17 2017
(r323051)
+++ stable/10/sys/boot/common/part.cThu Aug 31 13:32:01 2017
(r323052)
@@ -483,7 +483,7 @@ ptable_bsdread(struct ptable *table, void *dev, diskre
break;
entry->part.start = le32toh(part->p_offset) - raw_offset;
entry->part.end = entry->part.start +
-   le32toh(part->p_size) + 1;
+   le32toh(part->p_size) - 1;
entry->part.type = bsd_parttype(part->p_fstype);
entry->part.index = i; /* starts from zero */
entry->type.bsd = part->p_fstype;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r305177 - head/sys/net

2017-05-18 Thread Oleg Bulyzhin
On Thu, Sep 01, 2016 at 06:32:35AM +, Sepherosa Ziehau wrote:
> Author: sephe
> Date: Thu Sep  1 06:32:35 2016
> New Revision: 305177
> URL: https://svnweb.freebsd.org/changeset/base/305177
> 
> Log:
>   net/vlan: Shift for pri is 13 (pri mask 0xe000) not 1.
>   
>   Reviewed by:araujo, hps
>   MFC after:  1 week
>   Sponsored by:   Microsoft
>   Differential Revision:  https://reviews.freebsd.org/D7710
> 
> Modified:
>   head/sys/net/ethernet.h
> 
> Modified: head/sys/net/ethernet.h
> ==
> --- head/sys/net/ethernet.h   Thu Sep  1 06:05:08 2016(r305176)
> +++ head/sys/net/ethernet.h   Thu Sep  1 06:32:35 2016(r305177)
> @@ -92,7 +92,7 @@ struct ether_vlan_header {
>  #define  EVL_PRIOFTAG(tag)   (((tag) >> 13) & 7)
>  #define  EVL_CFIOFTAG(tag)   (((tag) >> 12) & 1)
>  #define  EVL_MAKETAG(vlid, pri, cfi) 
> \
> - ((pri) & 7) << 1) | ((cfi) & 1)) << 12) | ((vlid) & EVL_VLID_MASK))
> + ((pri) & 7) << 13) | ((cfi) & 1)) << 12) | ((vlid) & EVL_VLID_MASK))
>  
>  /*
>   *  NOTE: 0x-0x05DC (0..1500) are generally IEEE 802.3 length fields.

Please revert this one. It's just plain wrong and previous one was ok.

If you care about readability it should be: 
((((pri) & 7) << 13) | (((cfi) & 1) << 12) | ((vlid) & EVL_VLID_MASK))

-- 
Oleg.


=== Oleg Bulyzhin -- OBUL-RIPN -- OBUL-RIPE -- o...@rinet.ru ===


___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r305177 - head/sys/net

2017-05-18 Thread Oleg Bulyzhin
On Thu, May 18, 2017 at 04:25:01PM +0200, Hans Petter Selasky wrote:
> On 05/18/17 16:04, Oleg Bulyzhin wrote:
> > On Thu, Sep 01, 2016 at 06:32:35AM +, Sepherosa Ziehau wrote:
> >> Author: sephe
> >> Date: Thu Sep  1 06:32:35 2016
> >> New Revision: 305177
> >> URL: https://svnweb.freebsd.org/changeset/base/305177
> >>
> >> Log:
> >>net/vlan: Shift for pri is 13 (pri mask 0xe000) not 1.
> >>
> >>Reviewed by:araujo, hps
> >>MFC after:  1 week
> >>Sponsored by:   Microsoft
> >>Differential Revision:  https://reviews.freebsd.org/D7710
> >>
> >> Modified:
> >>head/sys/net/ethernet.h
> >>
> >> Modified: head/sys/net/ethernet.h
> >> ==
> >> --- head/sys/net/ethernet.hThu Sep  1 06:05:08 2016
> >> (r305176)
> >> +++ head/sys/net/ethernet.hThu Sep  1 06:32:35 2016
> >> (r305177)
> >> @@ -92,7 +92,7 @@ struct ether_vlan_header {
> >>   #define  EVL_PRIOFTAG(tag)   (((tag) >> 13) & 7)
> >>   #define  EVL_CFIOFTAG(tag)   (((tag) >> 12) & 1)
> >>   #define  EVL_MAKETAG(vlid, pri, cfi) 
> >> \
> >> -  ((pri) & 7) << 1) | ((cfi) & 1)) << 12) | ((vlid) & EVL_VLID_MASK))
> >> +  ((pri) & 7) << 13) | ((cfi) & 1)) << 12) | ((vlid) & EVL_VLID_MASK))
> >>   
> >>   /*
> >>*  NOTE: 0x-0x05DC (0..1500) are generally IEEE 802.3 length fields.
> > 
> > Please revert this one. It's just plain wrong and previous one was ok.
> > 
> 
> Hi,
> 
> Can you explain a bit more what is wrong?
> 
> > If you care about readability it should be:
> > pri) & 7) << 13) | (((cfi) & 1) << 12) | ((vlid) & EVL_VLID_MASK))
> 
> Isn't this exactly what the patch is doing? -R ???

Current version is shifting pri out of uint16. If you examine parentheses:
pri is shifted left 13, then 12.
Original version did it right (shift 1, then 12 (total 13)).


-- 
Oleg.


=== Oleg Bulyzhin -- OBUL-RIPN -- OBUL-RIPE -- o...@rinet.ru ===


___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r287856 - head/sys/net

2015-09-16 Thread Oleg Bulyzhin
Author: oleg
Date: Wed Sep 16 10:07:45 2015
New Revision: 287856
URL: https://svnweb.freebsd.org/changeset/base/287856

Log:
  Remove superfluous m_freem().
  
  MFC after:1 month

Modified:
  head/sys/net/if_ethersubr.c

Modified: head/sys/net/if_ethersubr.c
==
--- head/sys/net/if_ethersubr.c Wed Sep 16 09:59:05 2015(r287855)
+++ head/sys/net/if_ethersubr.c Wed Sep 16 10:07:45 2015(r287856)
@@ -499,7 +499,6 @@ ether_input_internal(struct ifnet *ifp, 
if_printf(ifp, "cannot pullup VLAN header\n");
 #endif
if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
-   m_freem(m);
CURVNET_RESTORE();
return;
}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r297481 - head/sys/kern

2016-04-01 Thread Oleg Bulyzhin
On Fri, Apr 01, 2016 at 08:12:50AM +0200, Mateusz Guzik wrote:
> Author: mjg
> Date: Wed Apr  1 08:10:00 2016
> New Revision: 280963
> URL: https://svnweb.freebsd.org/changeset/base/297481

Something is wrong with this commit. Revision 297481 is about
head/sys/dev/hyperv/vmbus/hv_hv.c

-- 
Oleg.

====
=== Oleg Bulyzhin -- OBUL-RIPN -- OBUL-RIPE -- o...@rinet.ru ===


___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"