Re: svn commit: r277213 - in head: share/man/man9 sys/kern sys/ofed/include/linux sys/sys

2015-01-15 Thread Gleb Smirnoff
On Thu, Jan 15, 2015 at 08:14:30PM +0300, Gleb Smirnoff wrote:
T I'd dare to say that such important change simply cannot be committed
T with a thorough review from at least two people very confident in this
T area.

Of course, I typoed. I meant cannot be committed withOUT a thorough review.

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


Re: svn commit: r277213 - in head: share/man/man9 sys/kern sys/ofed/include/linux sys/sys

2015-01-15 Thread Gleb Smirnoff
  Hans,

On Thu, Jan 15, 2015 at 05:05:58PM +0100, Hans Petter Selasky wrote:
H  Eh, I have not reviewed this at all.  (I still plan to though.)
H 
H The Reviewed by was simply a CP of the review list in from the 
H Differential Revision. When you mention it should probably simply have said:
H 
H Reviewed by: sbruno @
H 
H Due to the meaning of Reviewed by in commit messages. Sorry.
H 
H BTW: Nice if people respond quickly or remove themselves from the 
H differential reviews if they don't plan to do any reviews.

I'd dare to say that such important change simply cannot be committed
with a thorough review from at least two people very confident in this
area.

Look at r24. This is the way it should be done.

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


Re: svn commit: r277213 - in head: share/man/man9 sys/kern sys/ofed/include/linux sys/sys

2015-01-21 Thread Gleb Smirnoff
  Sean,

On Tue, Jan 20, 2015 at 04:22:44PM -0800, Sean Bruno wrote:
S In our universe, this commit (right or wrong) resolved our panics.  I
S think that there is some room for improvement based on the commentary
S in this thread, but some people do indeed prefer stability over
S performance.  I hope we can come to a middle ground somewhere here.

Sorry, but this sounds very much like alchemy. We poured this stuff
into that stuff and yield in gold precipitate. We don't understand
what's going on, but let's record the recipe into our tome of aclhemy
wisdom.

So alchemy never came to a scientific level, and chemistry evolved
as science only when researchers started to measure, explain and
understand.

If we treat our precious kernel in alchemy way, we will follow
the path of alchemy, except that it took centuries for alchemy to
die, and for a software product it would take a few years.

So, for me Kip ideas sound very sensible. There could be a race
somewhere else. You tweak callout subsystem in any direction,
timings of events in kernel shift, your race is hidden.

If we fix problems w/o understanding them, we are going alchemy way.

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


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

2015-01-21 Thread Gleb Smirnoff
On Wed, Jan 21, 2015 at 04:32:55PM +, Konstantin Belousov wrote:
K Author: kib
K Date: Wed Jan 21 16:32:54 2015
K New Revision: 277489
K URL: https://svnweb.freebsd.org/changeset/base/277489
K 
K Log:
K   Do not assert that the new pipepair mutex is not initialized.  The
K   backing memory contains garbage and might trigger the assertion.

I have touched dozen of places in kernel where I do explicit M_ZERO on
allocation just to satisfy later assertion in the mtx_init. Is the
correct fix to use MTX_NEW?

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


Re: svn commit: r277486 - head/share/man/man9

2015-01-21 Thread Gleb Smirnoff
On Wed, Jan 21, 2015 at 01:48:06PM +, Gavin Atkinson wrote:
G Author: gavin
G Date: Wed Jan 21 13:48:06 2015
G New Revision: 277486
G URL: https://svnweb.freebsd.org/changeset/base/277486
G 
G Log:
G   softc is short for software context, use that phrase in the
G   device_get_softc(9) man page.

Thanks for making this term official :)

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


Re: svn commit: r277213 - in head: share/man/man9 sys/kern sys/ofed/include/linux sys/sys

2015-01-20 Thread Gleb Smirnoff
On Tue, Jan 20, 2015 at 09:51:26AM +0200, Konstantin Belousov wrote:
K  Like stated in the manual page, callout_reset_curcpu/on() does not work 
K  with MPSAFE callouts any more!
K I.e. you 'fixed' some undeterminate bugs in callout migration by not
K doing migration at all anymore.
K 
K  
K  You need to use callout_init_{mtx,rm,rw} and remove the custom locking 
K  inside the callback in the TCP stack to get it working like before!
K 
K No, you need to do this, if you think that whole callout KPI must be
K rototiled.  It is up to the person who modifies the KPI, to ensure that
K existing code is not broken.
K 
K As I understand, currently we are back to the one-cpu callouts.
K Do other people consider this situation acceptable ?

I think this isn't acceptable. The commit to a complex subsystem
lacked a review from persons involved in the system before. The
commit to subsystem broke consumers of the subsystem and this
was even done not accidentially, but due to Hans not caring about
it.

As for me this is enough to request a backout, and let the change
back in only after proper review.

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


Re: svn commit: r277213 - in head: share/man/man9 sys/kern sys/ofed/include/linux sys/sys

2015-01-20 Thread Gleb Smirnoff
  Hans,

On Tue, Jan 20, 2015 at 10:37:52AM +0100, Hans Petter Selasky wrote:
H It is not very hard to update existing callout clients and you can do it 
H too, if you need the extra bits of performance.

If it is not very hard, then you should have done that as part of
your change.

H Are there more API's than the TCP stack which you think needs an update 
H and are performance critical?

This is the question that you should have invetigated yourself before
pushing the change in.

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


Re: svn commit: r276747 - head/sys/netpfil/pf

2015-01-21 Thread Gleb Smirnoff
On Wed, Jan 07, 2015 at 11:46:31PM +0300, Gleb Smirnoff wrote:
T On Tue, Jan 06, 2015 at 09:03:04AM +, Craig Rodrigues wrote:
T C Author: rodrigc
T C Date: Tue Jan  6 09:03:03 2015
T C New Revision: 276747
T C URL: https://svnweb.freebsd.org/changeset/base/276747
T C 
T C Log:
T C   Instead of creating a purge thread for every vnet, create
T C   a single purge thread and clean up all vnets from this thread.
T C   
T C   PR: 194515
T C   Differential Revision:  D1315
T C   Submitted by:   Nikos Vassiliadis nv...@gmx.com
T 
T I am not sure that this is a good idea. The core idea of VNETs
T is that they are isolated from each other. If we serialize purging,
T then vnets are strongly affecting each other.
T 
T AFAIU, from the PR there is some panic fixed. What is the actual bug
T and why couldn't it be fixed with having per-vnet thread?

So, after closer inspection, this commit is a completely messed up.

You blindly remove kproc_exit(). What do you think would happen on
'kldunload -f pf'?

You removed PF_RULES_RLOCK(). Cool! Now the purging thread doesn't
acquire the pf lock.

You substitute rw_sleep() with tsleep(). And the latter requires
Giant to be held. If you tried your change with INVARIANTS, it
would panic immediately.

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


Re: svn commit: r276747 - head/sys/netpfil/pf

2015-01-21 Thread Gleb Smirnoff
On Tue, Jan 06, 2015 at 09:03:04AM +, Craig Rodrigues wrote:
C Author: rodrigc
C Date: Tue Jan  6 09:03:03 2015
C New Revision: 276747
C URL: https://svnweb.freebsd.org/changeset/base/276747
C 
C Log:
C   Instead of creating a purge thread for every vnet, create
C   a single purge thread and clean up all vnets from this thread.
C   
C   PR: 194515
C   Differential Revision:  D1315
C   Submitted by:   Nikos Vassiliadis nv...@gmx.com

Sorry guys, I backed this out due to broken kldunload of pf module, which
is critical when you are working with pf bugs.

I had to backout r276746 as well, since it has numerous build breakages,
that are addressed by later revisions.

That's my fault that I don't review in time, and I will try to improve
the situation.

Can you please replay r276746 again, addressing all the build problems
and send the patch to me? You can user reviews.freebsd.org if you want.

I'd like to get this in, but in a better quality.

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


svn commit: r277519 - in head/sys: net netpfil/pf

2015-01-21 Thread Gleb Smirnoff
Author: glebius
Date: Thu Jan 22 01:23:16 2015
New Revision: 277519
URL: https://svnweb.freebsd.org/changeset/base/277519

Log:
  Back out r276841, r276756, r276747, r276746. The change in r276747 is very
  very questionable, since it makes vimages more dependent on each other. But
  the reason for the backout is that it screwed up shutting down the pf purge
  threads, and now kernel immedially panics on pf module unload. Although module
  unloading isn't an advertised feature of pf, it is very important for
  development process.
  
  I'd like to not backout r276746, since in general it is good. But since it
  has introduced numerous build breakages, that later were addressed in
  r276841, r276756, r276747, I need to back it out as well. Better replay it
  in clean fashion from scratch.

Modified:
  head/sys/net/pfvar.h
  head/sys/netpfil/pf/pf.c
  head/sys/netpfil/pf/pf_if.c
  head/sys/netpfil/pf/pf_ioctl.c
  head/sys/netpfil/pf/pf_norm.c
  head/sys/netpfil/pf/pf_table.c

Modified: head/sys/net/pfvar.h
==
--- head/sys/net/pfvar.hThu Jan 22 00:52:34 2015(r277518)
+++ head/sys/net/pfvar.hThu Jan 22 01:23:16 2015(r277519)
@@ -829,6 +829,7 @@ typedef int pflog_packet_t(struct pfi_ki
 struct pf_ruleset *, struct pf_pdesc *, int);
 extern pflog_packet_t  *pflog_packet_ptr;
 
+#defineV_pf_end_threadsVNET(pf_end_threads)
 #endif /* _KERNEL */
 
 #definePFSYNC_FLAG_SRCNODE 0x04
@@ -1494,7 +1495,7 @@ VNET_DECLARE(struct pf_altqqueue *,pf_
 VNET_DECLARE(struct pf_rulequeue, pf_unlinked_rules);
 #defineV_pf_unlinked_rules VNET(pf_unlinked_rules)
 
-voidpf_vnet_initialize(void);
+voidpf_initialize(void);
 voidpf_mtag_initialize(void);
 voidpf_mtag_cleanup(void);
 voidpf_cleanup(void);
@@ -1586,7 +1587,7 @@ int   pf_match_addr_range(struct pf_addr *
struct pf_addr *, sa_family_t);
 intpf_match_port(u_int8_t, u_int16_t, u_int16_t, u_int16_t);
 
-void   pf_vnet_normalize_init(void);
+void   pf_normalize_init(void);
 void   pf_normalize_cleanup(void);
 intpf_normalize_ip(struct mbuf **, int, struct pfi_kif *, u_short *,
struct pf_pdesc *);
@@ -1648,7 +1649,7 @@ MALLOC_DECLARE(PFI_MTYPE);
 VNET_DECLARE(struct pfi_kif *,  pfi_all);
 #defineV_pfi_allVNET(pfi_all)
 
-voidpfi_vnet_initialize(void);
+voidpfi_initialize(void);
 voidpfi_cleanup(void);
 voidpfi_kif_ref(struct pfi_kif *);
 voidpfi_kif_unref(struct pfi_kif *);

Modified: head/sys/netpfil/pf/pf.c
==
--- head/sys/netpfil/pf/pf.cThu Jan 22 00:52:34 2015(r277518)
+++ head/sys/netpfil/pf/pf.cThu Jan 22 01:23:16 2015(r277519)
@@ -151,7 +151,6 @@ static VNET_DEFINE(struct pf_send_head, 
 #defineV_pf_sendqueue  VNET(pf_sendqueue)
 
 static struct mtx pf_sendqueue_mtx;
-MTX_SYSINIT(pf_sendqueue_mtx, pf_sendqueue_mtx, pf send queue, MTX_DEF);
 #definePF_SENDQ_LOCK() mtx_lock(pf_sendqueue_mtx)
 #definePF_SENDQ_UNLOCK()   mtx_unlock(pf_sendqueue_mtx)
 
@@ -173,15 +172,11 @@ static VNET_DEFINE(struct task, pf_overl
 #defineV_pf_overloadtask   VNET(pf_overloadtask)
 
 static struct mtx pf_overloadqueue_mtx;
-MTX_SYSINIT(pf_overloadqueue_mtx, pf_overloadqueue_mtx,
-pf overload/flush queue, MTX_DEF);
 #definePF_OVERLOADQ_LOCK() mtx_lock(pf_overloadqueue_mtx)
 #definePF_OVERLOADQ_UNLOCK()   mtx_unlock(pf_overloadqueue_mtx)
 
 VNET_DEFINE(struct pf_rulequeue, pf_unlinked_rules);
 struct mtx pf_unlnkdrules_mtx;
-MTX_SYSINIT(pf_unlnkdrules_mtx, pf_unlnkdrules_mtx, pf unlinked rules,
-MTX_DEF);
 
 static VNET_DEFINE(uma_zone_t, pf_sources_z);
 #defineV_pf_sources_z  VNET(pf_sources_z)
@@ -295,6 +290,8 @@ static void  pf_route6(struct mbuf **, 
 
 int in4_cksum(struct mbuf *m, u_int8_t nxt, int off, int len);
 
+VNET_DECLARE(int, pf_end_threads);
+
 VNET_DEFINE(struct pf_limit, pf_limits[PF_LIMIT_MAX]);
 
 #definePACKET_LOOPED(pd)   ((pd)-pf_mtag
\
@@ -731,7 +728,7 @@ pf_mtag_initialize()
 
 /* Per-vnet data storage structures initialization. */
 void
-pf_vnet_initialize()
+pf_initialize()
 {
struct pf_keyhash   *kh;
struct pf_idhash*ih;
@@ -791,9 +788,13 @@ pf_vnet_initialize()
STAILQ_INIT(V_pf_sendqueue);
SLIST_INIT(V_pf_overloadqueue);
TASK_INIT(V_pf_overloadtask, 0, pf_overload_task, curvnet);
+   mtx_init(pf_sendqueue_mtx, pf send queue, NULL, MTX_DEF);
+   mtx_init(pf_overloadqueue_mtx, pf overload/flush queue, NULL,
+   MTX_DEF);
 
/* Unlinked, 

svn commit: r277258 - head/usr.sbin/ngctl

2015-01-16 Thread Gleb Smirnoff
Author: glebius
Date: Fri Jan 16 18:51:26 2015
New Revision: 277258
URL: https://svnweb.freebsd.org/changeset/base/277258

Log:
  Plug mutex leak.
  
  MFC after:1 week
  Sponsored by: Nginx, Inc.

Modified:
  head/usr.sbin/ngctl/main.c

Modified: head/usr.sbin/ngctl/main.c
==
--- head/usr.sbin/ngctl/main.c  Fri Jan 16 18:47:20 2015(r277257)
+++ head/usr.sbin/ngctl/main.c  Fri Jan 16 18:51:26 2015(r277258)
@@ -324,8 +324,10 @@ DoInteractive(void)
history(hist, hev, H_ENTER, buf);
pthread_kill(monitor, SIGUSR1);
pthread_mutex_lock(mutex);
-   if (DoParseCommand(buf) == CMDRTN_QUIT)
+   if (DoParseCommand(buf) == CMDRTN_QUIT) {
+   pthread_mutex_unlock(mutex);
break;
+   }
pthread_cond_signal(cond);
pthread_mutex_unlock(mutex);
}
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


Re: svn commit: r276747 - head/sys/netpfil/pf

2015-01-22 Thread Gleb Smirnoff
On Thu, Jan 22, 2015 at 10:09:41PM +0100, Nikos Vassiliadis wrote:
N  Sorry guys, I backed this out due to broken kldunload of pf module, which
N  is critical when you are working with pf bugs.
N 
N For sure. 100% understood.
N 
N  I had to backout r276746 as well, since it has numerous build breakages,
N  that are addressed by later revisions.
N 
N  That's my fault that I don't review in time, and I will try to improve
N  the situation.
N 
N  Can you please replay r276746 again, addressing all the build problems
N  and send the patch to me? You can user reviews.freebsd.org if you want.
N 
N  I'd like to get this in, but in a better quality.
N 
N I'd like to get involved again and help you fixing pf. Craig could you
N replay 276746?

Erm, I didn't mean replaying 276746 as svn commit. I meant: checkout head,
reapply r276746, fix all build breakages, and submit the patch to me.

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


Re: svn commit: r277530 - head/sys/netinet

2015-01-22 Thread Gleb Smirnoff
On Thu, Jan 22, 2015 at 05:09:54PM +, Will Andrews wrote:
W Author: will
W Date: Thu Jan 22 17:09:54 2015
W New Revision: 277530
W URL: https://svnweb.freebsd.org/changeset/base/277530
W 
W Log:
W   Improve CARP logging so that all state transitions are logged.
W   
W   sys/netinet/ip_carp.c:
W  Add a reason string parameter to carp_set_state() and
W  carp_master_down_locked() allowing more specific logging
W  information to be passed into these apis.
W   
W  Refactor existing state transition logging into a single
W  log call in carp_set_state().
W   
W  Update all calls to carp_set_state() and
W  carp_master_down_locked() to pass an appropriate reason
W  string.  For state transitions that were previously logged,
W  the output should be unchanged.
W   
W   Submitted by:  gibbs (original), asomers (updated)
W   MFC after: 1 week
W   Sponsored by:  Spectra Logic
W   MFSpectraBSD:  1039697 on 2014/02/11 (original)
W  1049992 on 2014/03/21 (updated)

Very nice, thanks!

The only thing I'd suggest to change is SIOCSVH. You and me, we understand
this enchantment word, but average user Joe doesn't. :) May be a text like
user requested or something else. I don't insist on anything, as I am not
native speaker, but anything except of SIOCSVH :)

P.S. Abbreviation hw might also be improved.

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


Re: svn commit: r278640 - head/sys/netgraph

2015-02-16 Thread Gleb Smirnoff
On Mon, Feb 16, 2015 at 03:10:50AM -0800, Julian Elischer wrote:
J On 2/13/15 4:05 PM, Gleb Smirnoff wrote:
J Hi!
J 
J  On Thu, Feb 12, 2015 at 10:20:34PM +, Gleb Smirnoff wrote:
J  T Author: glebius
J  T Date: Thu Feb 12 22:20:34 2015
J  T New Revision: 278640
J  T URL: https://svnweb.freebsd.org/changeset/base/278640
J  T
J  T Log:
J  T   Revise default limit for maximum of netgraph data items.
J  T   With modern internet speeds the limit can be reached even
J  T   on a single L2TP link.
J 
J  Actually any ng_item of data type requires an mbuf to be connected
J  to it, and thus I suggest to use mbuf limits to drive ng_item limits.
J 
J  If we got an item leak with mbufs being properly freed, then we've
J  got a bug to fix, and any limit won't work in long run time. I never
J  evidenced such a bug, but there complaints on hitting limit at
J  traffic bursts. As said, with previous 512 item limit I experienced
J  that even on a laptop.
J 
J  Any objections on removing the limit, guys?
J maybe derived from it, but not the same number.
J maybe change the systctl to define the relationship?

I guess you want to have ng_items limit smaller than mbuf limit?
How smaller?

What problem are we actually guarding against putting this limit?

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


svn commit: r278859 - head/sys/net

2015-02-16 Thread Gleb Smirnoff
Author: glebius
Date: Mon Feb 16 18:33:33 2015
New Revision: 278859
URL: https://svnweb.freebsd.org/changeset/base/278859

Log:
  Commit a miss from r278843.
  
  Pointy hat to:glebius

Modified:
  head/sys/net/pfvar.h

Modified: head/sys/net/pfvar.h
==
--- head/sys/net/pfvar.hMon Feb 16 18:06:24 2015(r278858)
+++ head/sys/net/pfvar.hMon Feb 16 18:33:33 2015(r278859)
@@ -1589,6 +1589,7 @@ int   pf_match_addr_range(struct pf_addr *
 intpf_match_port(u_int8_t, u_int16_t, u_int16_t, u_int16_t);
 
 void   pf_normalize_init(void);
+intpf_refragment6(struct ifnet *, struct mbuf **, struct m_tag *mtag);
 void   pf_normalize_cleanup(void);
 intpf_normalize_ip(struct mbuf **, int, struct pfi_kif *, u_short *,
struct pf_pdesc *);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


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

2015-02-16 Thread Gleb Smirnoff
On Mon, Feb 16, 2015 at 06:06:25PM +, Brad Davis wrote:
B Author: brd (doc committer)
B Date: Mon Feb 16 18:06:24 2015
B New Revision: 278858
B URL: https://svnweb.freebsd.org/changeset/base/278858
B 
B Log:
B   Fix build.
B   
B   Approved by:   gibbs

Thanks, Brad and Justin. My failure.

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


Re: svn commit: r278080 - head/sbin/ifconfig

2015-02-12 Thread Gleb Smirnoff
On Mon, Feb 02, 2015 at 01:03:05PM +, Vsevolod Stakhov wrote:
V Author: vsevolod (ports committer)
V Date: Mon Feb  2 13:03:04 2015
V New Revision: 278080
V URL: https://svnweb.freebsd.org/changeset/base/278080
V 
V Log:
V   Reorganize the list of addresses associated with an interface and group 
them
V   based on the address family. This should help to recognize interfaces with
V   multiple AF (e.g. ipv4 and ipv6) with many aliases or additional 
addresses. The
V   order of addresses inside a single group is strictly preserved.
V   
V   Improve the scope_id output for AF_INET6 families, as the
V   current approach uses hexadecimal string that is basically the ID of an
V   interface, whilst this information is already depicted by getnameinfo(3) 
call.
V   Therefore, now ifconfig just prints the scope of address as it is defined 
in
V   2.4 of RFC 2373.
V   
V   PR:197270
V   Approved by:   bapt
V   MFC after: 2 weeks

What about getifaddrs(3) sorting addresses?

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


svn commit: r278640 - head/sys/netgraph

2015-02-12 Thread Gleb Smirnoff
Author: glebius
Date: Thu Feb 12 22:20:34 2015
New Revision: 278640
URL: https://svnweb.freebsd.org/changeset/base/278640

Log:
  Revise default limit for maximum of netgraph data items.
  With modern internet speeds the limit can be reached even
  on a single L2TP link.

Modified:
  head/sys/netgraph/ng_base.c

Modified: head/sys/netgraph/ng_base.c
==
--- head/sys/netgraph/ng_base.c Thu Feb 12 21:20:28 2015(r278639)
+++ head/sys/netgraph/ng_base.c Thu Feb 12 22:20:34 2015(r278640)
@@ -2952,7 +2952,7 @@ uma_zone_tng_qzone;
 uma_zone_t ng_qdzone;
 static int numthreads = 0; /* number of queue threads */
 static int maxalloc = 4096;/* limit the damage of a leak */
-static int maxdata = 512;  /* limit the damage of a DoS */
+static int maxdata = 4096; /* limit the damage of a DoS */
 
 SYSCTL_INT(_net_graph, OID_AUTO, threads, CTLFLAG_RDTUN, numthreads,
 0, Number of queue processing threads);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r278913 - in head/sys: conf modules/cxgbe/if_cxgbe modules/drm2/radeonkms modules/ibcore modules/ipoib modules/mlx4 modules/mlx4ib modules/mlxen modules/mthca ofed/drivers/net/mlx4

2015-02-17 Thread Gleb Smirnoff
Author: glebius
Date: Tue Feb 17 19:27:14 2015
New Revision: 278913
URL: https://svnweb.freebsd.org/changeset/base/278913

Log:
Globally enable -fms-extensions when building kernel with gcc, and remove
  this option from all modules that enable it theirselves.
In C mode -fms-extensions option enables anonymous structs and unions,
  allowing us to use this C11 feature in kernel. Of course, clang supports
  it without any extra options.
  
  Reviewed by:  dim

Modified:
  head/sys/conf/files
  head/sys/conf/kern.mk
  head/sys/conf/kern.pre.mk
  head/sys/conf/kmod.mk
  head/sys/modules/cxgbe/if_cxgbe/Makefile
  head/sys/modules/drm2/radeonkms/Makefile
  head/sys/modules/ibcore/Makefile
  head/sys/modules/ipoib/Makefile
  head/sys/modules/mlx4/Makefile
  head/sys/modules/mlx4ib/Makefile
  head/sys/modules/mlxen/Makefile
  head/sys/modules/mthca/Makefile
  head/sys/ofed/drivers/net/mlx4/Makefile

Modified: head/sys/conf/files
==
--- head/sys/conf/files Tue Feb 17 19:15:07 2015(r278912)
+++ head/sys/conf/files Tue Feb 17 19:27:14 2015(r278913)
@@ -1141,7 +1141,7 @@ dev/cxgb/sys/uipc_mvec.c  optional cxgb p
 dev/cxgb/cxgb_t3fw.c   optional cxgb cxgb_t3fw \
compile-with ${NORMAL_C} -I$S/dev/cxgb
 dev/cxgbe/t4_mp_ring.c optional cxgbe pci \
-   compile-with ${NORMAL_C} -I$S/dev/cxgbe ${GCC_MS_EXTENSIONS}
+   compile-with ${NORMAL_C} -I$S/dev/cxgbe
 dev/cxgbe/t4_main.coptional cxgbe pci \
compile-with ${NORMAL_C} -I$S/dev/cxgbe
 dev/cxgbe/t4_netmap.c  optional cxgbe pci \

Modified: head/sys/conf/kern.mk
==
--- head/sys/conf/kern.mk   Tue Feb 17 19:15:07 2015(r278912)
+++ head/sys/conf/kern.mk   Tue Feb 17 19:27:14 2015(r278913)
@@ -39,7 +39,6 @@ CLANG_NO_IAS34= -no-integrated-as
 .endif
 
 .if ${COMPILER_TYPE} == gcc
-GCC_MS_EXTENSIONS= -fms-extensions
 .if ${COMPILER_VERSION} = 40300
 # Catch-all for all the things that are in our tree, but for which we're
 # not yet ready for this compiler. Note: we likely only really support

Modified: head/sys/conf/kern.pre.mk
==
--- head/sys/conf/kern.pre.mk   Tue Feb 17 19:15:07 2015(r278912)
+++ head/sys/conf/kern.pre.mk   Tue Feb 17 19:27:14 2015(r278913)
@@ -97,7 +97,7 @@ CFLAGS_PARAM_LARGE_FUNCTION_GROWTH?=1000
 .if ${MACHINE_CPUARCH} == mips
 CFLAGS_ARCH_PARAMS?=--param max-inline-insns-single=1000
 .endif
-CFLAGS.gcc+= -fno-common -finline-limit=${INLINE_LIMIT}
+CFLAGS.gcc+= -fno-common -fms-extensions -finline-limit=${INLINE_LIMIT}
 CFLAGS.gcc+= --param inline-unit-growth=${CFLAGS_PARAM_INLINE_UNIT_GROWTH}
 CFLAGS.gcc+= --param 
large-function-growth=${CFLAGS_PARAM_LARGE_FUNCTION_GROWTH}
 .if defined(CFLAGS_ARCH_PARAMS)
@@ -162,7 +162,7 @@ NORMAL_LINT=${LINT} ${LINTFLAGS} ${CFLA
 # Infiniband C flags.  Correct include paths and omit errors that linux
 # does not honor.
 OFEDINCLUDES=  -I$S/ofed/include/
-OFEDNOERR= -Wno-cast-qual -Wno-pointer-arith ${GCC_MS_EXTENSIONS}
+OFEDNOERR= -Wno-cast-qual -Wno-pointer-arith
 OFEDCFLAGS=${CFLAGS:N-I*} ${OFEDINCLUDES} ${CFLAGS:M-I*} ${OFEDNOERR}
 OFED_C_NOIMP=  ${CC} -c -o ${.TARGET} ${OFEDCFLAGS} ${WERROR} ${PROF}
 OFED_C=${OFED_C_NOIMP} ${.IMPSRC}

Modified: head/sys/conf/kmod.mk
==
--- head/sys/conf/kmod.mk   Tue Feb 17 19:15:07 2015(r278912)
+++ head/sys/conf/kmod.mk   Tue Feb 17 19:27:14 2015(r278913)
@@ -105,6 +105,7 @@ CFLAGS+=-I. -I${SYSDIR}
 CFLAGS+=   -I${SYSDIR}/contrib/altq
 
 CFLAGS.gcc+=   -finline-limit=${INLINE_LIMIT}
+CFLAGS.gcc+=   -fms-extensions
 CFLAGS.gcc+= --param inline-unit-growth=100
 CFLAGS.gcc+= --param large-function-growth=1000
 

Modified: head/sys/modules/cxgbe/if_cxgbe/Makefile
==
--- head/sys/modules/cxgbe/if_cxgbe/MakefileTue Feb 17 19:15:07 2015
(r278912)
+++ head/sys/modules/cxgbe/if_cxgbe/MakefileTue Feb 17 19:27:14 2015
(r278913)
@@ -26,4 +26,3 @@ SRCS+=t4_tracer.c
 CFLAGS+= -I${CXGBE}
 
 .include bsd.kmod.mk
-CFLAGS+= ${GCC_MS_EXTENSIONS}

Modified: head/sys/modules/drm2/radeonkms/Makefile
==
--- head/sys/modules/drm2/radeonkms/MakefileTue Feb 17 19:15:07 2015
(r278912)
+++ head/sys/modules/drm2/radeonkms/MakefileTue Feb 17 19:27:14 2015
(r278913)
@@ -106,6 +106,6 @@ SRCS+=  
\
iicbus_if.h \
pci_if.h
 
-CFLAGS  += -I${.CURDIR}/../../../dev/drm2/radeon 

Re: svn commit: r278831 - head/sys/netpfil/pf

2015-02-17 Thread Gleb Smirnoff
On Tue, Feb 17, 2015 at 09:31:34AM -0800, John-Mark Gurney wrote:
J Gleb Smirnoff wrote this message on Mon, Feb 16, 2015 at 03:38 +:
J  Author: glebius
J  Date: Mon Feb 16 03:38:27 2015
J  New Revision: 278831
J  URL: https://svnweb.freebsd.org/changeset/base/278831
J  
J  Log:
JUpdate the pf fragment handling code to closer match recent OpenBSD.
JThat partially fixes IPv6 fragment handling. Thanks to Kristof for
Jworking on that.
J
JSubmitted by:Kristof Provost
JTested by:   peter
JDifferential Revision:   D1765
J 
J Looks like pf_flush_fragments still called in !INET case, though only
J defined for INET case:
J /scratch/tmp/jmg/src.head/sys/modules/pf/../../netpfil/pf/pf_norm.c:385:3: 
error: implicit declaration of function 'pf_flush_fragments' is invalid in C99 
[-Werror,-Wimplicit-function-declaration]
J pf_flush_fragments();
J 
J when compiling LINT-NOINET kernel..
J 
J at least as of r278883...
J 
J We need to get Jenkins to be compiling the LINT-NOINET kernel too..

Strange, since r278874 was tested with KERNCONF=LINT LINT-NOINET LINT-NOINET6.

I will take a look.

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


svn commit: r278914 - in head/sys: kern sys

2015-02-17 Thread Gleb Smirnoff
Author: glebius
Date: Tue Feb 17 19:32:11 2015
New Revision: 278914
URL: https://svnweb.freebsd.org/changeset/base/278914

Log:
  Use anonymous unions to add possibility to put mbufs into queue(3)
  STAILQs and SLISTs using the same structure field as good old m_next
  and m_nextpkt linkage occupy.
  
  New code is encouraged to use queue(3) macros, instead of implementing
  the wheel. However, better not to have a mixture of old style and
  queue(3) in one file or subsystem.
  
  Reviewed by:  rwatson, rrs, rpaulo
  Differential Revision:D1499

Modified:
  head/sys/kern/uipc_mbuf.c
  head/sys/sys/mbuf.h

Modified: head/sys/kern/uipc_mbuf.c
==
--- head/sys/kern/uipc_mbuf.c   Tue Feb 17 19:27:14 2015(r278913)
+++ head/sys/kern/uipc_mbuf.c   Tue Feb 17 19:32:11 2015(r278914)
@@ -120,6 +120,18 @@ CTASSERT(sizeof(struct struct_m_ext) == 
 #endif
 
 /*
+ * Assert that the queue(3) macros produce code of the same size as an old
+ * plain pointer does.
+ */
+#ifdef INVARIANTS
+static struct mbuf m_assertbuf;
+CTASSERT(sizeof(m_assertbuf.m_slist) == sizeof(m_assertbuf.m_next));
+CTASSERT(sizeof(m_assertbuf.m_stailq) == sizeof(m_assertbuf.m_next));
+CTASSERT(sizeof(m_assertbuf.m_slistpkt) == sizeof(m_assertbuf.m_nextpkt));
+CTASSERT(sizeof(m_assertbuf.m_stailqpkt) == sizeof(m_assertbuf.m_nextpkt));
+#endif
+
+/*
  * m_get2() allocates minimum mbuf that would fit size argument.
  */
 struct mbuf *

Modified: head/sys/sys/mbuf.h
==
--- head/sys/sys/mbuf.h Tue Feb 17 19:27:14 2015(r278913)
+++ head/sys/sys/mbuf.h Tue Feb 17 19:32:11 2015(r278914)
@@ -184,8 +184,16 @@ struct mbuf {
 * Compile-time assertions in uipc_mbuf.c test these values to ensure
 * that they are correct.
 */
-   struct mbuf *m_next;/* next buffer in chain */
-   struct mbuf *m_nextpkt; /* next chain in queue/record */
+   union { /* next buffer in chain */
+   struct mbuf *m_next;
+   SLIST_ENTRY(mbuf)   m_slist;
+   STAILQ_ENTRY(mbuf)  m_stailq;
+   };
+   union { /* next chain in queue/record */
+   struct mbuf *m_nextpkt;
+   SLIST_ENTRY(mbuf)   m_slistpkt;
+   STAILQ_ENTRY(mbuf)  m_stailqpkt;
+   };
caddr_t  m_data;/* location of data */
int32_t  m_len; /* amount of data in this mbuf */
uint32_t m_type:8,  /* type of data in this mbuf */
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r278920 - in head/sys: kern sys

2015-02-17 Thread Gleb Smirnoff
Author: glebius
Date: Tue Feb 17 20:52:51 2015
New Revision: 278920
URL: https://svnweb.freebsd.org/changeset/base/278920

Log:
Use anonymous unions and structs to organize shared space in mbuf(9),
  instead of preprocessor macros.
This will make debugger output of 'print *m' exactly match the names
  we use in code, making life of a kernel hacker way more pleasant. And
  this also allows to rename struct_m_ext back to m_ext.

Modified:
  head/sys/kern/uipc_mbuf.c
  head/sys/sys/mbuf.h

Modified: head/sys/kern/uipc_mbuf.c
==
--- head/sys/kern/uipc_mbuf.c   Tue Feb 17 20:37:21 2015(r278919)
+++ head/sys/kern/uipc_mbuf.c   Tue Feb 17 20:52:51 2015(r278920)
@@ -112,11 +112,11 @@ CTASSERT(offsetof(struct mbuf, m_pktdat)
 #if defined(__LP64__)
 CTASSERT(offsetof(struct mbuf, m_dat) == 32);
 CTASSERT(sizeof(struct pkthdr) == 56);
-CTASSERT(sizeof(struct struct_m_ext) == 48);
+CTASSERT(sizeof(struct m_ext) == 48);
 #else
 CTASSERT(offsetof(struct mbuf, m_dat) == 24);
 CTASSERT(sizeof(struct pkthdr) == 48);
-CTASSERT(sizeof(struct struct_m_ext) == 28);
+CTASSERT(sizeof(struct m_ext) == 28);
 #endif
 
 /*

Modified: head/sys/sys/mbuf.h
==
--- head/sys/sys/mbuf.h Tue Feb 17 20:37:21 2015(r278919)
+++ head/sys/sys/mbuf.h Tue Feb 17 20:52:51 2015(r278920)
@@ -65,8 +65,8 @@
  * they are sensible.
  */
 struct mbuf;
-#defineMHSIZE  offsetof(struct mbuf, M_dat.M_databuf)
-#defineMPKTHSIZE   offsetof(struct mbuf, 
M_dat.MH.MH_dat.MH_databuf)
+#defineMHSIZE  offsetof(struct mbuf, m_dat)
+#defineMPKTHSIZE   offsetof(struct mbuf, m_pktdat)
 #defineMLEN((int)(MSIZE - MHSIZE))
 #defineMHLEN   ((int)(MSIZE - MPKTHSIZE))
 #defineMINCLSIZE   (MHLEN + 1)
@@ -160,7 +160,7 @@ struct pkthdr {
  * Compile-time assertions in uipc_mbuf.c test these values to ensure that
  * they are correct.
  */
-struct struct_m_ext {
+struct m_ext {
volatile u_int  *ext_cnt;   /* pointer to ref count info */
caddr_t  ext_buf;   /* start of buffer */
uint32_t ext_size;  /* size of buffer, for ext_free */
@@ -211,19 +211,15 @@ struct mbuf {
 */
union {
struct {
-   struct pkthdr   MH_pkthdr;  /* M_PKTHDR set */
+   struct pkthdr   m_pkthdr;   /* M_PKTHDR set */
union {
-   struct struct_m_ext MH_ext; /* M_EXT set */
-   charMH_databuf[0];
-   } MH_dat;
-   } MH;
-   charM_databuf[0];   /* !M_PKTHDR, !M_EXT */
-   } M_dat;
+   struct m_extm_ext;  /* M_EXT set */
+   charm_pktdat[0];
+   };
+   };
+   charm_dat[0];   /* !M_PKTHDR, !M_EXT */
+   };
 };
-#definem_pkthdrM_dat.MH.MH_pkthdr
-#definem_ext   M_dat.MH.MH_dat.MH_ext
-#definem_pktdatM_dat.MH.MH_dat.MH_databuf
-#definem_dat   M_dat.M_databuf
 
 /*
  * mbuf flags of global significance and layer crossing.
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


Re: svn commit: r278831 - head/sys/netpfil/pf

2015-02-17 Thread Gleb Smirnoff
On Wed, Feb 18, 2015 at 01:40:36AM +0400, Sergey Kandaurov wrote:
S On 17 February 2015 at 20:31, John-Mark Gurney j...@funkthat.com wrote:
S  Gleb Smirnoff wrote this message on Mon, Feb 16, 2015 at 03:38 +:
S  Author: glebius
S  Date: Mon Feb 16 03:38:27 2015
S  New Revision: 278831
S  URL: https://svnweb.freebsd.org/changeset/base/278831
S 
S  Log:
SUpdate the pf fragment handling code to closer match recent OpenBSD.
SThat partially fixes IPv6 fragment handling. Thanks to Kristof for
Sworking on that.
S 
SSubmitted by:   Kristof Provost
STested by:  peter
SDifferential Revision:  D1765
S 
S  Looks like pf_flush_fragments still called in !INET case, though only
S  defined for INET case:
S  /scratch/tmp/jmg/src.head/sys/modules/pf/../../netpfil/pf/pf_norm.c:385:3: 
error: implicit declaration of function 'pf_flush_fragments' is invalid in C99 
[-Werror,-Wimplicit-function-declaration]
S  pf_flush_fragments();
S 
S  when compiling LINT-NOINET kernel..
S 
S With the changes attached I got all three kernels with both cc compiled
S (tested on MINI w/ MODULES_OVERRIDE=pf). Basically,
S - pf_flush_fragments is improperly INET-only
S - pf_find_fragment is properly declared, but its body is under INET
S - pf_refragment6 / pf_reassemble6 are properly under INET6,
S   which is also under INET (the latter is wrong).
S - bonus: some functions may be / were static'ized.

Thanks, looks very close to patch that I'm build testing now.

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


svn commit: r278988 - head/usr.sbin

2015-02-18 Thread Gleb Smirnoff
Author: glebius
Date: Thu Feb 19 06:27:14 2015
New Revision: 278988
URL: https://svnweb.freebsd.org/changeset/base/278988

Log:
  Temporarily disconnect ifmcstat(8) from build, to make world buildable
  ifmcstat(8) noses in kernel memory too much, and thus is very tentative
  to any changes in kernel.
  
  I will rewrite it to use some API instead of libkvm(3) and connect back
  to build.

Modified:
  head/usr.sbin/Makefile

Modified: head/usr.sbin/Makefile
==
--- head/usr.sbin/Makefile  Thu Feb 19 06:24:27 2015(r278987)
+++ head/usr.sbin/Makefile  Thu Feb 19 06:27:14 2015(r278988)
@@ -33,7 +33,7 @@ SUBDIR=   adduser \
getpmac \
gstat \
i2c \
-   ifmcstat \
+#  ifmcstat \
iostat \
kldxref \
mailwrapper \
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


Re: svn commit: r278979 - head/sys/netinet6

2015-02-18 Thread Gleb Smirnoff
On Thu, Feb 19, 2015 at 02:22:33PM +0800, Alastair Hogge wrote:
A On 2015-02-19 Thu 07:32:37 +0300, Gleb Smirnoff wrote:
A  On Thu, Feb 19, 2015 at 10:49:22AM +0800, Alastair Hogge wrote:
A  A On 2015-02-19 Thu 01:21:24 +, Gleb Smirnoff wrote:
A  A
A  A Hi Gleb,
A  A
A  A I think this commit the whole economy^W buildworld?
A 
A  Here is preliminary patch, that I'm testing now.
A 
A Ta, the build continues, tho, it breaks on sys/netinet/in_var.h now:

Should be fixed now with r278987 and r278988.

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


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

2015-02-18 Thread Gleb Smirnoff
Author: glebius
Date: Thu Feb 19 06:24:27 2015
New Revision: 278987
URL: https://svnweb.freebsd.org/changeset/base/278987

Log:
  Widen _KERNEL ifdef to hide more kernel network stack structures from 
userland.

Modified:
  head/sys/netinet/in_var.h
  head/sys/netinet6/in6_var.h
  head/sys/sys/mbuf.h

Modified: head/sys/netinet/in_var.h
==
--- head/sys/netinet/in_var.h   Thu Feb 19 05:20:59 2015(r278986)
+++ head/sys/netinet/in_var.h   Thu Feb 19 06:24:27 2015(r278987)
@@ -173,7 +173,6 @@ do {
\
ifa_ref((ia)-ia_ifa); \
IN_IFADDR_RUNLOCK();\
 } while (0)
-#endif
 
 /*
  * IP datagram reassembly.
@@ -343,8 +342,6 @@ ims_get_mode(const struct in_multi *inm,
return (MCAST_UNDEFINED);
 }
 
-#ifdef _KERNEL
-
 #ifdef SYSCTL_DECL
 SYSCTL_DECL(_net_inet);
 SYSCTL_DECL(_net_inet_ip);
@@ -425,12 +422,6 @@ voidin_rtredirect(struct sockaddr *, s
struct sockaddr *, int, struct sockaddr *, u_int);
 int in_rtrequest(int, struct sockaddr *,
struct sockaddr *, struct sockaddr *, int, struct rtentry **, 
u_int);
-
-#if 0
-int in_rt_getifa(struct rt_addrinfo *, u_int fibnum);
-int in_rtioctl(u_long, caddr_t, u_int);
-int in_rtrequest1(int, struct rt_addrinfo *, struct rtentry **, u_int);
-#endif
 #endif /* _KERNEL */
 
 /* INET6 stuff */

Modified: head/sys/netinet6/in6_var.h
==
--- head/sys/netinet6/in6_var.h Thu Feb 19 05:20:59 2015(r278986)
+++ head/sys/netinet6/in6_var.h Thu Feb 19 06:24:27 2015(r278987)
@@ -596,7 +596,6 @@ ip6_msource_cmp(const struct ip6_msource
return (memcmp(a-im6s_addr, b-im6s_addr, sizeof(struct in6_addr)));
 }
 RB_PROTOTYPE(ip6_msource_tree, ip6_msource, im6s_link, ip6_msource_cmp);
-#endif /* _KERNEL */
 
 /*
  * IPv6 multicast PCB-layer group filter descriptor.
@@ -696,8 +695,6 @@ im6s_get_mode(const struct in6_multi *in
return (MCAST_UNDEFINED);
 }
 
-#ifdef _KERNEL
-
 /*
  * Lock macros for IPv6 layer multicast address lists.  IPv6 lock goes
  * before link layer multicast locks in the lock order.  In most cases,

Modified: head/sys/sys/mbuf.h
==
--- head/sys/sys/mbuf.h Thu Feb 19 05:20:59 2015(r278986)
+++ head/sys/sys/mbuf.h Thu Feb 19 06:24:27 2015(r278987)
@@ -1190,8 +1190,6 @@ rt_m_getfib(struct mbuf *m)
((_m)-m_pkthdr.fibnum) = (_fib);   \
 } while (0)
 
-#endif /* _KERNEL */
-
 #ifdef MBUF_PROFILING
  void m_profile(struct mbuf *m);
  #define M_PROFILE(m) m_profile(m)
@@ -1296,4 +1294,5 @@ mbufq_prepend(struct mbufq *mq, struct m
STAILQ_INSERT_HEAD(mq-mq_head, m, m_stailqpkt);
mq-mq_len++;
 }
+#endif /* _KERNEL */
 #endif /* !_SYS_MBUF_H_ */
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


Re: svn commit: r278977 - in head/sys: dev/cxgb dev/cxgb/sys dev/cxgb/ulp/tom dev/xen/netfront sys

2015-02-19 Thread Gleb Smirnoff
On Thu, Feb 19, 2015 at 12:15:00PM -0800, Navdeep Parhar wrote:
N On 02/19/15 12:02, Gleb Smirnoff wrote:
N  On Thu, Feb 19, 2015 at 07:47:18PM +0100, Roger Pau Monné wrote:
N  R El 19/02/15 a les 2.19, Gleb Smirnoff ha escrit:
N  R  Author: glebius
N  R  Date: Thu Feb 19 01:19:42 2015
N  R  New Revision: 278977
N  R  URL: https://svnweb.freebsd.org/changeset/base/278977
N  R 
N  R  Log:
N  RProvide a set of inline functions to manage simple mbuf(9) queues, 
based
N  Ron queue(3)'s STAILQ.  Utilize them in cxgb(4) and Xen, deleting 
home
N  Rgrown implementations.
N  R 
N  RSponsored by:   Netflix
N  RSponsored by:   Nginx, Inc.
N  R
N  R Have you tested this commit on Xen? I'm getting the following:
N  R
N  R xn0: Virtual Network Interface at device/vif/0 on xenbusb_front0
N  R xn0: Ethernet address: 00:16:3e:51:85:e3
N  R xenbusb_back0: Xen Backend Devices on xenstore0
N  R xbd0: Back-end specified ring-pages of 15 is not a power of 2. Limited 
to 8.
N  R xn0: backend features: feature-sg feature-gso-tcp4
N  R panic: no mbufs processed
N  R cpuid = 0
N  R KDB: stack backtrace:
N  R db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 
0xfe007adc3920
N  R vpanic() at vpanic+0x189/frame 0xfe007adc39a0
N  R kassert_panic() at kassert_panic+0x132/frame 0xfe007adc3a10
N  R network_alloc_rx_buffers() at network_alloc_rx_buffers+0x439/frame 
0xfe007adc3ac0
N  R network_connect() at network_connect+0xac1/frame 0xfe007adc3b50
N  R netfront_backend_changed() at netfront_backend_changed+0xed/frame 
0xfe007adc3b90
N  R xenwatch_thread() at xenwatch_thread+0x1a2/frame 0xfe007adc3bb0
N  R fork_exit() at fork_exit+0x84/frame 0xfe007adc3bf0
N  R fork_trampoline() at fork_trampoline+0xe/frame 0xfe007adc3bf0
N  R --- trap 0, rip = 0, rsp = 0xfe007adc3cb0, rbp = 0 ---
N  R KDB: enter: panic
N  R [ thread pid 15 tid 100038 ]
N  R Stopped at  kdb_enter+0x3e: movq$0,kdb_why
N 
N  I guess the problem is that the queue limit isn't initialized. Please
N  try the attached patch.
N 
N  The problem with older mbufq was that it doesn't have any sane limit
N  on it. So, converting to new, I simply put INT_MAX, which is ugly.
N 
N Is mq_len supposed to count the number of mbufs in the mbufq?   Then it 
N doesn't work for m_next linked chains.  It pretends to enforce a cap on 
N the number of mbufs in the mbufq while doing no such thing.  If it's not 
N trying to count the number of mbufs then I'd like to know exactly what 
N it does?

It counts number of packets. As it did the same in the previous version
of mbufq. And as it did in struct ifqueue.

So, new mbufq doesn't bring any new functionality, it converges what
two copies of mbufq.h and one copy of ifq.h did.

I am not against adding new features to it, if anyone wishes to.

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


svn commit: r279017 - head/usr.bin/netstat

2015-02-19 Thread Gleb Smirnoff
Author: glebius
Date: Thu Feb 19 19:36:54 2015
New Revision: 279017
URL: https://svnweb.freebsd.org/changeset/base/279017

Log:
  Burn bridges to FreeBSD 7.x IGMP stats.

Modified:
  head/usr.bin/netstat/inet.c

Modified: head/usr.bin/netstat/inet.c
==
--- head/usr.bin/netstat/inet.c Thu Feb 19 18:56:39 2015(r279016)
+++ head/usr.bin/netstat/inet.c Thu Feb 19 19:36:54 2015(r279017)
@@ -1093,47 +1093,6 @@ icmp_stats(u_long off, const char *name,
}
 }
 
-#ifndef BURN_BRIDGES
-/*
- * Dump IGMP statistics structure (pre 8.x kernel).
- */
-static void
-igmp_stats_live_old(const char *name)
-{
-   struct oigmpstat oigmpstat, zerostat;
-   size_t len = sizeof(oigmpstat);
-
-   if (zflag)
-   memset(zerostat, 0, len);
-   if (sysctlbyname(net.inet.igmp.stats, oigmpstat, len,
-   zflag ? zerostat : NULL, zflag ? len : 0)  0) {
-   warn(sysctl: net.inet.igmp.stats);
-   return;
-   }
-
-   printf(%s:\n, name);
-
-#definep(f, m) if (oigmpstat.f || sflag = 1) \
-printf(m, oigmpstat.f, plural(oigmpstat.f))
-#definepy(f, m) if (oigmpstat.f || sflag = 1) \
-printf(m, oigmpstat.f, oigmpstat.f != 1 ? ies : y)
-   p(igps_rcv_total, \t%u message%s received\n);
-   p(igps_rcv_tooshort, \t%u message%s received with too few bytes\n);
-   p(igps_rcv_badsum, \t%u message%s received with bad checksum\n);
-   py(igps_rcv_queries, \t%u membership quer%s received\n);
-   py(igps_rcv_badqueries,
-   \t%u membership quer%s received with invalid field(s)\n);
-   p(igps_rcv_reports, \t%u membership report%s received\n);
-   p(igps_rcv_badreports,
-   \t%u membership report%s received with invalid field(s)\n);
-   p(igps_rcv_ourreports,
-\t%u membership report%s received for groups to which we belong\n);
-p(igps_snd_reports, \t%u membership report%s sent\n);
-#undef p
-#undef py
-}
-#endif /* !BURN_BRIDGES */
-
 /*
  * Dump IGMP statistics structure.
  */
@@ -1143,27 +1102,6 @@ igmp_stats(u_long off, const char *name,
struct igmpstat igmpstat, zerostat;
size_t len;
 
-#ifndef BURN_BRIDGES
-   if (live) {
-   /*
-* Detect if we are being run against a pre-IGMPv3 kernel.
-* We cannot do this for a core file as the legacy
-* struct igmpstat has no size field, nor does it
-* export it in any readily-available symbols.
-*/
-   len = 0;
-   if (sysctlbyname(net.inet.igmp.stats, NULL, len, NULL,
-   0)  0) {
-   warn(sysctl: net.inet.igmp.stats);
-   return;
-   }
-   if (len  sizeof(igmpstat)) {
-   igmp_stats_live_old(name);
-   return;
-   }
-   }
-#endif /* !BURN_BRIDGES */
-
len = sizeof(igmpstat);
if (live) {
if (zflag)
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


Re: svn commit: r278977 - in head/sys: dev/cxgb dev/cxgb/sys dev/cxgb/ulp/tom dev/xen/netfront sys

2015-02-19 Thread Gleb Smirnoff
On Thu, Feb 19, 2015 at 07:47:18PM +0100, Roger Pau Monné wrote:
R El 19/02/15 a les 2.19, Gleb Smirnoff ha escrit:
R  Author: glebius
R  Date: Thu Feb 19 01:19:42 2015
R  New Revision: 278977
R  URL: https://svnweb.freebsd.org/changeset/base/278977
R  
R  Log:
RProvide a set of inline functions to manage simple mbuf(9) queues, based
Ron queue(3)'s STAILQ.  Utilize them in cxgb(4) and Xen, deleting home
Rgrown implementations.
R
RSponsored by:Netflix
RSponsored by:Nginx, Inc.
R 
R Have you tested this commit on Xen? I'm getting the following:
R 
R xn0: Virtual Network Interface at device/vif/0 on xenbusb_front0
R xn0: Ethernet address: 00:16:3e:51:85:e3
R xenbusb_back0: Xen Backend Devices on xenstore0
R xbd0: Back-end specified ring-pages of 15 is not a power of 2. Limited to 8.
R xn0: backend features: feature-sg feature-gso-tcp4
R panic: no mbufs processed
R cpuid = 0
R KDB: stack backtrace:
R db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 
0xfe007adc3920
R vpanic() at vpanic+0x189/frame 0xfe007adc39a0
R kassert_panic() at kassert_panic+0x132/frame 0xfe007adc3a10
R network_alloc_rx_buffers() at network_alloc_rx_buffers+0x439/frame 
0xfe007adc3ac0
R network_connect() at network_connect+0xac1/frame 0xfe007adc3b50
R netfront_backend_changed() at netfront_backend_changed+0xed/frame 
0xfe007adc3b90
R xenwatch_thread() at xenwatch_thread+0x1a2/frame 0xfe007adc3bb0
R fork_exit() at fork_exit+0x84/frame 0xfe007adc3bf0
R fork_trampoline() at fork_trampoline+0xe/frame 0xfe007adc3bf0
R --- trap 0, rip = 0, rsp = 0xfe007adc3cb0, rbp = 0 ---
R KDB: enter: panic
R [ thread pid 15 tid 100038 ]
R Stopped at  kdb_enter+0x3e: movq$0,kdb_why

I guess the problem is that the queue limit isn't initialized. Please
try the attached patch.

The problem with older mbufq was that it doesn't have any sane limit
on it. So, converting to new, I simply put INT_MAX, which is ugly.

I'd appreciate if you fix mbufq_init()s in netfront.c to some appropriate
values.

-- 
Totus tuus, Glebius.
Index: netfront.c
===
--- netfront.c	(revision 279017)
+++ netfront.c	(working copy)
@@ -2062,6 +2062,9 @@ create_netdev(device_t dev)
 		np-rx_mbufs[i] = NULL;
 		np-grant_rx_ref[i] = GRANT_REF_INVALID;
 	}
+
+	mbufq_init(np-xn_rx_batch, INT_MAX);
+
 	/* A grant for every tx ring slot */
 	if (gnttab_alloc_grant_references(NET_TX_RING_SIZE,
 	  np-gref_tx_head) != 0) {
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org

Re: svn commit: r278977 - in head/sys: dev/cxgb dev/cxgb/sys dev/cxgb/ulp/tom dev/xen/netfront sys

2015-02-19 Thread Gleb Smirnoff
On Thu, Feb 19, 2015 at 07:47:18PM +0100, Roger Pau Monné wrote:
R El 19/02/15 a les 2.19, Gleb Smirnoff ha escrit:
R  Author: glebius
R  Date: Thu Feb 19 01:19:42 2015
R  New Revision: 278977
R  URL: https://svnweb.freebsd.org/changeset/base/278977
R  
R  Log:
RProvide a set of inline functions to manage simple mbuf(9) queues, based
Ron queue(3)'s STAILQ.  Utilize them in cxgb(4) and Xen, deleting home
Rgrown implementations.
R
RSponsored by:Netflix
RSponsored by:Nginx, Inc.
R 
R Have you tested this commit on Xen? I'm getting the following:
R 
R xn0: Virtual Network Interface at device/vif/0 on xenbusb_front0
R xn0: Ethernet address: 00:16:3e:51:85:e3
R xenbusb_back0: Xen Backend Devices on xenstore0
R xbd0: Back-end specified ring-pages of 15 is not a power of 2. Limited to 8.
R xn0: backend features: feature-sg feature-gso-tcp4
R panic: no mbufs processed
R cpuid = 0
R KDB: stack backtrace:
R db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 
0xfe007adc3920
R vpanic() at vpanic+0x189/frame 0xfe007adc39a0
R kassert_panic() at kassert_panic+0x132/frame 0xfe007adc3a10
R network_alloc_rx_buffers() at network_alloc_rx_buffers+0x439/frame 
0xfe007adc3ac0
R network_connect() at network_connect+0xac1/frame 0xfe007adc3b50
R netfront_backend_changed() at netfront_backend_changed+0xed/frame 
0xfe007adc3b90
R xenwatch_thread() at xenwatch_thread+0x1a2/frame 0xfe007adc3bb0
R fork_exit() at fork_exit+0x84/frame 0xfe007adc3bf0
R fork_trampoline() at fork_trampoline+0xe/frame 0xfe007adc3bf0
R --- trap 0, rip = 0, rsp = 0xfe007adc3cb0, rbp = 0 ---
R KDB: enter: panic
R [ thread pid 15 tid 100038 ]
R Stopped at  kdb_enter+0x3e: movq$0,kdb_why

Have you got the core? If yes, please do in the network_alloc_rx_buffers() 
frame:

p sc-xn_rx_batch

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


Re: svn commit: r278979 - head/sys/netinet6

2015-02-18 Thread Gleb Smirnoff
On Thu, Feb 19, 2015 at 10:49:22AM +0800, Alastair Hogge wrote:
A On 2015-02-19 Thu 01:21:24 +, Gleb Smirnoff wrote:
A 
A Hi Gleb,
A 
A I think this commit the whole economy^W buildworld?

Here is preliminary patch, that I'm testing now.

-- 
Totus tuus, Glebius.
Index: sys/netinet6/in6_var.h
===
--- sys/netinet6/in6_var.h	(revision 278985)
+++ sys/netinet6/in6_var.h	(working copy)
@@ -596,7 +596,6 @@ ip6_msource_cmp(const struct ip6_msource *a, const
 	return (memcmp(a-im6s_addr, b-im6s_addr, sizeof(struct in6_addr)));
 }
 RB_PROTOTYPE(ip6_msource_tree, ip6_msource, im6s_link, ip6_msource_cmp);
-#endif /* _KERNEL */
 
 /*
  * IPv6 multicast PCB-layer group filter descriptor.
@@ -696,8 +695,6 @@ im6s_get_mode(const struct in6_multi *inm, const s
 	return (MCAST_UNDEFINED);
 }
 
-#ifdef _KERNEL
-
 /*
  * Lock macros for IPv6 layer multicast address lists.  IPv6 lock goes
  * before link layer multicast locks in the lock order.  In most cases,
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org

svn commit: r279026 - head/sys/netinet

2015-02-19 Thread Gleb Smirnoff
Author: glebius
Date: Thu Feb 19 22:35:23 2015
New Revision: 279026
URL: https://svnweb.freebsd.org/changeset/base/279026

Log:
  - Rename 'struct igmp_ifinfo' into 'struct igmp_ifsoftc', since it really
represents a context.
  - Preserve name 'struct igmp_ifinfo' for a new structure, that will be stable
API between userland and kernel.
  - Make sysctl_igmp_ifinfo() return the new 'struct igmp_ifinfo', instead of
old one, which had a bunch of internal kernel structures in it.
  - Move all above declarations from in_var.h to igmp_var.h, since they are
private to IGMP code.
  
  Sponsored by: Netflix
  Sponsored by: Nginx, Inc.

Modified:
  head/sys/netinet/igmp.c
  head/sys/netinet/igmp_var.h
  head/sys/netinet/in_var.h

Modified: head/sys/netinet/igmp.c
==
--- head/sys/netinet/igmp.c Thu Feb 19 22:20:19 2015(r279025)
+++ head/sys/netinet/igmp.c Thu Feb 19 22:35:23 2015(r279026)
@@ -84,15 +84,15 @@ __FBSDID($FreeBSD$);
 #define KTR_IGMPV3 KTR_INET
 #endif
 
-static struct igmp_ifinfo *
+static struct igmp_ifsoftc *
igi_alloc_locked(struct ifnet *);
 static voidigi_delete_locked(const struct ifnet *);
 static voidigmp_dispatch_queue(struct mbufq *, int, const int);
 static voidigmp_fasttimo_vnet(void);
-static voidigmp_final_leave(struct in_multi *, struct igmp_ifinfo *);
+static voidigmp_final_leave(struct in_multi *, struct igmp_ifsoftc *);
 static int igmp_handle_state_change(struct in_multi *,
-   struct igmp_ifinfo *);
-static int igmp_initial_join(struct in_multi *, struct igmp_ifinfo *);
+   struct igmp_ifsoftc *);
+static int igmp_initial_join(struct in_multi *, struct igmp_ifsoftc *);
 static int igmp_input_v1_query(struct ifnet *, const struct ip *,
const struct igmp *);
 static int igmp_input_v2_query(struct ifnet *, const struct ip *,
@@ -100,7 +100,7 @@ static int  igmp_input_v2_query(struct if
 static int igmp_input_v3_query(struct ifnet *, const struct ip *,
/*const*/ struct igmpv3 *);
 static int igmp_input_v3_group_query(struct in_multi *,
-   struct igmp_ifinfo *, int, /*const*/ struct igmpv3 *);
+   struct igmp_ifsoftc *, int, /*const*/ struct igmpv3 *);
 static int igmp_input_v1_report(struct ifnet *, /*const*/ struct ip *,
/*const*/ struct igmp *);
 static int igmp_input_v2_report(struct ifnet *, /*const*/ struct ip *,
@@ -112,21 +112,21 @@ static struct mbuf *
 #ifdef KTR
 static char *  igmp_rec_type_to_str(const int);
 #endif
-static voidigmp_set_version(struct igmp_ifinfo *, const int);
+static voidigmp_set_version(struct igmp_ifsoftc *, const int);
 static voidigmp_slowtimo_vnet(void);
 static int igmp_v1v2_queue_report(struct in_multi *, const int);
 static voidigmp_v1v2_process_group_timer(struct in_multi *, const int);
-static voidigmp_v1v2_process_querier_timers(struct igmp_ifinfo *);
+static voidigmp_v1v2_process_querier_timers(struct igmp_ifsoftc *);
 static voidigmp_v2_update_group(struct in_multi *, const int);
-static voidigmp_v3_cancel_link_timers(struct igmp_ifinfo *);
-static voidigmp_v3_dispatch_general_query(struct igmp_ifinfo *);
+static voidigmp_v3_cancel_link_timers(struct igmp_ifsoftc *);
+static voidigmp_v3_dispatch_general_query(struct igmp_ifsoftc *);
 static struct mbuf *
igmp_v3_encap_report(struct ifnet *, struct mbuf *);
 static int igmp_v3_enqueue_group_record(struct mbufq *,
struct in_multi *, const int, const int, const int);
 static int igmp_v3_enqueue_filter_change(struct mbufq *,
struct in_multi *);
-static voidigmp_v3_process_group_timers(struct igmp_ifinfo *,
+static voidigmp_v3_process_group_timers(struct igmp_ifsoftc *,
struct mbufq *, struct mbufq *, struct in_multi *,
const int);
 static int igmp_v3_merge_state_changes(struct in_multi *,
@@ -158,13 +158,13 @@ static const struct netisr_handler igmp_
  *  * All output is delegated to the netisr.
  *Now that Giant has been eliminated, the netisr may be inlined.
  *  * IN_MULTI_LOCK covers in_multi.
- *  * IGMP_LOCK covers igmp_ifinfo and any global variables in this file,
+ *  * IGMP_LOCK covers igmp_ifsoftc and any global variables in this file,
  *including the output queue.
  *  * IF_ADDR_LOCK covers if_multiaddrs, which is used for a variety of
  *per-link state iterators.
- *  * igmp_ifinfo is valid as long as PF_INET is attached to the interface,
+ *  * igmp_ifsoftc is valid as long as PF_INET is attached to the interface,
  *therefore it is not refcounted.
- *We allow unlocked reads of igmp_ifinfo when accessed via in_multi.
+ *We allow unlocked reads of igmp_ifsoftc when accessed via in_multi.
  *
  

svn commit: r279027 - head/sys/netinet6

2015-02-19 Thread Gleb Smirnoff
Author: glebius
Date: Thu Feb 19 22:37:01 2015
New Revision: 279027
URL: https://svnweb.freebsd.org/changeset/base/279027

Log:
  - Rename 'struct mld_ifinfo' into 'struct mld_ifsoftc', since it really
represents a context.
  - Preserve name 'struct mld_ifinfo' for a new structure, that will be stable
API between userland and kernel.
  - Make sysctl_mld_ifinfo() return the new 'struct mld_ifinfo', instead of
old one, which had a bunch of internal kernel structures in it.
  
  Sponsored by: Netflix
  Sponsored by: Nginx, Inc.

Modified:
  head/sys/netinet6/in6_var.h
  head/sys/netinet6/mld6.c
  head/sys/netinet6/mld6_var.h

Modified: head/sys/netinet6/in6_var.h
==
--- head/sys/netinet6/in6_var.h Thu Feb 19 22:35:23 2015(r279026)
+++ head/sys/netinet6/in6_var.h Thu Feb 19 22:37:01 2015(r279027)
@@ -97,7 +97,7 @@ struct in6_addrlifetime {
 struct nd_ifinfo;
 struct scope6_id;
 struct lltable;
-struct mld_ifinfo;
+struct mld_ifsoftc;
 
 struct in6_ifextra {
counter_u64_t *in6_ifstat;
@@ -105,7 +105,7 @@ struct in6_ifextra {
struct nd_ifinfo *nd_ifinfo;
struct scope6_id *scope6_id;
struct lltable *lltable;
-   struct mld_ifinfo *mld_ifinfo;
+   struct mld_ifsoftc *mld_ifinfo;
 };
 
 #defineLLTABLE6(ifp)   (((struct in6_ifextra 
*)(ifp)-if_afdata[AF_INET6])-lltable)
@@ -646,7 +646,7 @@ struct in6_multi {
u_int   in6m_timer; /* MLD6 listener report timer */
 
/* New fields for MLDv2 follow. */
-   struct mld_ifinfo   *in6m_mli;  /* MLD info */
+   struct mld_ifsoftc  *in6m_mli;  /* MLD info */
SLIST_ENTRY(in6_multi)   in6m_nrele;/* to-be-released by MLD */
struct ip6_msource_tree  in6m_srcs; /* tree of sources */
u_long   in6m_nsrc; /* # of tree entries */

Modified: head/sys/netinet6/mld6.c
==
--- head/sys/netinet6/mld6.cThu Feb 19 22:35:23 2015(r279026)
+++ head/sys/netinet6/mld6.cThu Feb 19 22:37:01 2015(r279027)
@@ -102,33 +102,33 @@ __FBSDID($FreeBSD$);
 #define KTR_MLD KTR_INET6
 #endif
 
-static struct mld_ifinfo *
+static struct mld_ifsoftc *
mli_alloc_locked(struct ifnet *);
 static voidmli_delete_locked(const struct ifnet *);
 static voidmld_dispatch_packet(struct mbuf *);
 static voidmld_dispatch_queue(struct mbufq *, int);
-static voidmld_final_leave(struct in6_multi *, struct mld_ifinfo *);
+static voidmld_final_leave(struct in6_multi *, struct mld_ifsoftc *);
 static voidmld_fasttimo_vnet(void);
 static int mld_handle_state_change(struct in6_multi *,
-   struct mld_ifinfo *);
-static int mld_initial_join(struct in6_multi *, struct mld_ifinfo *,
+   struct mld_ifsoftc *);
+static int mld_initial_join(struct in6_multi *, struct mld_ifsoftc *,
const int);
 #ifdef KTR
 static char *  mld_rec_type_to_str(const int);
 #endif
-static voidmld_set_version(struct mld_ifinfo *, const int);
+static voidmld_set_version(struct mld_ifsoftc *, const int);
 static voidmld_slowtimo_vnet(void);
 static int mld_v1_input_query(struct ifnet *, const struct ip6_hdr *,
/*const*/ struct mld_hdr *);
 static int mld_v1_input_report(struct ifnet *, const struct ip6_hdr *,
/*const*/ struct mld_hdr *);
-static voidmld_v1_process_group_timer(struct mld_ifinfo *,
+static voidmld_v1_process_group_timer(struct mld_ifsoftc *,
struct in6_multi *);
-static voidmld_v1_process_querier_timers(struct mld_ifinfo *);
+static voidmld_v1_process_querier_timers(struct mld_ifsoftc *);
 static int mld_v1_transmit_report(struct in6_multi *, const int);
 static voidmld_v1_update_group(struct in6_multi *, const int);
-static voidmld_v2_cancel_link_timers(struct mld_ifinfo *);
-static voidmld_v2_dispatch_general_query(struct mld_ifinfo *);
+static voidmld_v2_cancel_link_timers(struct mld_ifsoftc *);
+static voidmld_v2_dispatch_general_query(struct mld_ifsoftc *);
 static struct mbuf *
mld_v2_encap_report(struct ifnet *, struct mbuf *);
 static int mld_v2_enqueue_filter_change(struct mbufq *,
@@ -140,11 +140,11 @@ static intmld_v2_input_query(struct ifn
struct mbuf *, const int, const int);
 static int mld_v2_merge_state_changes(struct in6_multi *,
struct mbufq *);
-static voidmld_v2_process_group_timers(struct mld_ifinfo *,
+static voidmld_v2_process_group_timers(struct mld_ifsoftc *,
struct mbufq *, struct mbufq *,
struct in6_multi *, const int);
 static int mld_v2_process_group_query(struct in6_multi *,
-   struct mld_ifinfo *mli, int, 

svn commit: r279028 - in head/usr.sbin: . ifmcstat

2015-02-19 Thread Gleb Smirnoff
Author: glebius
Date: Thu Feb 19 22:42:33 2015
New Revision: 279028
URL: https://svnweb.freebsd.org/changeset/base/279028

Log:
  Now that IGMP and MLD sysctls provide a clean API structures that do not
  leak kernel internal stuff, reconnect ifmcstat(1) back to build.  However,
  disable kvm(3) support in it, since it requires uncovering tons of _KERNEL
  defined declarations, which can be achieved either uncovering them globally
  or providing dirty hacks such as _WANT_IFADDR.  If anyone demands an
  ifmcstat-like kvm-based tool, please take the code out of usr.sbin/ifmstat
  and create a tool in src/tools/tools.

Modified:
  head/usr.sbin/Makefile
  head/usr.sbin/ifmcstat/Makefile
  head/usr.sbin/ifmcstat/ifmcstat.c

Modified: head/usr.sbin/Makefile
==
--- head/usr.sbin/Makefile  Thu Feb 19 22:37:01 2015(r279027)
+++ head/usr.sbin/Makefile  Thu Feb 19 22:42:33 2015(r279028)
@@ -94,8 +94,6 @@ SUBDIR=   adduser \
watchdogd \
zic
 
-SUBDIR:=   ${SUBDIR:Nifmcstat}
-
 # NB: keep these sorted by MK_* knobs
 
 .if ${MK_ACCT} != no

Modified: head/usr.sbin/ifmcstat/Makefile
==
--- head/usr.sbin/ifmcstat/Makefile Thu Feb 19 22:37:01 2015
(r279027)
+++ head/usr.sbin/ifmcstat/Makefile Thu Feb 19 22:42:33 2015
(r279028)
@@ -15,9 +15,4 @@ WARNS?=   2
 CFLAGS+=-DINET6
 .endif
 
-.if ${MK_KVM_SUPPORT} != no
-CFLAGS+=-DWITH_KVM
-LIBADD=kvm
-.endif
-
 .include bsd.prog.mk

Modified: head/usr.sbin/ifmcstat/ifmcstat.c
==
--- head/usr.sbin/ifmcstat/ifmcstat.c   Thu Feb 19 22:37:01 2015
(r279027)
+++ head/usr.sbin/ifmcstat/ifmcstat.c   Thu Feb 19 22:42:33 2015
(r279028)
@@ -41,7 +41,6 @@ __FBSDID($FreeBSD$);
 #include sys/tree.h
 
 #include net/if.h
-#define_WANT_IFADDR
 #include net/if_var.h
 #include net/if_types.h
 #include net/if_dl.h
@@ -52,20 +51,12 @@ __FBSDID($FreeBSD$);
 #include netinet/in_systm.h
 #include netinet/ip.h
 #include netinet/igmp.h
-#define KERNEL
-# include netinet/if_ether.h
-#undef KERNEL
-#define _KERNEL
-#define SYSCTL_DECL(x)
-# include netinet/igmp_var.h
-#undef SYSCTL_DECL
-#undef _KERNEL
+#include netinet/if_ether.h
+#include netinet/igmp_var.h
 
 #ifdef INET6
 #include netinet/icmp6.h
-#define _KERNEL
-# include netinet6/mld6_var.h
-#undef _KERNEL
+#include netinet6/mld6_var.h
 #endif /* INET6 */
 
 #include arpa/inet.h
@@ -82,14 +73,23 @@ __FBSDID($FreeBSD$);
 #include err.h
 #include errno.h
 #include fcntl.h
-#include kvm.h
 #include limits.h
 #include ifaddrs.h
-#include nlist.h
 #include sysexits.h
 #include unistd.h
 
-/* XXX: This file currently assumes INET and KVM support in the base system. */
+#ifdef KVM
+/*
+ * Currently the KVM build is broken. To be fixed it requires uncovering
+ * large amount of _KERNEL code in include files, and it is also very
+ * tentative to internal kernel ABI changes. If anyone wishes to restore
+ * it, please move it out of src/usr.sbin to src/tools/tools.
+ */
+#include kvm.h
+#include nlist.h
+#endif
+
+/* XXX: This file currently assumes INET support in the base system. */
 #ifndef INET
 #define INET
 #endif
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r278874 - in head/sys: net netpfil/pf

2015-02-16 Thread Gleb Smirnoff
Author: glebius
Date: Mon Feb 16 23:50:53 2015
New Revision: 278874
URL: https://svnweb.freebsd.org/changeset/base/278874

Log:
  - Improve INET/INET6 scope.
  - style(9) declarations.
  - Make couple of local functions static.

Modified:
  head/sys/net/pfvar.h
  head/sys/netpfil/pf/pf_norm.c

Modified: head/sys/net/pfvar.h
==
--- head/sys/net/pfvar.hMon Feb 16 23:29:56 2015(r278873)
+++ head/sys/net/pfvar.hMon Feb 16 23:50:53 2015(r278874)
@@ -1567,10 +1567,14 @@ voidpf_free_rule(struct 
pf_rule *);
 
 #ifdef INET
 intpf_test(int, struct ifnet *, struct mbuf **, struct inpcb *);
+intpf_normalize_ip(struct mbuf **, int, struct pfi_kif *, u_short *,
+   struct pf_pdesc *);
 #endif /* INET */
 
 #ifdef INET6
 intpf_test6(int, struct ifnet *, struct mbuf **, struct inpcb *);
+intpf_normalize_ip6(struct mbuf **, int, struct pfi_kif *, u_short *,
+   struct pf_pdesc *);
 void   pf_poolmask(struct pf_addr *, struct pf_addr*,
struct pf_addr *, struct pf_addr *, u_int8_t);
 void   pf_addr_inc(struct pf_addr *, sa_family_t);
@@ -1590,10 +1594,6 @@ int  pf_match_port(u_int8_t, u_int16_t, u
 
 void   pf_normalize_init(void);
 void   pf_normalize_cleanup(void);
-intpf_normalize_ip(struct mbuf **, int, struct pfi_kif *, u_short *,
-   struct pf_pdesc *);
-intpf_normalize_ip6(struct mbuf **, int, struct pfi_kif *, u_short *,
-   struct pf_pdesc *);
 intpf_normalize_tcp(int, struct pfi_kif *, struct mbuf *, int, int, void *,
struct pf_pdesc *);
 void   pf_normalize_tcp_cleanup(struct pf_state *);

Modified: head/sys/netpfil/pf/pf_norm.c
==
--- head/sys/netpfil/pf/pf_norm.c   Mon Feb 16 23:29:56 2015
(r278873)
+++ head/sys/netpfil/pf/pf_norm.c   Mon Feb 16 23:50:53 2015
(r278874)
@@ -134,35 +134,32 @@ static int pf_frag_compare(struct pf_f
 static RB_PROTOTYPE(pf_frag_tree, pf_fragment, fr_entry, pf_frag_compare);
 static RB_GENERATE(pf_frag_tree, pf_fragment, fr_entry, pf_frag_compare);
 
-/* Private prototypes */
-static void pf_free_fragment(struct pf_fragment *);
-static void pf_remove_fragment(struct pf_fragment *);
-static int  pf_normalize_tcpopt(struct pf_rule *, struct mbuf *,
-   struct tcphdr *, int, sa_family_t);
+static voidpf_free_fragment(struct pf_fragment *);
+static voidpf_remove_fragment(struct pf_fragment *);
+static int pf_normalize_tcpopt(struct pf_rule *, struct mbuf *,
+   struct tcphdr *, int, sa_family_t);
+struct pf_frent*pf_create_fragment(u_short *);
+static struct pf_fragment *
+   pf_find_fragment(struct pf_fragment_cmp *key,
+   struct pf_frag_tree *tree);
+static struct pf_fragment *
+   pf_fillup_fragment(struct pf_fragment_cmp *, struct pf_frent *, 
u_short *);
+static int pf_isfull_fragment(struct pf_fragment *);
+struct mbuf*pf_join_fragment(struct pf_fragment *);
 #ifdef INET
-static void pf_scrub_ip(struct mbuf **, u_int32_t, u_int8_t,
-   u_int8_t);
-static void pf_flush_fragments(void);
-static struct pf_fragment *pf_find_fragment(struct pf_fragment_cmp *key,
-   struct pf_frag_tree *tree);
-struct pf_frent*pf_create_fragment(u_short *);
-static int pf_reassemble(struct mbuf **, struct ip *, int,
-   u_short *);
-static struct mbuf *pf_fragcache(struct mbuf **, struct ip*,
-   struct pf_fragment **, int, int, int *);
-static struct pf_fragment *pf_fillup_fragment(struct pf_fragment_cmp *,
-   struct pf_frent *, u_short *);
-intpf_isfull_fragment(struct pf_fragment *);
-struct mbuf*pf_join_fragment(struct pf_fragment *);
-
-
-#endif /* INET */
+static voidpf_scrub_ip(struct mbuf **, uint32_t, uint8_t, uint8_t);
+static voidpf_flush_fragments(void);
+static int pf_reassemble(struct mbuf **, struct ip *, int, u_short *);
+static struct mbuf *
+   pf_fragcache(struct mbuf **, struct ip*, struct pf_fragment **,
+   int, int, int *);
+#endif /* INET */
 #ifdef INET6
-intpf_reassemble6(struct mbuf **, struct ip6_hdr *,
-   struct ip6_frag *, uint16_t, uint16_t, int,
-   u_short *);
-static void pf_scrub_ip6(struct mbuf **, u_int8_t);
-#endif
+static int pf_reassemble6(struct mbuf **, struct ip6_hdr *,
+   struct ip6_frag *, uint16_t, uint16_t, int, u_short *);
+static voidpf_scrub_ip6(struct mbuf **, uint8_t);
+#endif /* INET6 */
+
 #define

svn commit: r278925 - head/sys/netpfil/pf

2015-02-17 Thread Gleb Smirnoff
Author: glebius
Date: Tue Feb 17 22:33:22 2015
New Revision: 278925
URL: https://svnweb.freebsd.org/changeset/base/278925

Log:
  Even more fixes to !INET and !INET6 kernels.
  
  In collaboration with:pluknet

Modified:
  head/sys/netpfil/pf/pf_norm.c

Modified: head/sys/netpfil/pf/pf_norm.c
==
--- head/sys/netpfil/pf/pf_norm.c   Tue Feb 17 21:59:15 2015
(r278924)
+++ head/sys/netpfil/pf/pf_norm.c   Tue Feb 17 22:33:22 2015
(r278925)
@@ -134,25 +134,23 @@ static int pf_frag_compare(struct pf_f
 static RB_PROTOTYPE(pf_frag_tree, pf_fragment, fr_entry, pf_frag_compare);
 static RB_GENERATE(pf_frag_tree, pf_fragment, fr_entry, pf_frag_compare);
 
+static voidpf_flush_fragments(void);
 static voidpf_free_fragment(struct pf_fragment *);
 static voidpf_remove_fragment(struct pf_fragment *);
 static int pf_normalize_tcpopt(struct pf_rule *, struct mbuf *,
struct tcphdr *, int, sa_family_t);
-struct pf_frent*pf_create_fragment(u_short *);
-static struct pf_fragment *
-   pf_find_fragment(struct pf_fragment_cmp *key,
+static struct pf_frent *pf_create_fragment(u_short *);
+static struct pf_fragment *pf_find_fragment(struct pf_fragment_cmp *key,
struct pf_frag_tree *tree);
-static struct pf_fragment *
-   pf_fillup_fragment(struct pf_fragment_cmp *, struct pf_frent *, 
u_short *);
+static struct pf_fragment *pf_fillup_fragment(struct pf_fragment_cmp *,
+   struct pf_frent *, u_short *);
 static int pf_isfull_fragment(struct pf_fragment *);
-struct mbuf*pf_join_fragment(struct pf_fragment *);
+static struct mbuf *pf_join_fragment(struct pf_fragment *);
 #ifdef INET
 static voidpf_scrub_ip(struct mbuf **, uint32_t, uint8_t, uint8_t);
-static voidpf_flush_fragments(void);
 static int pf_reassemble(struct mbuf **, struct ip *, int, u_short *);
-static struct mbuf *
-   pf_fragcache(struct mbuf **, struct ip*, struct pf_fragment **,
-   int, int, int *);
+static struct mbuf *pf_fragcache(struct mbuf **, struct ip*,
+   struct pf_fragment **, int, int, int *);
 #endif /* INET */
 #ifdef INET6
 static int pf_reassemble6(struct mbuf **, struct ip6_hdr *,
@@ -267,7 +265,6 @@ pf_purge_expired_fragments(void)
PF_FRAG_UNLOCK();
 }
 
-#ifdef INET
 /*
  * Try to flush old fragments to make space for new ones
  */
@@ -292,7 +289,6 @@ pf_flush_fragments(void)
break;
}
 }
-#endif /* INET */
 
 /* Frees the fragments and all associated entries */
 static void
@@ -329,7 +325,6 @@ pf_free_fragment(struct pf_fragment *fra
pf_remove_fragment(frag);
 }
 
-#ifdef INET
 static struct pf_fragment *
 pf_find_fragment(struct pf_fragment_cmp *key, struct pf_frag_tree *tree)
 {
@@ -352,10 +347,8 @@ pf_find_fragment(struct pf_fragment_cmp 
 
return (frag);
 }
-#endif /* INET */
 
 /* Removes a fragment from the fragment queue and frees the fragment */
-
 static void
 pf_remove_fragment(struct pf_fragment *frag)
 {
@@ -373,7 +366,7 @@ pf_remove_fragment(struct pf_fragment *f
}
 }
 
-struct pf_frent *
+static struct pf_frent *
 pf_create_fragment(u_short *reason)
 {
struct pf_frent *frent;
@@ -570,7 +563,7 @@ pf_isfull_fragment(struct pf_fragment *f
return (1);
 }
 
-struct mbuf *
+static struct mbuf *
 pf_join_fragment(struct pf_fragment *frag)
 {
struct mbuf *m, *m2;
@@ -666,6 +659,7 @@ pf_reassemble(struct mbuf **m0, struct i
DPFPRINTF((complete: %p(%d)\n, m, ntohs(ip-ip_len)));
return (PF_PASS);
 }
+#endif /* INET */
 
 #ifdef INET6
 static int
@@ -789,6 +783,7 @@ fail:
 }
 #endif /* INET6 */
 
+#ifdef INET
 static struct mbuf *
 pf_fragcache(struct mbuf **m0, struct ip *h, struct pf_fragment **frag, int 
mff,
 int drop, int *nomem)
@@ -1090,6 +1085,7 @@ pf_fragcache(struct mbuf **m0, struct ip
m_freem(m);
return (NULL);
 }
+#endif /* INET */
 
 #ifdef INET6
 int
@@ -1162,6 +1158,7 @@ pf_refragment6(struct ifnet *ifp, struct
 }
 #endif /* INET6 */
 
+#ifdef INET
 int
 pf_normalize_ip(struct mbuf **m0, int dir, struct pfi_kif *kif, u_short 
*reason,
 struct pf_pdesc *pd)
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r279013 - head/sys/conf

2015-02-19 Thread Gleb Smirnoff
Author: glebius
Date: Thu Feb 19 17:03:13 2015
New Revision: 279013
URL: https://svnweb.freebsd.org/changeset/base/279013

Log:
  Use KTR_COMPILE=(KTR_ALL) for LINTs, to get more code coverage.

Modified:
  head/sys/conf/NOTES

Modified: head/sys/conf/NOTES
==
--- head/sys/conf/NOTES Thu Feb 19 16:34:48 2015(r279012)
+++ head/sys/conf/NOTES Thu Feb 19 17:03:13 2015(r279013)
@@ -495,7 +495,7 @@ options KTRACE_REQUEST_POOL=101
 optionsKTR
 optionsKTR_BOOT_ENTRIES=1024
 optionsKTR_ENTRIES=(128*1024)
-optionsKTR_COMPILE=(KTR_INTR|KTR_PROC)
+optionsKTR_COMPILE=(KTR_ALL)
 optionsKTR_MASK=KTR_INTR
 optionsKTR_CPUMASK=0x3
 optionsKTR_VERBOSE
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


Re: svn commit: r277678 - in head: etc/rc.d sbin share/man/man4 share/mk sys/conf sys/modules/geom tools/build/mk tools/build/options

2015-01-26 Thread Gleb Smirnoff
On Sun, Jan 25, 2015 at 04:52:49AM +, Garrett Cooper wrote:
G Author: ngie
G Date: Sun Jan 25 04:52:48 2015
G New Revision: 277678
G URL: https://svnweb.freebsd.org/changeset/base/277678
G 
G Log:
G   Add MK_CCD knob for building and installing ccd(4), ccdconfig, etc
G   
G   MFC after: 2 weeks
G   Sponsored by: EMC / Isilon Storage Division

Does ccd(4) has any benefits over gstripe? Looks like abandonware to
be retired.

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


svn commit: r277059 - head/sys/netgraph

2015-01-12 Thread Gleb Smirnoff
Author: glebius
Date: Mon Jan 12 09:50:42 2015
New Revision: 277059
URL: https://svnweb.freebsd.org/changeset/base/277059

Log:
  When the node receives NGM_FLOW_COOKIE update the if_link_state, instead
  of playing with almost dead IFF_DRV_RUNNING flag.
  
  Sponsored by: Nginx, Inc.

Modified:
  head/sys/netgraph/ng_iface.c

Modified: head/sys/netgraph/ng_iface.c
==
--- head/sys/netgraph/ng_iface.cMon Jan 12 09:48:45 2015
(r277058)
+++ head/sys/netgraph/ng_iface.cMon Jan 12 09:50:42 2015
(r277059)
@@ -639,10 +639,10 @@ ng_iface_rcvmsg(node_p node, item_p item
case NGM_FLOW_COOKIE:
switch (msg-header.cmd) {
case NGM_LINK_IS_UP:
-   ifp-if_drv_flags |= IFF_DRV_RUNNING;
+   if_link_state_change(ifp, LINK_STATE_UP);
break;
case NGM_LINK_IS_DOWN:
-   ifp-if_drv_flags = ~IFF_DRV_RUNNING;
+   if_link_state_change(ifp, LINK_STATE_DOWN);
break;
default:
break;
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r277056 - head/sys/netinet

2015-01-12 Thread Gleb Smirnoff
Author: glebius
Date: Mon Jan 12 09:41:12 2015
New Revision: 277056
URL: https://svnweb.freebsd.org/changeset/base/277056

Log:
  Remove incorrect layering violating code that:
  a) assumed that ifqueue length is measured in bytes, instead of packets
  b) assumed that any interface has working ifqueue
  c) incremented global counter instead of ifi_oqdrops
  
  Sponsored by: Nginx, Inc.

Modified:
  head/sys/netinet/ip_fastfwd.c

Modified: head/sys/netinet/ip_fastfwd.c
==
--- head/sys/netinet/ip_fastfwd.c   Mon Jan 12 08:58:07 2015
(r277055)
+++ head/sys/netinet/ip_fastfwd.c   Mon Jan 12 09:41:12 2015
(r277056)
@@ -495,17 +495,6 @@ passout:
goto consumed;
}
 
-#ifndef ALTQ
-   /*
-* Check if there is enough space in the interface queue
-*/
-   if ((ifp-if_snd.ifq_len + ip_len / ifp-if_mtu + 1) =
-   ifp-if_snd.ifq_maxlen) {
-   IPSTAT_INC(ips_odropped);
-   goto drop;
-   }
-#endif
-
/*
 * Check if media link state of interface is not down
 */
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r277058 - in head: share/man/man4 sys/netgraph

2015-01-12 Thread Gleb Smirnoff
Author: glebius
Date: Mon Jan 12 09:48:45 2015
New Revision: 277058
URL: https://svnweb.freebsd.org/changeset/base/277058

Log:
  Remove the support for NGM_CISCO_GET_IPADDR message from ng_iface(4).  The
  legitimacy of removal is proved by the fact that implementation contained
  a critical bug: the response allocated was sizeof(pointer), while should
  had been 2*sizeof(struct ng_cisco_ipaddr).  The reason for ng_iface(4) to
  support ng_cisco(4) message isn't explained anywhere, and code comes from
  original Whistle import.
  
  Sponsored by: Nginx, Inc.

Modified:
  head/share/man/man4/ng_iface.4
  head/sys/netgraph/ng_iface.c

Modified: head/share/man/man4/ng_iface.4
==
--- head/share/man/man4/ng_iface.4  Mon Jan 12 09:46:49 2015
(r277057)
+++ head/share/man/man4/ng_iface.4  Mon Jan 12 09:48:45 2015
(r277058)
@@ -35,7 +35,7 @@
 .\ $FreeBSD$
 .\ $Whistle: ng_iface.8,v 1.5 1999/01/25 23:46:26 archie Exp $
 .\
-.Dd October 28, 2005
+.Dd January 12, 2015
 .Dt NG_IFACE 4
 .Os
 .Sh NAME
@@ -111,12 +111,6 @@ The interface must not currently be up.
 .It Dv NGM_IFACE_BROADCAST Pq Ic broadcast
 Set the interface to broadcast mode.
 The interface must not currently be up.
-.It Dv NGM_CISCO_GET_IPADDR Pq Ic getipaddr
-This message is defined by the
-.Xr ng_cisco 4
-node type; see
-.Xr ng_cisco 4
-for a description.
 .El
 .Sh SHUTDOWN
 This node shuts down upon receipt of a

Modified: head/sys/netgraph/ng_iface.c
==
--- head/sys/netgraph/ng_iface.cMon Jan 12 09:46:49 2015
(r277057)
+++ head/sys/netgraph/ng_iface.cMon Jan 12 09:48:45 2015
(r277058)
@@ -83,7 +83,6 @@
 #include netgraph/netgraph.h
 #include netgraph/ng_parse.h
 #include netgraph/ng_iface.h
-#include netgraph/ng_cisco.h
 
 #ifdef NG_SEPARATE_MALLOC
 static MALLOC_DEFINE(M_NETGRAPH_IFACE, netgraph_iface, netgraph iface 
node);
@@ -144,14 +143,6 @@ static iffam_p get_iffam_from_hook(priv_
 static iffam_p get_iffam_from_name(const char *name);
 static hook_p  *get_hook_from_iffam(priv_p priv, iffam_p iffam);
 
-/* Parse type for struct ng_cisco_ipaddr */
-static const struct ng_parse_struct_field ng_cisco_ipaddr_type_fields[]
-   = NG_CISCO_IPADDR_TYPE_INFO;
-static const struct ng_parse_type ng_cisco_ipaddr_type = {
-   ng_parse_struct_type,
-   ng_cisco_ipaddr_type_fields
-};
-
 /* List of commands and how to convert arguments to/from ASCII */
 static const struct ng_cmdlist ng_iface_cmds[] = {
{
@@ -176,13 +167,6 @@ static const struct ng_cmdlist ng_iface_
  NULL
},
{
- NGM_CISCO_COOKIE,
- NGM_CISCO_GET_IPADDR,
- getipaddr,
- NULL,
- ng_cisco_ipaddr_type
-   },
-   {
  NGM_IFACE_COOKIE,
  NGM_IFACE_GET_IFINDEX,
  getifindex,
@@ -652,43 +636,6 @@ ng_iface_rcvmsg(node_p node, item_p item
break;
}
break;
-   case NGM_CISCO_COOKIE:
-   switch (msg-header.cmd) {
-   case NGM_CISCO_GET_IPADDR:  /* we understand this too */
-   {
-   struct ifaddr *ifa;
-
-   /* Return the first configured IP address */
-   if_addr_rlock(ifp);
-   TAILQ_FOREACH(ifa, ifp-if_addrhead, ifa_link) {
-   struct ng_cisco_ipaddr *ips;
-
-   if (ifa-ifa_addr-sa_family != AF_INET)
-   continue;
-   NG_MKRESPONSE(resp, msg, sizeof(ips), M_NOWAIT);
-   if (resp == NULL) {
-   error = ENOMEM;
-   break;
-   }
-   ips = (struct ng_cisco_ipaddr *)resp-data;
-   ips-ipaddr = ((struct sockaddr_in *)
-   ifa-ifa_addr)-sin_addr;
-   ips-netmask = ((struct sockaddr_in *)
-   ifa-ifa_netmask)-sin_addr;
-   break;
-   }
-   if_addr_runlock(ifp);
-
-   /* No IP addresses on this interface? */
-   if (ifa == NULL)
-   error = EADDRNOTAVAIL;
-   break;
-   }
-   default:
-   error = EINVAL;
-   break;
-   }
-   break;
case NGM_FLOW_COOKIE:
switch (msg-header.cmd) {
case NGM_LINK_IS_UP:
___
svn-src-head@freebsd.org mailing list

Re: svn commit: r276844 - head/sys/netinet6

2015-01-12 Thread Gleb Smirnoff
On Thu, Jan 08, 2015 at 06:02:06PM +, Alexander V. Chernikov wrote:
A Author: melifaro
A Date: Thu Jan  8 18:02:05 2015
A New Revision: 276844
A URL: https://svnweb.freebsd.org/changeset/base/276844
A 
A Log:
A   * Use newly-created nd6_grab_holdchain() function to retrieve lle
A hold mbuf chain instead of calling full-blown nd6_output_lle()
A for each packet. This simplifies both callers and nd6_output_lle()
A implementation.
A   * Make nd6_output_lle() static and remove now-unused lle and chain
A arguments.
A   * Rename nd6_output_flush() - nd6_flush_holdchain() to be consistent.
A   * Move all pre-send transmit hooks to newly-created nd6_output_ifp().
A Now nd6_output(), nd6_output_lle() and nd6_flush_holdchain() are using
A it to send mbufs to if_output.
A   * Remove SeND hook from nd6_na_input() because it was implemented
A incorrectly since the beginning (r211501):
A - it tagged initial input mbuf (m) instead of m_hold
A - tagging _all_ mbufs in holdchain seems to be wrong anyway.

Thanks that you gathered into one place all instances of

ifp-if_output(origifp, ...
^^^^^^

But this extremely ugly place still needs to be fixed :)

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


Re: svn commit: r276747 - head/sys/netpfil/pf

2015-01-12 Thread Gleb Smirnoff
On Thu, Jan 08, 2015 at 12:49:45AM +, Bjoern A. Zeeb wrote:
B  B  AFAIU, from the PR there is some panic fixed. What is the actual bug
B  B  and why couldn't it be fixed with having per-vnet thread?
B  B 
B  B You don’t 3 whatever pf purging threads on a system all running, 
possibly competing for some resources, e.g., locks?
B  
B  Isn't a vnet, which is a jail, already a set of a dozen of processes? So,
B  if you are speaking of 3 whatever pf purging threads, then you
B  already mean “1 mln whatever processes.
B 
B jail/VNETs can exist without a single process attached.
B 
B But I guess the point is that there is only so much work we can do at the 
same time and we should be very careful in what we try to parallellellellize as 
with 5 vnets it might be fine, with a couple of thousand you may keep a system 
busy with itself.

Let's admit that thousand of vnets all running pf is bizarre design
and has no practical application.

B  Speaking of pf purging threads competing for resources. If someone wants
B  really independent pfs in vnets, then locks should be virtualized as well.
B 
B No please don’t.  The only places where we “virtualise” locks for VNETs is 
part of data structures which are vnet specific (virtualised).

And the pf state tables (the data the purge threads work on) of course
are vnet specific (virtualised).

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

Re: svn commit: r276993 - head/sys/net80211

2015-01-12 Thread Gleb Smirnoff
On Sun, Jan 11, 2015 at 06:43:45PM +, Adrian Chadd wrote:
A Author: adrian
A Date: Sun Jan 11 18:43:45 2015
A New Revision: 276993
A URL: https://svnweb.freebsd.org/changeset/base/276993
A 
A Log:
A   Switch around the order of static inline to be in line with how it's
A   used elsewhere, and to keep gcc-4.7 happy.
A   
A   This is a request from the DragonflyBSD project.

I'd suggest to also do s/__inline/inline/ in such sweeps due to inline
being a C99 keyword, while __inline is a GNU-ism from pre-99 times.

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


Re: svn commit: r276751 - head/sys/netinet

2015-01-12 Thread Gleb Smirnoff
  Luiz,

On Fri, Jan 09, 2015 at 11:14:53AM -0200, Luiz Otavio O Souza wrote:
L On Wed, Jan 7, 2015 at 6:52 PM, Gleb Smirnoff wrote:
L  On Tue, Jan 06, 2015 at 01:07:14PM +, Luiz Otavio O Souza wrote:
L  L Author: loos
L  L Date: Tue Jan  6 13:07:13 2015
L  L New Revision: 276751
L  L URL: https://svnweb.freebsd.org/changeset/base/276751
L  L
L  L Log:
L  L   Remove the check that prevent carp(4) advskew to be set to '0'.
L  L
L  L   CARP devices are created with advskew set to '0' and once you set it 
to
L  L   any other value in the valid range (0..254) you can't set it back to 
zero.
L  L
L  L   The code in question is also used to prevent that zeroed values 
overwrite
L  L   the CARP defaults when a new CARP device is created.  Since advskew 
already
L  L   defaults to '0' for newly created devices and the new value is 
guaranteed
L  L   to be within the valid range, it is safe to overwrite it here.
L  L
L  L   PR:194672
L  L   Reported by:   c...@pfsense.org
L  L   In collaboration with: garga
L  L   Tested by: garga
L  L   MFC after: 2 weeks
L 
L  Please correct me if I am wrong, but after this change any SIOCSVH will 
reset
L  the advskew to 0.
L 
L  For example, please try to:
L 
L  ifconfig igb0 vhid 1 advskew 100
L  ifconfig igb0 vhid 1 pass foobar
L 
L  Now let's check the advskew:
L 
L  ifconfig igb0
L 
L Only if the SIOCSVH request is not initialized with data from SIOCGVH.
L 
L ifconfig (at setcarp_callback()) will always read the existing values
L before issuing the SIOCSVH with the new values and this is what makes
L my change safe:
L 
L # ifconfig em0 vhid 1 advskew 100 192.168.100.1/24 alias
L # ifconfig em0 | grep carp
L carp: MASTER vhid 1 advbase 1 advskew 100
L # ifconfig em0 vhid 1 pass foobar
L # ifconfig em0 | grep carp
L carp: MASTER vhid 1 advbase 1 advskew 100
L # ifconfig em0 vhid 1 advbase 5
L # ifconfig em0 | grep carp
L carp: MASTER vhid 1 advbase 5 advskew 100
L # ifconfig em0 vhid 1 advskew 0
L # ifconfig em0 | grep carp
L carp: MASTER vhid 1 advbase 5 advskew 0

Thanks for checking that! Good that I was wrong.

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


svn commit: r277072 - head/sys/netinet6

2015-01-12 Thread Gleb Smirnoff
Author: glebius
Date: Mon Jan 12 14:52:43 2015
New Revision: 277072
URL: https://svnweb.freebsd.org/changeset/base/277072

Log:
  Do not go one layer down to check ifqueue length. First, not all drivers
  use ifqueue at all. Second, there is no point in this lockless check.
  Either positive or negative result of the check could be incorrect after
  a tick.
  
  Sponsored by: Nginx, Inc.

Modified:
  head/sys/netinet6/ip6_output.c

Modified: head/sys/netinet6/ip6_output.c
==
--- head/sys/netinet6/ip6_output.c  Mon Jan 12 13:53:40 2015
(r277071)
+++ head/sys/netinet6/ip6_output.c  Mon Jan 12 14:52:43 2015
(r277072)
@@ -905,8 +905,6 @@ passout:
u_int32_t id = htonl(ip6_randomid());
u_char nextproto;
 
-   int qslots = ifp-if_snd.ifq_maxlen - ifp-if_snd.ifq_len;
-
/*
 * Too large for the destination or interface;
 * fragment if possible.
@@ -924,18 +922,6 @@ passout:
}
 
/*
-* Verify that we have any chance at all of being able to queue
-*  the packet or packet fragments
-*/
-   if (qslots = 0 || ((u_int)qslots * (mtu - hlen)
-tlen  /* - hlen */)) {
-   error = ENOBUFS;
-   IP6STAT_INC(ip6s_odropped);
-   goto bad;
-   }
-
-
-   /*
 * If the interface will not calculate checksums on
 * fragmented packets, then do it here.
 * XXX-BZ handle the hw offloading case.  Need flags.
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r277093 - head/sys/dev/mii

2015-01-12 Thread Gleb Smirnoff
Author: glebius
Date: Mon Jan 12 22:27:38 2015
New Revision: 277093
URL: https://svnweb.freebsd.org/changeset/base/277093

Log:
  In miibus(4) drivers provide functions that allow to get NIC
  driver name and NIC driver softc via the device(9) tree,
  instead of going dirty through the ifnet(9) layer.
  
  Differential Revision:D1506
  Reviewed by:  imp, jhb

Modified:
  head/sys/dev/mii/brgphy.c
  head/sys/dev/mii/ciphy.c
  head/sys/dev/mii/e1000phy.c
  head/sys/dev/mii/ip1000phy.c
  head/sys/dev/mii/jmphy.c
  head/sys/dev/mii/mii.c
  head/sys/dev/mii/miivar.h
  head/sys/dev/mii/mlphy.c
  head/sys/dev/mii/nsphy.c
  head/sys/dev/mii/rgephy.c
  head/sys/dev/mii/rlphy.c
  head/sys/dev/mii/tlphy.c

Modified: head/sys/dev/mii/brgphy.c
==
--- head/sys/dev/mii/brgphy.c   Mon Jan 12 21:55:48 2015(r277092)
+++ head/sys/dev/mii/brgphy.c   Mon Jan 12 22:27:38 2015(r277093)
@@ -198,7 +198,6 @@ brgphy_attach(device_t dev)
struct bge_softc *bge_sc = NULL;
struct bce_softc *bce_sc = NULL;
struct mii_softc *sc;
-   if_t ifp;
 
bsc = device_get_softc(dev);
sc = bsc-mii_sc;
@@ -207,13 +206,12 @@ brgphy_attach(device_t dev)
brgphy_funcs, 0);
 
bsc-serdes_flags = 0;
-   ifp = sc-mii_pdata-mii_ifp;
 
/* Find the MAC driver associated with this PHY. */
-   if (strcmp(if_getdname(ifp), bge) == 0)
-   bge_sc = if_getsoftc(ifp);
-   else if (strcmp(if_getdname(ifp), bce) == 0)
-   bce_sc = if_getsoftc(ifp);
+   if (mii_dev_mac_match(dev, bge))
+   bge_sc = mii_dev_mac_softc(dev);
+   else if (mii_dev_mac_match(dev, bce))
+   bce_sc = mii_dev_mac_softc(dev);
 
/* Handle any special cases based on the PHY ID */
switch (sc-mii_mpd_oui) {
@@ -933,11 +931,10 @@ brgphy_reset(struct mii_softc *sc)
ifp = sc-mii_pdata-mii_ifp;
 
/* Find the driver associated with this PHY. */
-   if (strcmp(if_getdname(ifp), bge) == 0)   {
-   bge_sc = if_getsoftc(ifp);
-   } else if (strcmp(if_getdname(ifp), bce) == 0) {
-   bce_sc = if_getsoftc(ifp);
-   }
+   if (mii_phy_mac_match(sc, bge))
+   bge_sc = mii_phy_mac_softc(sc);
+   else if (mii_phy_mac_match(sc, bce))
+   bce_sc = mii_phy_mac_softc(sc);
 
if (bge_sc) {
/* Fix up various bugs */

Modified: head/sys/dev/mii/ciphy.c
==
--- head/sys/dev/mii/ciphy.cMon Jan 12 21:55:48 2015(r277092)
+++ head/sys/dev/mii/ciphy.cMon Jan 12 22:27:38 2015(r277093)
@@ -303,8 +303,7 @@ ciphy_fixup(struct mii_softc *sc)
status = PHY_READ(sc, CIPHY_MII_AUXCSR);
speed = status  CIPHY_AUXCSR_SPEED;
 
-   if (strcmp(device_get_name(device_get_parent(sc-mii_dev)),
-   nfe) == 0) {
+   if (mii_phy_mac_match(sc, nfe)) {
/* need to set for 2.5V RGMII for NVIDIA adapters */
val = PHY_READ(sc, CIPHY_MII_ECTL1);
val = ~(CIPHY_ECTL1_IOVOL | CIPHY_ECTL1_INTSEL);

Modified: head/sys/dev/mii/e1000phy.c
==
--- head/sys/dev/mii/e1000phy.c Mon Jan 12 21:55:48 2015(r277092)
+++ head/sys/dev/mii/e1000phy.c Mon Jan 12 22:27:38 2015(r277093)
@@ -139,8 +139,7 @@ e1000phy_attach(device_t dev)
mii_phy_dev_attach(dev, MIIF_NOMANPAUSE, e1000phy_funcs, 0);
 
ifp = sc-mii_pdata-mii_ifp;
-   if (strcmp(if_getdname(ifp), msk) == 0 
-   (sc-mii_flags  MIIF_MACPRIV0) != 0)
+   if (mii_dev_mac_match(dev, msk)  (sc-mii_flags  MIIF_MACPRIV0) != 
0)
sc-mii_flags |= MIIF_PHYPRIV0;
 
switch (sc-mii_mpd_model) {

Modified: head/sys/dev/mii/ip1000phy.c
==
--- head/sys/dev/mii/ip1000phy.cMon Jan 12 21:55:48 2015
(r277092)
+++ head/sys/dev/mii/ip1000phy.cMon Jan 12 22:27:38 2015
(r277093)
@@ -110,7 +110,7 @@ ip1000phy_attach(device_t dev)
ma = device_get_ivars(dev);
flags = MIIF_NOISOLATE | MIIF_NOMANPAUSE;
if (MII_MODEL(ma-mii_id2) == MII_MODEL_xxICPLUS_IP1000A 
-strcmp(if_getdname(ma-mii_data-mii_ifp), stge) == 0 
+mii_dev_mac_match(dev, stge) 
 (miibus_get_flags(dev)  MIIF_MACPRIV0) != 0)
flags |= MIIF_PHYPRIV0;
mii_phy_dev_attach(dev, flags, ip1000phy_funcs, 1);

Modified: head/sys/dev/mii/jmphy.c
==
--- head/sys/dev/mii/jmphy.cMon Jan 12 21:55:48 2015(r277092)
+++ head/sys/dev/mii/jmphy.cMon Jan 12 22:27:38 2015(r277093)
@@ -105,7 +105,7 @@ jmphy_attach(device_t dev)
 

svn commit: r277108 - head/sys/dev/mii

2015-01-12 Thread Gleb Smirnoff
Author: glebius
Date: Tue Jan 13 06:56:04 2015
New Revision: 277108
URL: https://svnweb.freebsd.org/changeset/base/277108

Log:
  Remove unused variables.
  
  CID:  1262431
  CID:  1262430

Modified:
  head/sys/dev/mii/jmphy.c
  head/sys/dev/mii/rgephy.c

Modified: head/sys/dev/mii/jmphy.c
==
--- head/sys/dev/mii/jmphy.cTue Jan 13 06:27:02 2015(r277107)
+++ head/sys/dev/mii/jmphy.cTue Jan 13 06:56:04 2015(r277108)
@@ -100,10 +100,8 @@ jmphy_probe(device_t dev)
 static int
 jmphy_attach(device_t dev)
 {
-   struct mii_attach_args *ma;
u_int flags;
 
-   ma = device_get_ivars(dev);
flags = 0;
if (mii_dev_mac_match(dev, jme) 
(miibus_get_flags(dev)  MIIF_MACPRIV0) != 0)

Modified: head/sys/dev/mii/rgephy.c
==
--- head/sys/dev/mii/rgephy.c   Tue Jan 13 06:27:02 2015(r277107)
+++ head/sys/dev/mii/rgephy.c   Tue Jan 13 06:56:04 2015(r277108)
@@ -113,11 +113,9 @@ static int
 rgephy_attach(device_t dev)
 {
struct mii_softc *sc;
-   struct mii_attach_args *ma;
u_int flags;
 
sc = device_get_softc(dev);
-   ma = device_get_ivars(dev);
flags = 0;
if (mii_dev_mac_match(dev, re))
flags |= MIIF_PHYPRIV0;
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r277104 - head/sys/dev/mii

2015-01-12 Thread Gleb Smirnoff
Author: glebius
Date: Tue Jan 13 06:22:24 2015
New Revision: 277104
URL: https://svnweb.freebsd.org/changeset/base/277104

Log:
  Remove unused fields.

Modified:
  head/sys/dev/mii/miivar.h

Modified: head/sys/dev/mii/miivar.h
==
--- head/sys/dev/mii/miivar.h   Tue Jan 13 05:32:51 2015(r277103)
+++ head/sys/dev/mii/miivar.h   Tue Jan 13 06:22:24 2015(r277104)
@@ -45,13 +45,6 @@
 struct mii_softc;
 
 /*
- * Callbacks from MII layer into network interface device driver.
- */
-typedefint (*mii_readreg_t)(struct device *, int, int);
-typedefvoid (*mii_writereg_t)(struct device *, int, int, int);
-typedefvoid (*mii_statchg_t)(struct device *);
-
-/*
  * A network interface driver has one of these structures in its softc.
  * It is the interface from the network interface driver to the MII
  * layer.
@@ -73,13 +66,6 @@ struct mii_data {
 */
u_int mii_media_status;
u_int mii_media_active;
-
-   /*
-* Calls from MII layer into network interface driver.
-*/
-   mii_readreg_t mii_readreg;
-   mii_writereg_t mii_writereg;
-   mii_statchg_t mii_statchg;
 };
 typedef struct mii_data mii_data_t;
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r277105 - head/sys/dev/mii

2015-01-12 Thread Gleb Smirnoff
Author: glebius
Date: Tue Jan 13 06:22:55 2015
New Revision: 277105
URL: https://svnweb.freebsd.org/changeset/base/277105

Log:
  - Remove unused variable.
  - Wrap long line.

Modified:
  head/sys/dev/mii/e1000phy.c

Modified: head/sys/dev/mii/e1000phy.c
==
--- head/sys/dev/mii/e1000phy.c Tue Jan 13 06:22:24 2015(r277104)
+++ head/sys/dev/mii/e1000phy.c Tue Jan 13 06:22:55 2015(r277105)
@@ -132,14 +132,13 @@ static int
 e1000phy_attach(device_t dev)
 {
struct mii_softc *sc;
-   if_t ifp;
 
sc = device_get_softc(dev);
 
mii_phy_dev_attach(dev, MIIF_NOMANPAUSE, e1000phy_funcs, 0);
 
-   ifp = sc-mii_pdata-mii_ifp;
-   if (mii_dev_mac_match(dev, msk)  (sc-mii_flags  MIIF_MACPRIV0) != 
0)
+   if (mii_dev_mac_match(dev, msk) 
+   (sc-mii_flags  MIIF_MACPRIV0) != 0)
sc-mii_flags |= MIIF_PHYPRIV0;
 
switch (sc-mii_mpd_model) {
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r276885 - head/sys/dev/mii

2015-01-09 Thread Gleb Smirnoff
Author: glebius
Date: Fri Jan  9 12:26:08 2015
New Revision: 276885
URL: https://svnweb.freebsd.org/changeset/base/276885

Log:
  Use nitems().

Modified:
  head/sys/dev/mii/truephy.c

Modified: head/sys/dev/mii/truephy.c
==
--- head/sys/dev/mii/truephy.c  Fri Jan  9 12:08:51 2015(r276884)
+++ head/sys/dev/mii/truephy.c  Fri Jan  9 12:26:08 2015(r276885)
@@ -244,9 +244,7 @@ truephy_reset(struct mii_softc *sc)
PHY_WRITE(sc, TRUEPHY_CTRL,
  TRUEPHY_CTRL_DIAG | TRUEPHY_CTRL_RSV1 | TRUEPHY_CTRL_RSV0);
 
-#define N(arr) (int)(sizeof(arr) / sizeof(arr[0]))
-
-   for (i = 0; i  N(truephy_dspcode); ++i) {
+   for (i = 0; i  nitems(truephy_dspcode); ++i) {
const struct truephy_dsp *dsp = truephy_dspcode[i];
 
PHY_WRITE(sc, TRUEPHY_INDEX, dsp-index);
@@ -256,8 +254,6 @@ truephy_reset(struct mii_softc *sc)
PHY_READ(sc, TRUEPHY_DATA);
}
 
-#undef N
-
PHY_READ(sc, MII_BMCR);
PHY_READ(sc, TRUEPHY_CTRL);
PHY_WRITE(sc, MII_BMCR, BMCR_AUTOEN |  BMCR_S1000);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r277176 - head/sys/dev/mii

2015-01-14 Thread Gleb Smirnoff
Author: glebius
Date: Wed Jan 14 12:46:38 2015
New Revision: 277176
URL: https://svnweb.freebsd.org/changeset/base/277176

Log:
  Clean some dead code.

Modified:
  head/sys/dev/mii/mii.c
  head/sys/dev/mii/mii_physubr.c
  head/sys/dev/mii/miivar.h

Modified: head/sys/dev/mii/mii.c
==
--- head/sys/dev/mii/mii.c  Wed Jan 14 11:53:41 2015(r277175)
+++ head/sys/dev/mii/mii.c  Wed Jan 14 12:46:38 2015(r277176)
@@ -612,18 +612,6 @@ mii_pollstat(struct mii_data *mii)
}
 }
 
-/*
- * Inform the PHYs that the interface is down.
- */
-void
-mii_down(struct mii_data *mii)
-{
-   struct mii_softc *child;
-
-   LIST_FOREACH(child, mii-mii_phys, mii_list)
-   mii_phy_down(child);
-}
-
 static unsigned char
 mii_bitreverse(unsigned char x)
 {

Modified: head/sys/dev/mii/mii_physubr.c
==
--- head/sys/dev/mii/mii_physubr.c  Wed Jan 14 11:53:41 2015
(r277175)
+++ head/sys/dev/mii/mii_physubr.c  Wed Jan 14 12:46:38 2015
(r277176)
@@ -279,12 +279,6 @@ mii_phy_reset(struct mii_softc *sc)
 }
 
 void
-mii_phy_down(struct mii_softc *sc)
-{
-
-}
-
-void
 mii_phy_update(struct mii_softc *sc, int cmd)
 {
struct mii_data *mii = sc-mii_pdata;
@@ -479,7 +473,6 @@ mii_phy_detach(device_t dev)
struct mii_softc *sc;
 
sc = device_get_softc(dev);
-   mii_phy_down(sc);
sc-mii_dev = NULL;
LIST_REMOVE(sc, mii_list);
return (0);

Modified: head/sys/dev/mii/miivar.h
==
--- head/sys/dev/mii/miivar.h   Wed Jan 14 11:53:41 2015(r277175)
+++ head/sys/dev/mii/miivar.h   Wed Jan 14 12:46:38 2015(r277176)
@@ -235,7 +235,6 @@ extern driver_t miibus_driver;
 
 intmii_attach(device_t, device_t *, if_t, ifm_change_cb_t,
ifm_stat_cb_t, int, int, int, int);
-void   mii_down(struct mii_data *);
 intmii_mediachg(struct mii_data *);
 void   mii_tick(struct mii_data *);
 void   mii_pollstat(struct mii_data *);
@@ -243,7 +242,6 @@ voidmii_phy_add_media(struct mii_softc 
 
 intmii_phy_auto(struct mii_softc *);
 intmii_phy_detach(device_t dev);
-void   mii_phy_down(struct mii_softc *);
 u_int  mii_phy_flowstatus(struct mii_softc *);
 void   mii_phy_reset(struct mii_softc *);
 void   mii_phy_setmedia(struct mii_softc *sc);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r277077 - head/sys/netinet

2015-01-12 Thread Gleb Smirnoff
Author: glebius
Date: Mon Jan 12 18:06:22 2015
New Revision: 277077
URL: https://svnweb.freebsd.org/changeset/base/277077

Log:
  Do not go one layer down to check ifqueue length. First, not all drivers
  use ifqueue at all. Second, there is no point in this lockless check.
  Either positive or negative result of the check could be incorrect after
  a tick.
  
  Reviewed by:  tuexen
  Sponsored by: Nginx, Inc.

Modified:
  head/sys/netinet/sctp_output.c

Modified: head/sys/netinet/sctp_output.c
==
--- head/sys/netinet/sctp_output.c  Mon Jan 12 16:18:34 2015
(r277076)
+++ head/sys/netinet/sctp_output.c  Mon Jan 12 18:06:22 2015
(r277077)
@@ -7958,22 +7958,6 @@ again_one_more_time:
} else {
skip_data_for_this_net = 0;
}
-   if ((net-ro.ro_rt)  (net-ro.ro_rt-rt_ifp)) {
-   /*
-* if we have a route and an ifp check to see if we
-* have room to send to this guy
-*/
-   struct ifnet *ifp;
-
-   ifp = net-ro.ro_rt-rt_ifp;
-   if ((ifp-if_snd.ifq_len + 2) = 
ifp-if_snd.ifq_maxlen) {
-   SCTP_STAT_INCR(sctps_ifnomemqueued);
-   if (SCTP_BASE_SYSCTL(sctp_logging_level)  
SCTP_LOG_MAXBURST_ENABLE) {
-   sctp_log_maxburst(stcb, net, 
ifp-if_snd.ifq_len, ifp-if_snd.ifq_maxlen, SCTP_MAX_IFP_APPLIED);
-   }
-   continue;
-   }
-   }
switch (((struct sockaddr *)net-ro._l_addr)-sa_family) {
 #ifdef INET
case AF_INET:
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


Re: svn commit: r277072 - head/sys/netinet6

2015-01-12 Thread Gleb Smirnoff
On Mon, Jan 12, 2015 at 08:09:18AM -0800, Adrian Chadd wrote:
A On 12 January 2015 at 07:09, Alexander V. Chernikov
A melif...@freebsd.org wrote:
A  On 12.01.2015 17:52, Gleb Smirnoff wrote:
A  Author: glebius
A  Date: Mon Jan 12 14:52:43 2015
A  New Revision: 277072
A  URL: https://svnweb.freebsd.org/changeset/base/277072
A 
A  Log:
ADo not go one layer down to check ifqueue length. First, not all drivers
Ause ifqueue at all. Second, there is no point in this lockless check.
AEither positive or negative result of the check could be incorrect after
Aa tick.
A  Finally, no useless ifq_maxlen check!
A 
A Yeah, I killed it in the ipv4 world. Well, commented it out. It's been
A bogus ever since kernels became re-entrant and SMP. :(

Another one (even with extra mistake) left in ip_fastfwd.c until today.

One still left in SCTP output code, waiting for maintainers to review it.

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


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

2015-02-14 Thread Gleb Smirnoff
On Sat, Feb 14, 2015 at 05:02:51PM +, John Baldwin wrote:
J Author: jhb
J Date: Sat Feb 14 17:02:51 2015
J New Revision: 278760
J URL: https://svnweb.freebsd.org/changeset/base/278760
J 
J Log:
J   Add two new counters for vnode life cycle events:
J   - vfs.recycles counts the number of vnodes forcefully recycled to avoid
J exceeding kern.maxvnodes.
J   - vfs.vnodes_created counts the number of vnodes created by successful
J calls to getnewvnode().
J   
J   Differential Revision: https://reviews.freebsd.org/D1671
J   Reviewed by:   kib
J   MFC after: 1 week

Why don't use counter(9) for that? Would avoid atomics.


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


Re: svn commit: r278737 - head/usr.sbin/flowctl

2015-02-14 Thread Gleb Smirnoff
  Bruce,

On Sat, Feb 14, 2015 at 08:46:58PM +1100, Bruce Evans wrote:
B Using VLAs and also the C99 feature of declarations anwhere, and extensions
B like __aligned(), we can almost implement a full alloca() using the fixed
B version of this change:
B 
B /*
B   * XXX need extended statement-expression so that __buf doesn't go out
B   * of scope after the right brace.
B   */
B #define  my_alloca(n) __extension__ ({
B  /* XXX need unique name. */ \
B  char __buf[__roundup2((n), MUMBLE)] __aligned(MUMBLE);  \
B  \
B  (void *)__buf;  \
B })

I like this idea. But would this exact code work? The life of
__buf is limited by the code block, and we exit the block
immediately. Wouldn't the allocation be overwritten if we
enter any function or block later?

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


Re: svn commit: r278472 - in head/sys: netinet netinet6

2015-02-13 Thread Gleb Smirnoff
  Randall,

  thanks a lot for investigating that.

On Fri, Feb 13, 2015 at 05:27:40PM -0500, Randall Stewart wrote:
R Gleb:
R 
R Ok here is the diff of the arp timer function that this changed made 
(238990):
R 
R  arptimer(void *arg)
R  {
R +   struct llentry *lle = (struct llentry *)arg;
R struct ifnet *ifp;
R -   struct llentry   *lle;
R -   int pkts_dropped;
R +   size_t pkts_dropped;
R  
R -   KASSERT(arg != NULL, (%s: arg NULL, __func__));
R -   lle = (struct llentry *)arg;
R +   if (lle-la_flags  LLE_STATIC) {
R +   LLE_WUNLOCK(lle);
R +   return;
R +   }
R +
R ifp = lle-lle_tbl-llt_ifp;
R CURVNET_SET(ifp-if_vnet);
R +
R +   if (lle-la_flags != LLE_DELETED) {
R +   int evt;
R +
R +   if (lle-la_flags  LLE_VALID)
R +   evt = LLENTRY_EXPIRED;
R +   else
R +   evt = LLENTRY_TIMEDOUT;
R +   EVENTHANDLER_INVOKE(lle_event, lle, evt);
R +   }
R +
R +   callout_stop(lle-la_timer);
R +
R +   /* XXX: LOR avoidance. We still have ref on lle. */
R +   LLE_WUNLOCK(lle);
R IF_AFDATA_LOCK(ifp);
R LLE_WLOCK(lle);
R -   if (lle-la_flags  LLE_STATIC)
R -   LLE_WUNLOCK(lle);
R -   else {
R -   if (!callout_pending(lle-la_timer) 
R -   callout_active(lle-la_timer)) {
R -   callout_stop(lle-la_timer);
R -   LLE_REMREF(lle);
R  
R -   if (lle-la_flags != LLE_DELETED) {
R -   int evt;
R -
R -   if (lle-la_flags  LLE_VALID)
R -   evt = LLENTRY_EXPIRED;
R -   else
R -   evt = LLENTRY_TIMEDOUT;
R -   EVENTHANDLER_INVOKE(lle_event, lle, evt);
R -   }
R -
R -   pkts_dropped = llentry_free(lle);
R -   ARPSTAT_ADD(dropped, pkts_dropped);
R -   ARPSTAT_INC(timeouts);
R -   } else {
R -#ifdef DIAGNOSTIC
R -   struct sockaddr *l3addr = L3_ADDR(lle);
R -   log(LOG_INFO,
R -   arptimer issue: %p, IPv4 address: \%s\\n, 
lle,
R -   inet_ntoa(
R -   ((const struct sockaddr_in 
*)l3addr)-sin_addr));
R -#endif
R -   LLE_WUNLOCK(lle);
R -   }
R -   }
R +   LLE_REMREF(lle);
R +   pkts_dropped = llentry_free(lle);
R IF_AFDATA_UNLOCK(ifp);
R +   ARPSTAT_ADD(dropped, pkts_dropped);
R +   ARPSTAT_INC(timeouts);
R CURVNET_RESTORE();
R  }
R **
R 
R And I can see *what* the problem was.. If you look at the lines:
R -   if (!callout_pending(lle-la_timer) 
R -   callout_active(lle-la_timer)) {
R 
R This is the *incorrect* way to write this code it should have been:
R   if (callout_pending(lle-la_timer) 
R   !callout_active(lle-la_timer)) {
R 
R To properly do the MPSAFE thing.. take a look at the callout manual..
R So the original author just mixed up the test.. 
R 
R The idea is after you get the lock you check if its pending again, if
R so someone has restarted it.. and if its not active, then someone has
R stopped it.
R 
R They check if it was *not* pending.. which is almost always the case
R since the callout code removes the pending flag and thats what you want
R to be there. So not pending would always be true.. 
R 
R I don’t see that this old code did the callout_deactive().. but I think
R the callout_stop() does that I guess..
R 
R I think the problem was that the original code was wrong and that
R the fix yes, avoided one race but put in another.
R 
R I do think a callout_async_drain is the right thing, but that will take a 
while
R to get right. Peter Holm (thank you so much) has been pounding on this, if 
you
R could find another test to add.. that would be great. I think this will work
R the way it is..
R 
R R
R 
R 
R 
R 
R 
R 
R On Feb 13, 2015, at 4:21 PM, Gleb Smirnoff gleb...@freebsd.org wrote:
R 
R  165863
R 
R 
R Randall Stewart
R r...@netflix.com
R 803-317-4952
R 
R 
R 
R 
R 

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

Re: svn commit: r278472 - in head/sys: netinet netinet6

2015-02-13 Thread Gleb Smirnoff
On Mon, Feb 09, 2015 at 03:11:21PM -0500, John Baldwin wrote:
J On Monday, February 09, 2015 07:28:12 PM Randall Stewart wrote:
J  Author: rrs
J  Date: Mon Feb  9 19:28:11 2015
J  New Revision: 278472
J  URL: https://svnweb.freebsd.org/changeset/base/278472
J  
J  Log:
JThis fixes a bug in the way that the LLE timers for nd6
Jand arp were being used. They basically would pass in the
Jmutex to the callout_init. Because they used this method
Jto the callout system, it was possible to stop the callout.
JWhen flushing the table and you stopped the running callout, the
Jcallout_stop code would return 1 indicating that it was going
Jto stop the callout (that was about to run on the callout_wheel blocked
Jby the function calling the stop). Now when 1 was returned, it would
Jlower the reference count one extra time for the stopped timer, then
Ja few lines later delete the memory. Of course the callout_wheel was
Jstuck in the lock code and would then crash since it was accessing
Jfreed memory. By using callout_init(c, 1) we always get a 0 back
Jand the reference counting bug does not rear its head. We do have
Jto make a few adjustments to the callouts themselves though to make
Jsure it does the proper thing if rescheduled as well as gets the lock.
J  
JCommented upon by hiren and sbruno
JSee Phabricator D1777 for more details.
J  
JCommented upon by hiren and sbruno
JReviewed by: adrian, jhb and bz
JSponsored by:Netflix Inc.
J 
J Eh, I looked at it, but I really, really don't like it.  I think 
J callout_init_*() should be preferred to CALLOUT_MPSAFE whenever possible as 
it 
J is less race-prone.  I think this should probably be fixed by adding Hans' 
J callout_drain_async() instead, though this is fine as a temporary workaround.

I second concerns. Please look at kern/165863 and r238990 that fixed it.
Transition from CALLOUT_MPSAFE to callout_init_rw() was intentional
and fixed races.

I added to Cc guys who helped to track down that races. May be someone still
has test scripts at hand. AFAIR, there were some that allowed to put a box
down quite quickly.

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


Re: svn commit: r278640 - head/sys/netgraph

2015-02-13 Thread Gleb Smirnoff
  Hi!

On Thu, Feb 12, 2015 at 10:20:34PM +, Gleb Smirnoff wrote:
T Author: glebius
T Date: Thu Feb 12 22:20:34 2015
T New Revision: 278640
T URL: https://svnweb.freebsd.org/changeset/base/278640
T 
T Log:
T   Revise default limit for maximum of netgraph data items.
T   With modern internet speeds the limit can be reached even
T   on a single L2TP link.

Actually any ng_item of data type requires an mbuf to be connected
to it, and thus I suggest to use mbuf limits to drive ng_item limits.

If we got an item leak with mbufs being properly freed, then we've
got a bug to fix, and any limit won't work in long run time. I never
evidenced such a bug, but there complaints on hitting limit at
traffic bursts. As said, with previous 512 item limit I experienced
that even on a laptop.

Any objections on removing the limit, guys?

T Modified:
T   head/sys/netgraph/ng_base.c
T 
T Modified: head/sys/netgraph/ng_base.c
T 
==
T --- head/sys/netgraph/ng_base.c  Thu Feb 12 21:20:28 2015
(r278639)
T +++ head/sys/netgraph/ng_base.c  Thu Feb 12 22:20:34 2015
(r278640)
T @@ -2952,7 +2952,7 @@ uma_zone_t ng_qzone;
T  uma_zone_t  ng_qdzone;
T  static int  numthreads = 0; /* number of queue threads */
T  static int  maxalloc = 4096;/* limit the damage of a leak */
T -static int  maxdata = 512;  /* limit the damage of a DoS */
T +static int  maxdata = 4096; /* limit the damage of a DoS */
T  
T  SYSCTL_INT(_net_graph, OID_AUTO, threads, CTLFLAG_RDTUN, numthreads,
T  0, Number of queue processing threads);
T 

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


svn commit: r278737 - head/usr.sbin/flowctl

2015-02-13 Thread Gleb Smirnoff
Author: glebius
Date: Fri Feb 13 23:57:20 2015
New Revision: 278737
URL: https://svnweb.freebsd.org/changeset/base/278737

Log:
  Use less ugly code to allocate buffer of SORCVBUF_SIZE.

Modified:
  head/usr.sbin/flowctl/flowctl.c

Modified: head/usr.sbin/flowctl/flowctl.c
==
--- head/usr.sbin/flowctl/flowctl.c Fri Feb 13 23:43:59 2015
(r278736)
+++ head/usr.sbin/flowctl/flowctl.c Fri Feb 13 23:57:20 2015
(r278737)
@@ -222,10 +222,12 @@ ctl_show(int argc, char **argv)
 static void
 do_show(int version, void (*func)(struct ngnf_show_header *))
 {
-   struct ng_mesg ng_mesg[SORCVBUF_SIZE];
+   char buf[SORCVBUF_SIZE];
+   struct ng_mesg *ng_mesg;
struct ngnf_show_header req, *resp;
int token, nread;
 
+   ng_mesg = (struct ng_mesg *)buf;
req.version = version;
req.hash_id = req.list_id = 0;
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r278828 - head/sys/netinet6

2015-02-15 Thread Gleb Smirnoff
Author: glebius
Date: Mon Feb 16 01:12:20 2015
New Revision: 278828
URL: https://svnweb.freebsd.org/changeset/base/278828

Log:
  Factor out ip6_deletefraghdr() function, to be shared between IPv6
  stack and pf(4).
  
  Submitted by: Kristof Provost
  Reviewed by:  ae
  Differential Revision:D1764

Modified:
  head/sys/netinet6/frag6.c
  head/sys/netinet6/ip6_output.c
  head/sys/netinet6/ip6_var.h

Modified: head/sys/netinet6/frag6.c
==
--- head/sys/netinet6/frag6.c   Sun Feb 15 23:58:57 2015(r278827)
+++ head/sys/netinet6/frag6.c   Mon Feb 16 01:12:20 2015(r278828)
@@ -541,27 +541,16 @@ insert:
*q6-ip6q_nxtp = (u_char)(nxt  0xff);
 #endif
 
-   /* Delete frag6 header */
-   if (m-m_len = offset + sizeof(struct ip6_frag)) {
-   /* This is the only possible case with !PULLDOWN_TEST */
-   ovbcopy((caddr_t)ip6, (caddr_t)ip6 + sizeof(struct ip6_frag),
-   offset);
-   m-m_data += sizeof(struct ip6_frag);
-   m-m_len -= sizeof(struct ip6_frag);
-   } else {
-   /* this comes with no copy if the boundary is on cluster */
-   if ((t = m_split(m, offset, M_NOWAIT)) == NULL) {
-   frag6_remque(q6);
-   V_frag6_nfrags -= q6-ip6q_nfrag;
+   if (ip6_deletefraghdr(m, offset, M_NOWAIT) != 0) {
+   frag6_remque(q6);
+   V_frag6_nfrags -= q6-ip6q_nfrag;
 #ifdef MAC
-   mac_ip6q_destroy(q6);
+   mac_ip6q_destroy(q6);
 #endif
-   free(q6, M_FTABLE);
-   V_frag6_nfragpackets--;
-   goto dropfrag;
-   }
-   m_adj(t, sizeof(struct ip6_frag));
-   m_cat(m, t);
+   free(q6, M_FTABLE);
+   V_frag6_nfragpackets--;
+
+   goto dropfrag;
}
 
/*

Modified: head/sys/netinet6/ip6_output.c
==
--- head/sys/netinet6/ip6_output.c  Sun Feb 15 23:58:57 2015
(r278827)
+++ head/sys/netinet6/ip6_output.c  Mon Feb 16 01:12:20 2015
(r278828)
@@ -1206,6 +1206,30 @@ ip6_insertfraghdr(struct mbuf *m0, struc
return (0);
 }
 
+int
+ip6_deletefraghdr(struct mbuf *m, int offset, int wait)
+{
+   struct ip6_hdr *ip6 = mtod(m, struct ip6_hdr *);
+   struct mbuf *t;
+
+   /* Delete frag6 header. */
+   if (m-m_len = offset + sizeof(struct ip6_frag)) {
+   /* This is the only possible case with !PULLDOWN_TEST. */
+   bcopy(ip6, (char *)ip6 + sizeof(struct ip6_frag),
+   offset);
+   m-m_data += sizeof(struct ip6_frag);
+   m-m_len -= sizeof(struct ip6_frag);
+   } else {
+   /* This comes with no copy if the boundary is on cluster. */
+   if ((t = m_split(m, offset, wait)) == NULL)
+   return (ENOMEM);
+   m_adj(t, sizeof(struct ip6_frag));
+   m_cat(m, t);
+   }
+
+   return (0);
+}
+
 static int
 ip6_getpmtu(struct route_in6 *ro_pmtu, struct route_in6 *ro,
 struct ifnet *ifp, struct in6_addr *dst, u_long *mtup,

Modified: head/sys/netinet6/ip6_var.h
==
--- head/sys/netinet6/ip6_var.h Sun Feb 15 23:58:57 2015(r278827)
+++ head/sys/netinet6/ip6_var.h Mon Feb 16 01:12:20 2015(r278828)
@@ -388,6 +388,7 @@ int ip6_setpktopts(struct mbuf *, struct
 void   ip6_clearpktopts(struct ip6_pktopts *, int);
 struct ip6_pktopts *ip6_copypktopts(struct ip6_pktopts *, int);
 intip6_optlen(struct inpcb *);
+intip6_deletefraghdr(struct mbuf *, int, int);
 
 introute6_input(struct mbuf **, int *, int);
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


Re: svn commit: r276747 - head/sys/netpfil/pf

2015-02-15 Thread Gleb Smirnoff
  Craig,

On Sat, Feb 14, 2015 at 07:35:53PM -0800, Craig Rodrigues wrote:
C  On Thu, Jan 22, 2015 at 10:09:41PM +0100, Nikos Vassiliadis wrote:
C  N  Sorry guys, I backed this out due to broken kldunload of pf module,
C  which
C  N  is critical when you are working with pf bugs.
C  N
C  N For sure. 100% understood.
C  N
C  N  I had to backout r276746 as well, since it has numerous build
C  breakages,
C  N  that are addressed by later revisions.
C  N 
C  N  That's my fault that I don't review in time, and I will try to improve
C  N  the situation.
C  N 
C  N  Can you please replay r276746 again, addressing all the build problems
C  N  and send the patch to me? You can user reviews.freebsd.org if you
C  want.
C  N 
C  N  I'd like to get this in, but in a better quality.
C  N
C  N I'd like to get involved again and help you fixing pf. Craig could you
C  N replay 276746?
C 
C I wish you could have fixed the pf unload problem without backing out
C all these changes.  I took all these changes from your projects/pf branch,
C which was starting to bitrot because it was not being sync'd with head.
C 
C I got confirmation from several people that the fixes as they were (after
C the build break fixes),
C actually fixed their issues with PF and VIMAGE, which have been pending for
C several
C years now with no visible progress made.
C 
C Most regular users of PF don't really kldunload it once it is used.
C For development use, I've been testing inside bhyve VM's, which doesn't
C solve the kldunload problem but allows testing and forward progress.
C 
C Why do you want me to replay 276746 and give you a patch?
C 
C Why don't you just do it yourself?

Because it is responsibility of the committer, who broke something, to
fix it, not mine.

Nevertheless, I tried to do that, and it took more than couple of hours, but
I failed to untangle all the problems that r276746 brought and proceeded with
checkout.

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


Re: svn commit: r276747 - head/sys/netpfil/pf

2015-02-15 Thread Gleb Smirnoff
On Sun, Feb 15, 2015 at 01:26:18PM -0800, Craig Rodrigues wrote:
C What are the problems in 276746 that you were unhappy with
C besides being unable to kldunload PF?

They were listed in Message-ID: 20150121214445.gl15...@freebsd.org.

Also, the fact that commit required a serie of followup commits,
means that initial commit was not tested properly.

And did I ever said being unable to kldunload PF? This is what I
said:

 You blindly remove kproc_exit(). What do you think would happen on
 'kldunload -f pf'?

If you can't grok that, you probably don't even understand the code
you committed. Since what is going to happen is kernel panic.

C With 276746, without the follow-on fixes, if you kldunload PF
C while VIMAGE is unabled, the kernel panics.  That seems worse
C than being unable to kldunload PF.

So, without 276746 pf would panic with VIMAGE. And after 276747
pf would panic without VIMAGE. And yes, this is worse. Since
backing out only 276747 leads to unbuildable kernel, I ended
with backing out all chain of commits.

C If I submit another patch, I am just going to commit it,
C but I don't know if you will be unhappy and revert it.

No, you will wait for review.

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


Re: svn commit: r276747 - head/sys/netpfil/pf

2015-02-15 Thread Gleb Smirnoff
On Sun, Feb 15, 2015 at 01:33:19PM -0800, Craig Rodrigues wrote:
C By the way, it would be helpful if you could provide feedback in
C Phabricator.  When I created those Phabricator reviews, I added
C you as a reviewer to all of them, so you can't say that you didn't see
C the patches.
C You did not provide feedback on any of them:
C 
C https://reviews.freebsd.org/D1309
C https://reviews.freebsd.org/D1312
C https://reviews.freebsd.org/D1313
C https://reviews.freebsd.org/D1315
C 
C Please take some time to go and provide feedback in those
C reviews, so that a better patch can be made that makes you happy.

Did you address all problems that arised after code was committed?

Please do, otherwise my review would require me to cut-n-paste from
my own emails.

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


Re: svn commit: r278828 - head/sys/netinet6

2015-02-15 Thread Gleb Smirnoff
On Mon, Feb 16, 2015 at 01:25:05AM +, Bjoern A. Zeeb wrote:
B 
B  On 16 Feb 2015, at 01:12 , Gleb Smirnoff gleb...@freebsd.org wrote:
B  
B  Author: glebius
B  Date: Mon Feb 16 01:12:20 2015
B  New Revision: 278828
B  URL: https://svnweb.freebsd.org/changeset/base/278828
B  
B  Log:
B   Factor out ip6_deletefraghdr() function, to be shared between IPv6
B   stack and pf(4).
B  
B   Submitted by: Kristof Provost
B   Reviewed by:  ae
B   Differential Revision:D1764
B  
B  Modified:
B   head/sys/netinet6/frag6.c
B   head/sys/netinet6/ip6_output.c
B 
B Why did it have to move file?

Since it is related to fragment handling. Why not?

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


svn commit: r278832 - head/sys/netinet6

2015-02-15 Thread Gleb Smirnoff
Author: glebius
Date: Mon Feb 16 05:58:32 2015
New Revision: 278832
URL: https://svnweb.freebsd.org/changeset/base/278832

Log:
  Move ip6_deletefraghdr() to frag6.c.
  
  Suggested by: bz

Modified:
  head/sys/netinet6/frag6.c
  head/sys/netinet6/ip6_output.c

Modified: head/sys/netinet6/frag6.c
==
--- head/sys/netinet6/frag6.c   Mon Feb 16 03:38:27 2015(r278831)
+++ head/sys/netinet6/frag6.c   Mon Feb 16 05:58:32 2015(r278832)
@@ -764,3 +764,27 @@ frag6_drain(void)
IP6Q_UNLOCK();
VNET_LIST_RUNLOCK_NOSLEEP();
 }
+
+int
+ip6_deletefraghdr(struct mbuf *m, int offset, int wait)
+{
+   struct ip6_hdr *ip6 = mtod(m, struct ip6_hdr *);
+   struct mbuf *t;
+
+   /* Delete frag6 header. */
+   if (m-m_len = offset + sizeof(struct ip6_frag)) {
+   /* This is the only possible case with !PULLDOWN_TEST. */
+   bcopy(ip6, (char *)ip6 + sizeof(struct ip6_frag),
+   offset);
+   m-m_data += sizeof(struct ip6_frag);
+   m-m_len -= sizeof(struct ip6_frag);
+   } else {
+   /* This comes with no copy if the boundary is on cluster. */
+   if ((t = m_split(m, offset, wait)) == NULL)
+   return (ENOMEM);
+   m_adj(t, sizeof(struct ip6_frag));
+   m_cat(m, t);
+   }
+
+   return (0);
+}

Modified: head/sys/netinet6/ip6_output.c
==
--- head/sys/netinet6/ip6_output.c  Mon Feb 16 03:38:27 2015
(r278831)
+++ head/sys/netinet6/ip6_output.c  Mon Feb 16 05:58:32 2015
(r278832)
@@ -1206,30 +1206,6 @@ ip6_insertfraghdr(struct mbuf *m0, struc
return (0);
 }
 
-int
-ip6_deletefraghdr(struct mbuf *m, int offset, int wait)
-{
-   struct ip6_hdr *ip6 = mtod(m, struct ip6_hdr *);
-   struct mbuf *t;
-
-   /* Delete frag6 header. */
-   if (m-m_len = offset + sizeof(struct ip6_frag)) {
-   /* This is the only possible case with !PULLDOWN_TEST. */
-   bcopy(ip6, (char *)ip6 + sizeof(struct ip6_frag),
-   offset);
-   m-m_data += sizeof(struct ip6_frag);
-   m-m_len -= sizeof(struct ip6_frag);
-   } else {
-   /* This comes with no copy if the boundary is on cluster. */
-   if ((t = m_split(m, offset, wait)) == NULL)
-   return (ENOMEM);
-   m_adj(t, sizeof(struct ip6_frag));
-   m_cat(m, t);
-   }
-
-   return (0);
-}
-
 static int
 ip6_getpmtu(struct route_in6 *ro_pmtu, struct route_in6 *ro,
 struct ifnet *ifp, struct in6_addr *dst, u_long *mtup,
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r278842 - head/sys/netinet6

2015-02-15 Thread Gleb Smirnoff
Author: glebius
Date: Mon Feb 16 06:30:27 2015
New Revision: 278842
URL: https://svnweb.freebsd.org/changeset/base/278842

Log:
  Factor out ip6_fragment() function, to be used in IPv6 stack and pf(4).
  
  Submitted by: Kristof Provost
  Differential Revision:D1766

Modified:
  head/sys/netinet6/ip6_output.c
  head/sys/netinet6/ip6_var.h

Modified: head/sys/netinet6/ip6_output.c
==
--- head/sys/netinet6/ip6_output.c  Mon Feb 16 06:16:38 2015
(r278841)
+++ head/sys/netinet6/ip6_output.c  Mon Feb 16 06:30:27 2015
(r278842)
@@ -212,6 +212,65 @@ in6_delayed_cksum(struct mbuf *m, uint32
*(u_short *)(m-m_data + offset) = csum;
 }
 
+int
+ip6_fragment(struct ifnet *ifp, struct mbuf *m0, int hlen, u_char nextproto,
+int mtu)
+{
+   struct mbuf *m, **mnext, *m_frgpart;
+   struct ip6_hdr *ip6, *mhip6;
+   struct ip6_frag *ip6f;
+   int off;
+   int error;
+   int tlen = m0-m_pkthdr.len;
+   uint32_t id = htonl(ip6_randomid());
+
+   m = m0;
+   ip6 = mtod(m, struct ip6_hdr *);
+   mnext = m-m_nextpkt;
+
+   for (off = hlen; off  tlen; off += mtu) {
+   m = m_gethdr(M_NOWAIT, MT_DATA);
+   if (!m) {
+   IP6STAT_INC(ip6s_odropped);
+   return (ENOBUFS);
+   }
+   m-m_flags = m0-m_flags  M_COPYFLAGS;
+   *mnext = m;
+   mnext = m-m_nextpkt;
+   m-m_data += max_linkhdr;
+   mhip6 = mtod(m, struct ip6_hdr *);
+   *mhip6 = *ip6;
+   m-m_len = sizeof(*mhip6);
+   error = ip6_insertfraghdr(m0, m, hlen, ip6f);
+   if (error) {
+   IP6STAT_INC(ip6s_odropped);
+   return (error);
+   }
+   ip6f-ip6f_offlg = htons((u_short)((off - hlen)  ~7));
+   if (off + mtu = tlen)
+   mtu = tlen - off;
+   else
+   ip6f-ip6f_offlg |= IP6F_MORE_FRAG;
+   mhip6-ip6_plen = htons((u_short)(mtu + hlen +
+   sizeof(*ip6f) - sizeof(struct ip6_hdr)));
+   if ((m_frgpart = m_copy(m0, off, mtu)) == 0) {
+   IP6STAT_INC(ip6s_odropped);
+   return (ENOBUFS);
+   }
+   m_cat(m, m_frgpart);
+   m-m_pkthdr.len = mtu + hlen + sizeof(*ip6f);
+   m-m_pkthdr.fibnum = m0-m_pkthdr.fibnum;
+   m-m_pkthdr.rcvif = NULL;
+   ip6f-ip6f_reserved = 0;
+   ip6f-ip6f_ident = id;
+   ip6f-ip6f_nxt = nextproto;
+   IP6STAT_INC(ip6s_ofragments);
+   in6_ifstat_inc(ifp, ifs6_out_fragcreat);
+   }
+
+   return (0);
+}
+
 /*
  * IP6 output. The packet in mbuf chain m contains a skeletal IP6
  * header (with pri, len, nxt, hlim, src, dst).
@@ -236,11 +295,11 @@ ip6_output(struct mbuf *m0, struct ip6_p
 struct route_in6 *ro, int flags, struct ip6_moptions *im6o,
 struct ifnet **ifpp, struct inpcb *inp)
 {
-   struct ip6_hdr *ip6, *mhip6;
+   struct ip6_hdr *ip6;
struct ifnet *ifp, *origifp;
struct mbuf *m = m0;
struct mbuf *mprev = NULL;
-   int hlen, tlen, len, off;
+   int hlen, tlen, len;
struct route_in6 ip6route;
struct rtentry *rt = NULL;
struct sockaddr_in6 *dst, src_sa, dst_sa;
@@ -901,9 +960,6 @@ passout:
in6_ifstat_inc(ifp, ifs6_out_fragfail);
goto bad;
} else {
-   struct mbuf **mnext, *m_frgpart;
-   struct ip6_frag *ip6f;
-   u_int32_t id = htonl(ip6_randomid());
u_char nextproto;
 
/*
@@ -937,8 +993,6 @@ passout:
m-m_pkthdr.csum_flags = ~CSUM_SCTP_IPV6;
}
 #endif
-   mnext = m-m_nextpkt;
-
/*
 * Change the next header field of the last header in the
 * unfragmentable part.
@@ -963,47 +1017,8 @@ passout:
 * chain.
 */
m0 = m;
-   for (off = hlen; off  tlen; off += len) {
-   m = m_gethdr(M_NOWAIT, MT_DATA);
-   if (!m) {
-   error = ENOBUFS;
-   IP6STAT_INC(ip6s_odropped);
-   goto sendorfree;
-   }
-   m-m_flags = m0-m_flags  M_COPYFLAGS;
-   *mnext = m;
-   mnext = m-m_nextpkt;
-   m-m_data += max_linkhdr;
-   mhip6 = mtod(m, struct ip6_hdr *);
-   *mhip6 = *ip6;
-   m-m_len = sizeof(*mhip6);
-   error = ip6_insertfraghdr(m0, m, hlen, ip6f);
-   

Re: svn commit: r278828 - head/sys/netinet6

2015-02-15 Thread Gleb Smirnoff
On Mon, Feb 16, 2015 at 01:34:09AM +, Bjoern A. Zeeb wrote:
B 
B  On 16 Feb 2015, at 01:30 , Gleb Smirnoff gleb...@freebsd.org wrote:
B  
B  On Mon, Feb 16, 2015 at 01:25:05AM +, Bjoern A. Zeeb wrote:
B  B 
B  B  On 16 Feb 2015, at 01:12 , Gleb Smirnoff gleb...@freebsd.org wrote:
B  B  
B  B  Author: glebius
B  B  Date: Mon Feb 16 01:12:20 2015
B  B  New Revision: 278828
B  B  URL: https://svnweb.freebsd.org/changeset/base/278828
B  B  
B  B  Log:
B  B   Factor out ip6_deletefraghdr() function, to be shared between IPv6
B  B   stack and pf(4).
B  B  
B  B   Submitted by:Kristof Provost
B  B   Reviewed by: ae
B  B   Differential Revision:   D1764
B  B  
B  B  Modified:
B  B   head/sys/netinet6/frag6.c
B  B   head/sys/netinet6/ip6_output.c
B  B 
B  B Why did it have to move file?
B 
B But the new function is in ip6_output and the consumer stays in frag6 and 
will be in pf?  So the new function moved to a different file without consumer 
rather than just on top of the old function?   Keep code logically together 
seems to make more sense to me.  What am I missing?

You are right. I somehow misread it as function being in frag6.c and consumer
in ip6_output.c. Will fix.

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


svn commit: r278834 - head/sys/net

2015-02-15 Thread Gleb Smirnoff
Author: glebius
Date: Mon Feb 16 06:02:46 2015
New Revision: 278834
URL: https://svnweb.freebsd.org/changeset/base/278834

Log:
  Missed from r278831.

Modified:
  head/sys/net/pfvar.h

Modified: head/sys/net/pfvar.h
==
--- head/sys/net/pfvar.hMon Feb 16 06:00:43 2015(r278833)
+++ head/sys/net/pfvar.hMon Feb 16 06:02:46 2015(r278834)
@@ -1669,6 +1669,8 @@ intpfi_clear_flags(const char *, int)
 
 int pf_match_tag(struct mbuf *, struct pf_rule *, int *, int);
 int pf_tag_packet(struct mbuf *, struct pf_pdesc *, int);
+int pf_addr_cmp(struct pf_addr *, struct pf_addr *,
+   sa_family_t);
 voidpf_qid2qname(u_int32_t, char *);
 
 VNET_DECLARE(struct pf_kstatus, pf_status);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


Re: svn commit: r276747 - head/sys/netpfil/pf

2015-02-15 Thread Gleb Smirnoff
On Sun, Feb 15, 2015 at 11:36:17PM -0800, Craig Rodrigues wrote:
C On Sun, Feb 15, 2015 at 5:25 PM, Gleb Smirnoff gleb...@freebsd.org wrote:
C 
C  On Sun, Feb 15, 2015 at 01:33:19PM -0800, Craig Rodrigues wrote:
C  C By the way, it would be helpful if you could provide feedback in
C  C Phabricator.  When I created those Phabricator reviews, I added
C  C you as a reviewer to all of them, so you can't say that you didn't see
C  C the patches.
C  C You did not provide feedback on any of them:
C  C
C  C https://reviews.freebsd.org/D1309
C  C https://reviews.freebsd.org/D1312
C  C https://reviews.freebsd.org/D1313
C  C https://reviews.freebsd.org/D1315
C  C
C  C Please take some time to go and provide feedback in those
C  C reviews, so that a better patch can be made that makes you happy.
C 
C  Did you address all problems that arised after code was committed?
C 
C  Please do, otherwise my review would require me to cut-n-paste from
C  my own emails.
C 
C 
C Yes, please cut and paste from your e-mails, and put in the reviews.

No, I will not do this. You know right now that you have problems
in the aforementioned phab URLs, and you are asking me to look at
patches at to point them out to you. This is your task, not mine.

Please address all already known problems and update the phab revisions.

C It's easier to follow in the individual reviews because there are different
C changes
C in each review, rather than one big revert, which is what you did.

I'm already starting to repeat myself. I did a big revert, because
the first change wasn't compilable, later changes fixed compilation
failures, but introduced unacceptable bugs. That's why I was forced
to back out all chain.

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


svn commit: r278831 - head/sys/netpfil/pf

2015-02-15 Thread Gleb Smirnoff
Author: glebius
Date: Mon Feb 16 03:38:27 2015
New Revision: 278831
URL: https://svnweb.freebsd.org/changeset/base/278831

Log:
  Update the pf fragment handling code to closer match recent OpenBSD.
  That partially fixes IPv6 fragment handling. Thanks to Kristof for
  working on that.
  
  Submitted by: Kristof Provost
  Tested by:peter
  Differential Revision:D1765

Modified:
  head/sys/netpfil/pf/pf.c
  head/sys/netpfil/pf/pf_norm.c

Modified: head/sys/netpfil/pf/pf.c
==
--- head/sys/netpfil/pf/pf.cMon Feb 16 02:20:11 2015(r278830)
+++ head/sys/netpfil/pf/pf.cMon Feb 16 03:38:27 2015(r278831)
@@ -362,6 +362,45 @@ VNET_DEFINE(void *, pf_swi_cookie);
 VNET_DEFINE(uint32_t, pf_hashseed);
 #defineV_pf_hashseed   VNET(pf_hashseed)
 
+int
+pf_addr_cmp(struct pf_addr *a, struct pf_addr *b, sa_family_t af)
+{
+
+   switch (af) {
+#ifdef INET
+   case AF_INET:
+   if (a-addr32[0]  b-addr32[0])
+   return (1);
+   if (a-addr32[0]  b-addr32[0])
+   return (-1);
+   break;
+#endif /* INET */
+#ifdef INET6
+   case AF_INET6:
+   if (a-addr32[3]  b-addr32[3])
+   return (1);
+   if (a-addr32[3]  b-addr32[3])
+   return (-1);
+   if (a-addr32[2]  b-addr32[2])
+   return (1);
+   if (a-addr32[2]  b-addr32[2])
+   return (-1);
+   if (a-addr32[1]  b-addr32[1])
+   return (1);
+   if (a-addr32[1]  b-addr32[1])
+   return (-1);
+   if (a-addr32[0]  b-addr32[0])
+   return (1);
+   if (a-addr32[0]  b-addr32[0])
+   return (-1);
+   break;
+#endif /* INET6 */
+   default:
+   panic(%s: unknown address family %u, __func__, af);
+   }
+   return (0);
+}
+
 static __inline uint32_t
 pf_hashkey(struct pf_state_key *sk)
 {

Modified: head/sys/netpfil/pf/pf_norm.c
==
--- head/sys/netpfil/pf/pf_norm.c   Mon Feb 16 02:20:11 2015
(r278830)
+++ head/sys/netpfil/pf/pf_norm.c   Mon Feb 16 03:38:27 2015
(r278831)
@@ -1,5 +1,6 @@
 /*-
  * Copyright 2001 Niels Provos pro...@citi.umich.edu
+ * Copyright 2011 Alexander Bluhm bl...@openbsd.org
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -48,6 +49,7 @@ __FBSDID($FreeBSD$);
 #include netinet/in.h
 #include netinet/ip.h
 #include netinet/ip_var.h
+#include netinet6/ip6_var.h
 #include netinet/tcp.h
 #include netinet/tcp_fsm.h
 #include netinet/tcp_seq.h
@@ -57,38 +59,51 @@ __FBSDID($FreeBSD$);
 #endif /* INET6 */
 
 struct pf_frent {
-   LIST_ENTRY(pf_frent) fr_next;
-   union {
-   struct {
-   struct ip *_fr_ip;
-   struct mbuf *_fr_m;
-   } _frag;
-   struct {
-   uint16_t _fr_off;
-   uint16_t _fr_end;
-   } _cache;
-   } _u;
+   TAILQ_ENTRY(pf_frent)   fr_next;
+   struct mbuf *fe_m;
+   uint16_tfe_hdrlen;  /* ipv4 header lenght with ip options
+  ipv6, extension, fragment header */
+   uint16_tfe_extoff;  /* last extension header offset or 0 */
+   uint16_tfe_len; /* fragment length */
+   uint16_tfe_off; /* fragment offset */
+   uint16_tfe_mff; /* more fragment flag */
+};
+
+struct pf_fragment_cmp {
+   struct pf_addr  frc_src;
+   struct pf_addr  frc_dst;
+   uint32_tfrc_id;
+   sa_family_t frc_af;
+   uint8_t frc_proto;
+   uint8_t frc_direction;
 };
-#definefr_ip   _u._frag._fr_ip
-#definefr_m_u._frag._fr_m
-#definefr_off  _u._cache._fr_off
-#definefr_end  _u._cache._fr_end
 
 struct pf_fragment {
+   struct pf_fragment_cmp  fr_key;
+#define fr_src fr_key.frc_src
+#define fr_dst fr_key.frc_dst
+#define fr_id  fr_key.frc_id
+#define fr_af  fr_key.frc_af
+#define fr_proto   fr_key.frc_proto
+#define fr_direction   fr_key.frc_direction
+
RB_ENTRY(pf_fragment) fr_entry;
TAILQ_ENTRY(pf_fragment) frag_next;
-   struct in_addr  fr_src;
-   struct in_addr  fr_dst;
-   u_int8_tfr_p;   /* protocol of this fragment */
-   u_int8_tfr_flags;   /* status flags */
-#define PFFRAG_SEENLAST0x0001  /* Seen the last fragment for 
this */
-#define PFFRAG_NOBUFFER0x0002  /* Non-buffering fragment cache 
*/
-#define PFFRAG_DROP0x0004  /* Drop all fragments */
+   

svn commit: r278843 - head/sys/netpfil/pf

2015-02-15 Thread Gleb Smirnoff
Author: glebius
Date: Mon Feb 16 07:01:02 2015
New Revision: 278843
URL: https://svnweb.freebsd.org/changeset/base/278843

Log:
  In the forwarding case refragment the reassembled packets with the same
  size as they arrived in. This allows the sender to determine the optimal
  fragment size by Path MTU Discovery.
  
  Roughly based on the OpenBSD work by Alexander Bluhm.
  
  Submitted by: Kristof Provost
  Differential Revision:D1767

Modified:
  head/sys/netpfil/pf/pf.c
  head/sys/netpfil/pf/pf.h
  head/sys/netpfil/pf/pf_mtag.h
  head/sys/netpfil/pf/pf_norm.c

Modified: head/sys/netpfil/pf/pf.c
==
--- head/sys/netpfil/pf/pf.cMon Feb 16 06:30:27 2015(r278842)
+++ head/sys/netpfil/pf/pf.cMon Feb 16 07:01:02 2015(r278843)
@@ -5499,7 +5499,7 @@ pf_route6(struct mbuf **m, struct pf_rul
goto bad;
 
if (oifp != ifp) {
-   if (pf_test6(PF_OUT, ifp, m0, NULL) != PF_PASS)
+   if (pf_test6(PF_FWD, ifp, m0, NULL) != PF_PASS)
goto bad;
else if (m0 == NULL)
goto done;
@@ -6057,15 +6057,20 @@ pf_test6(int dir, struct ifnet *ifp, str
struct pfi_kif  *kif;
u_short  action, reason = 0, log = 0;
struct mbuf *m = *m0, *n = NULL;
+   struct m_tag*mtag;
struct ip6_hdr  *h = NULL;
struct pf_rule  *a = NULL, *r = V_pf_default_rule, *tr, *nr;
struct pf_state *s = NULL;
struct pf_ruleset   *ruleset = NULL;
struct pf_pdesc  pd;
int  off, terminal = 0, dirndx, rh_cnt = 0;
+   int  fwdir = dir;
 
M_ASSERTPKTHDR(m);
 
+   if (ifp != m-m_pkthdr.rcvif)
+   fwdir = PF_FWD;
+
if (!V_pf_status.running)
return (PF_PASS);
 
@@ -6427,6 +6432,11 @@ done:
if (s)
PF_STATE_UNLOCK(s);
 
+   /* If reassembled packet passed, create new fragments. */
+   if (action == PF_PASS  *m0  fwdir == PF_FWD 
+   (mtag = m_tag_find(m, PF_REASSEMBLED, NULL)) != NULL)
+   action = pf_refragment6(ifp, m0, mtag);
+
return (action);
 }
 #endif /* INET6 */

Modified: head/sys/netpfil/pf/pf.h
==
--- head/sys/netpfil/pf/pf.hMon Feb 16 06:30:27 2015(r278842)
+++ head/sys/netpfil/pf/pf.hMon Feb 16 07:01:02 2015(r278843)
@@ -43,7 +43,7 @@
 #endif
 #endif
 
-enum   { PF_INOUT, PF_IN, PF_OUT };
+enum   { PF_INOUT, PF_IN, PF_OUT, PF_FWD };
 enum   { PF_PASS, PF_DROP, PF_SCRUB, PF_NOSCRUB, PF_NAT, PF_NONAT,
  PF_BINAT, PF_NOBINAT, PF_RDR, PF_NORDR, PF_SYNPROXY_DROP, PF_DEFER };
 enum   { PF_RULESET_SCRUB, PF_RULESET_FILTER, PF_RULESET_NAT,

Modified: head/sys/netpfil/pf/pf_mtag.h
==
--- head/sys/netpfil/pf/pf_mtag.h   Mon Feb 16 06:30:27 2015
(r278842)
+++ head/sys/netpfil/pf/pf_mtag.h   Mon Feb 16 07:01:02 2015
(r278843)
@@ -39,6 +39,7 @@
 #definePF_TAG_TRANSLATE_LOCALHOST  0x04
 #definePF_PACKET_LOOPED0x08
 #definePF_FASTFWD_OURS_PRESENT 0x10
+#definePF_REASSEMBLED  0x20
 
 struct pf_mtag {
void*hdr;   /* saved hdr pos in mbuf, for ECN */

Modified: head/sys/netpfil/pf/pf_norm.c
==
--- head/sys/netpfil/pf/pf_norm.c   Mon Feb 16 06:30:27 2015
(r278842)
+++ head/sys/netpfil/pf/pf_norm.c   Mon Feb 16 07:01:02 2015
(r278843)
@@ -678,6 +678,8 @@ pf_reassemble6(struct mbuf **m0, struct 
struct pf_frent *frent;
struct pf_fragment  *frag;
struct pf_fragment_cmp   key;
+   struct m_tag*mtag;
+   struct pf_fragment_tag  *ftag;
int  off;
uint16_t total, maxlen;
uint8_t  proto;
@@ -750,6 +752,15 @@ pf_reassemble6(struct mbuf **m0, struct 
m-m_pkthdr.len = plen;
}
 
+   if ((mtag = m_tag_get(PF_REASSEMBLED, sizeof(struct pf_fragment_tag),
+   M_NOWAIT)) == NULL)
+   goto fail;
+   ftag = (struct pf_fragment_tag *)(mtag + 1);
+   ftag-ft_hdrlen = hdrlen;
+   ftag-ft_extoff = extoff;
+   ftag-ft_maxlen = maxlen;
+   m_tag_prepend(m, mtag);
+
ip6 = mtod(m, struct ip6_hdr *);
ip6-ip6_plen = htons(hdrlen - sizeof(struct ip6_hdr) + total);
if (extoff) {
@@ -1084,6 +1095,75 @@ pf_fragcache(struct mbuf **m0, struct ip
 }
 
 int
+pf_refragment6(struct ifnet *ifp, struct mbuf **m0, struct m_tag *mtag)
+{
+   struct mbuf *m = 

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

2015-01-04 Thread Gleb Smirnoff
  Hi!

On Sat, Jan 03, 2015 at 05:21:20PM +, Hans Petter Selasky wrote:
H Author: hselasky
H Date: Sat Jan  3 17:21:19 2015
H New Revision: 276626
H URL: https://svnweb.freebsd.org/changeset/base/276626
H 
H Log:
H   Rework r276532 a bit. Always avoid recursing into the console drivers
H   clients, hence they might not handle it very well. This change allows
H   debugging mutex problems with kernel console drivers when
H   debug.witness.skipspin=0 is set in the boot environment.
H   
H   MFC after: 1 week

I'd ask Andriy avg@ to review r276532 and this change. AFAIR, he attacked
this problem in 2011/2012 and it appeared much more complex than just adding
MTX_RECURSE flag.

H Modified:
H   head/sys/kern/kern_cons.c
H 
H Modified: head/sys/kern/kern_cons.c
H 
==
H --- head/sys/kern/kern_cons.cSat Jan  3 16:48:08 2015
(r276625)
H +++ head/sys/kern/kern_cons.cSat Jan  3 17:21:19 2015
(r276626)
H @@ -512,6 +512,13 @@ cnputs(char *p)
H  int unlock_reqd = 0;
H  
H  if (use_cnputs_mtx) {
H +/*
H + * NOTE: Debug prints and/or witness printouts in
H + * console driver clients can cause the cnputs_mtx
H + * mutex to recurse. Simply return if that happens.
H + */
H +if (mtx_owned(cnputs_mtx))
H +return;
H  mtx_lock_spin(cnputs_mtx);
H  unlock_reqd = 1;
H  }
H @@ -601,13 +608,7 @@ static void
H  cn_drvinit(void *unused)
H  {
H  
H -/*
H - * NOTE: Debug prints and/or witness printouts in console
H - * driver clients can cause the cnputs_mtx mutex to
H - * recurse. Make sure the MTX_RECURSE flags is set!
H - */
H -mtx_init(cnputs_mtx, cnputs_mtx, NULL, MTX_SPIN |
H -MTX_NOWITNESS | MTX_RECURSE);
H +mtx_init(cnputs_mtx, cnputs_mtx, NULL, MTX_SPIN | MTX_NOWITNESS);
H  use_cnputs_mtx = 1;
H  }
H  
H 

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


Re: svn commit: r276747 - head/sys/netpfil/pf

2015-01-07 Thread Gleb Smirnoff
On Thu, Jan 08, 2015 at 12:21:57AM +, Bjoern A. Zeeb wrote:
B 
B  On 07 Jan 2015, at 20:46 , Gleb Smirnoff gleb...@freebsd.org wrote:
B  
B  On Tue, Jan 06, 2015 at 09:03:04AM +, Craig Rodrigues wrote:
B  C Author: rodrigc
B  C Date: Tue Jan  6 09:03:03 2015
B  C New Revision: 276747
B  C URL: https://svnweb.freebsd.org/changeset/base/276747
B  C 
B  C Log:
B  C   Instead of creating a purge thread for every vnet, create
B  C   a single purge thread and clean up all vnets from this thread.
B  C   
B  C   PR: 194515
B  C   Differential Revision:  D1315
B  C   Submitted by:   Nikos Vassiliadis nv...@gmx.com
B  
B  I am not sure that this is a good idea. The core idea of VNETs
B  is that they are isolated from each other. If we serialize purging,
B  then vnets are strongly affecting each other.
B  
B  AFAIU, from the PR there is some panic fixed. What is the actual bug
B  and why couldn't it be fixed with having per-vnet thread?
B 
B You don’t 3 whatever pf purging threads on a system all running, 
possibly competing for some resources, e.g., locks?

Isn't a vnet, which is a jail, already a set of a dozen of processes? So,
if you are speaking of 3 whatever pf purging threads, then you
already mean 1 mln whatever processes.

Speaking of pf purging threads competing for resources. If someone wants
really independent pfs in vnets, then locks should be virtualized as well.

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

Re: svn commit: r276750 - in head: share/man/man9 sys/contrib/ipfilter/netinet sys/dev/an sys/dev/bge sys/dev/ce sys/dev/cm sys/dev/cp sys/dev/cs sys/dev/ctau sys/dev/ed sys/dev/ex sys/dev/fe sys/dev/

2015-01-07 Thread Gleb Smirnoff
On Wed, Jan 07, 2015 at 06:16:15PM +, Robert Watson wrote:
R On Wed, 7 Jan 2015, John-Mark Gurney wrote:
R 
R  Log:
RIn order to reduce use of M_EXT outside of the mbuf allocator and
Rsocket-buffer implementations, introduce a return value for MCLGET()
R(and m_cljget() that underlies it) to allow the caller to avoid testing
RM_EXT itself.  Update all callers to use the return value.
R 
RWith this change, very few network device drivers remain aware of
RM_EXT; the primary exceptions lie in mbuf-chain pretty printers for
Rdebugging, and in a few cases, custom mbuf and cluster allocation
Rimplementations.
R 
RNB: This is a difficult-to-test change as it touches many drivers for
Rwhich I don't have physical devices.  Instead we've gone for intensive
Rreview, but further post-commit review would definitely be appreciated
Rto spot errors where changes could not easily be made mechanically,
Rbut were largely mechanical in nature.
R 
R  Shouldn't this come w/ a FreeBSD version bump for drivers to use?
R 
R Yes, probably.  Old drivers will continue to work fine in not checking the 
R return value (for now), but drivers seeing backporting will probably want a 
R __FreeBSD_version ifdef.  I'll do a commit to bump the version number today.
R 
R (In my local tree, M_EXT is renamed _M_EXT unless MBUF_PRIVATE is defined, 
R which really is quite a significant KPI change -- I'm not yet sure if I'm 
R going to push that into FreeBSD 11 or not.)

IMO, you should do the push :)

The faster we refactor the mbuf KPI, the better. Better do the surgery in
one fast cut rather then do it in an endless serie of small but painful
cuts.

Note that I'm still hoping of pushing projects/ifnet to 11, which is
a much bigger KPI change from drivers.

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


Re: svn commit: r276747 - head/sys/netpfil/pf

2015-01-07 Thread Gleb Smirnoff
On Tue, Jan 06, 2015 at 09:03:04AM +, Craig Rodrigues wrote:
C Author: rodrigc
C Date: Tue Jan  6 09:03:03 2015
C New Revision: 276747
C URL: https://svnweb.freebsd.org/changeset/base/276747
C 
C Log:
C   Instead of creating a purge thread for every vnet, create
C   a single purge thread and clean up all vnets from this thread.
C   
C   PR: 194515
C   Differential Revision:  D1315
C   Submitted by:   Nikos Vassiliadis nv...@gmx.com

I am not sure that this is a good idea. The core idea of VNETs
is that they are isolated from each other. If we serialize purging,
then vnets are strongly affecting each other.

AFAIU, from the PR there is some panic fixed. What is the actual bug
and why couldn't it be fixed with having per-vnet thread?

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


Re: svn commit: r276751 - head/sys/netinet

2015-01-07 Thread Gleb Smirnoff
On Tue, Jan 06, 2015 at 01:07:14PM +, Luiz Otavio O Souza wrote:
L Author: loos
L Date: Tue Jan  6 13:07:13 2015
L New Revision: 276751
L URL: https://svnweb.freebsd.org/changeset/base/276751
L 
L Log:
L   Remove the check that prevent carp(4) advskew to be set to '0'.
L   
L   CARP devices are created with advskew set to '0' and once you set it to
L   any other value in the valid range (0..254) you can't set it back to zero.
L   
L   The code in question is also used to prevent that zeroed values overwrite
L   the CARP defaults when a new CARP device is created.  Since advskew already
L   defaults to '0' for newly created devices and the new value is guaranteed
L   to be within the valid range, it is safe to overwrite it here.
L   
L   PR:194672
L   Reported by:   c...@pfsense.org
L   In collaboration with: garga
L   Tested by: garga
L   MFC after: 2 weeks

Please correct me if I am wrong, but after this change any SIOCSVH will reset
the advskew to 0.

For example, please try to:

ifconfig igb0 vhid 1 advskew 100
ifconfig igb0 vhid 1 pass foobar

Now let's check the advskew:

ifconfig igb0

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


svn commit: r278979 - head/sys/netinet6

2015-02-18 Thread Gleb Smirnoff
Author: glebius
Date: Thu Feb 19 01:21:23 2015
New Revision: 278979
URL: https://svnweb.freebsd.org/changeset/base/278979

Log:
  Use new struct mbufq instead of struct ifqueue to manage packet queues in
  IPv6 multicast code.
  
  Sponsored by: Netflix
  Sponsored by: Nginx, Inc.

Modified:
  head/sys/netinet6/in6_mcast.c
  head/sys/netinet6/in6_var.h
  head/sys/netinet6/mld6.c
  head/sys/netinet6/mld6_var.h

Modified: head/sys/netinet6/in6_mcast.c
==
--- head/sys/netinet6/in6_mcast.c   Thu Feb 19 01:21:02 2015
(r278978)
+++ head/sys/netinet6/in6_mcast.c   Thu Feb 19 01:21:23 2015
(r278979)
@@ -479,7 +479,7 @@ in6_mc_get(struct ifnet *ifp, const stru
inm-in6m_ifma = ifma;
inm-in6m_refcount = 1;
inm-in6m_state = MLD_NOT_MEMBER;
-   IFQ_SET_MAXLEN(inm-in6m_scq, MLD_MAX_STATE_CHANGES);
+   mbufq_init(inm-in6m_scq, MLD_MAX_STATE_CHANGES);
 
inm-in6m_st[0].iss_fmode = MCAST_UNDEFINED;
inm-in6m_st[1].iss_fmode = MCAST_UNDEFINED;
@@ -1074,7 +1074,7 @@ in6m_purge(struct in6_multi *inm)
inm-in6m_nsrc--;
}
/* Free state-change requests that might be queued. */
-   _IF_DRAIN(inm-in6m_scq);
+   mbufq_drain(inm-in6m_scq);
 }
 
 /*
@@ -2804,7 +2804,7 @@ in6m_print(const struct in6_multi *inm)
inm-in6m_timer,
in6m_state_str(inm-in6m_state),
inm-in6m_refcount,
-   inm-in6m_scq.ifq_len);
+   mbufq_len(inm-in6m_scq));
printf(mli %p nsrc %lu sctimer %u scrv %u\n,
inm-in6m_mli,
inm-in6m_nsrc,

Modified: head/sys/netinet6/in6_var.h
==
--- head/sys/netinet6/in6_var.h Thu Feb 19 01:21:02 2015(r278978)
+++ head/sys/netinet6/in6_var.h Thu Feb 19 01:21:23 2015(r278979)
@@ -652,7 +652,7 @@ struct in6_multi {
struct ip6_msource_tree  in6m_srcs; /* tree of sources */
u_long   in6m_nsrc; /* # of tree entries */
 
-   struct ifqueue   in6m_scq;  /* queue of pending
+   struct mbufq in6m_scq;  /* queue of pending
 * state-change packets */
struct timeval   in6m_lastgsrtv;/* last G-S-R query */
uint16_t in6m_sctimer;  /* state-change timer */

Modified: head/sys/netinet6/mld6.c
==
--- head/sys/netinet6/mld6.cThu Feb 19 01:21:02 2015(r278978)
+++ head/sys/netinet6/mld6.cThu Feb 19 01:21:23 2015(r278979)
@@ -106,7 +106,7 @@ static struct mld_ifinfo *
mli_alloc_locked(struct ifnet *);
 static voidmli_delete_locked(const struct ifnet *);
 static voidmld_dispatch_packet(struct mbuf *);
-static voidmld_dispatch_queue(struct ifqueue *, int);
+static voidmld_dispatch_queue(struct mbufq *, int);
 static voidmld_final_leave(struct in6_multi *, struct mld_ifinfo *);
 static voidmld_fasttimo_vnet(void);
 static int mld_handle_state_change(struct in6_multi *,
@@ -131,17 +131,17 @@ static void   mld_v2_cancel_link_timers(st
 static voidmld_v2_dispatch_general_query(struct mld_ifinfo *);
 static struct mbuf *
mld_v2_encap_report(struct ifnet *, struct mbuf *);
-static int mld_v2_enqueue_filter_change(struct ifqueue *,
+static int mld_v2_enqueue_filter_change(struct mbufq *,
struct in6_multi *);
-static int mld_v2_enqueue_group_record(struct ifqueue *,
+static int mld_v2_enqueue_group_record(struct mbufq *,
struct in6_multi *, const int, const int, const int,
const int);
 static int mld_v2_input_query(struct ifnet *, const struct ip6_hdr *,
struct mbuf *, const int, const int);
 static int mld_v2_merge_state_changes(struct in6_multi *,
-   struct ifqueue *);
+   struct mbufq *);
 static voidmld_v2_process_group_timers(struct mld_ifinfo *,
-   struct ifqueue *, struct ifqueue *,
+   struct mbufq *, struct mbufq *,
struct in6_multi *, const int);
 static int mld_v2_process_group_query(struct in6_multi *,
struct mld_ifinfo *mli, int, struct mbuf *, const int);
@@ -406,15 +406,12 @@ out_locked:
  * VIMAGE: Assumes the vnet pointer has been set.
  */
 static void
-mld_dispatch_queue(struct ifqueue *ifq, int limit)
+mld_dispatch_queue(struct mbufq *mq, int limit)
 {
struct mbuf *m;
 
-   for (;;) {
-   _IF_DEQUEUE(ifq, m);
-   if (m == NULL)
-   break;
-   CTR3(KTR_MLD, %s: dispatch %p from %p, __func__, ifq, m);
+   while ((m = mbufq_dequeue(mq)) != NULL) {
+   

svn commit: r278978 - head/sys/netinet

2015-02-18 Thread Gleb Smirnoff
Author: glebius
Date: Thu Feb 19 01:21:02 2015
New Revision: 278978
URL: https://svnweb.freebsd.org/changeset/base/278978

Log:
  Use new struct mbufq instead of struct ifqueue to manage packet queues in
  IPv4 multicast code.
  
  Sponsored by: Netflix
  Sponsored by: Nginx, Inc.

Modified:
  head/sys/netinet/igmp.c
  head/sys/netinet/in_mcast.c
  head/sys/netinet/in_var.h

Modified: head/sys/netinet/igmp.c
==
--- head/sys/netinet/igmp.c Thu Feb 19 01:19:42 2015(r278977)
+++ head/sys/netinet/igmp.c Thu Feb 19 01:21:02 2015(r278978)
@@ -87,7 +87,7 @@ __FBSDID($FreeBSD$);
 static struct igmp_ifinfo *
igi_alloc_locked(struct ifnet *);
 static voidigi_delete_locked(const struct ifnet *);
-static voidigmp_dispatch_queue(struct ifqueue *, int, const int);
+static voidigmp_dispatch_queue(struct mbufq *, int, const int);
 static voidigmp_fasttimo_vnet(void);
 static voidigmp_final_leave(struct in_multi *, struct igmp_ifinfo *);
 static int igmp_handle_state_change(struct in_multi *,
@@ -122,15 +122,15 @@ static void   igmp_v3_cancel_link_timers(s
 static voidigmp_v3_dispatch_general_query(struct igmp_ifinfo *);
 static struct mbuf *
igmp_v3_encap_report(struct ifnet *, struct mbuf *);
-static int igmp_v3_enqueue_group_record(struct ifqueue *,
+static int igmp_v3_enqueue_group_record(struct mbufq *,
struct in_multi *, const int, const int, const int);
-static int igmp_v3_enqueue_filter_change(struct ifqueue *,
+static int igmp_v3_enqueue_filter_change(struct mbufq *,
struct in_multi *);
 static voidigmp_v3_process_group_timers(struct igmp_ifinfo *,
-   struct ifqueue *, struct ifqueue *, struct in_multi *,
+   struct mbufq *, struct mbufq *, struct in_multi *,
const int);
 static int igmp_v3_merge_state_changes(struct in_multi *,
-   struct ifqueue *);
+   struct mbufq *);
 static voidigmp_v3_suppress_group_record(struct in_multi *);
 static int sysctl_igmp_default_version(SYSCTL_HANDLER_ARGS);
 static int sysctl_igmp_gsr(SYSCTL_HANDLER_ARGS);
@@ -475,15 +475,12 @@ out_locked:
  * VIMAGE: Assumes the vnet pointer has been set.
  */
 static void
-igmp_dispatch_queue(struct ifqueue *ifq, int limit, const int loop)
+igmp_dispatch_queue(struct mbufq *mq, int limit, const int loop)
 {
struct mbuf *m;
 
-   for (;;) {
-   _IF_DEQUEUE(ifq, m);
-   if (m == NULL)
-   break;
-   CTR3(KTR_IGMPV3, %s: dispatch %p from %p, __func__, ifq, m);
+   while ((m = mbufq_dequeue(mq)) != NULL) {
+   CTR3(KTR_IGMPV3, %s: dispatch %p from %p, __func__, mq, m);
if (loop)
m-m_flags |= M_IGMP_LOOP;
netisr_dispatch(NETISR_IGMP, m);
@@ -579,13 +576,8 @@ igi_alloc_locked(/*const*/ struct ifnet 
igi-igi_qi = IGMP_QI_INIT;
igi-igi_qri = IGMP_QRI_INIT;
igi-igi_uri = IGMP_URI_INIT;
-
SLIST_INIT(igi-igi_relinmhead);
-
-   /*
-* Responses to general queries are subject to bounds.
-*/
-   IFQ_SET_MAXLEN(igi-igi_gq, IGMP_MAX_RESPONSE_PACKETS);
+   mbufq_init(igi-igi_gq, IGMP_MAX_RESPONSE_PACKETS);
 
LIST_INSERT_HEAD(V_igi_head, igi, igi_link);
 
@@ -683,7 +675,7 @@ igi_delete_locked(const struct ifnet *if
/*
 * Free deferred General Query responses.
 */
-   _IF_DRAIN(igi-igi_gq);
+   mbufq_drain(igi-igi_gq);
 
LIST_REMOVE(igi, igi_link);
 
@@ -1643,8 +1635,8 @@ igmp_fasttimo(void)
 static void
 igmp_fasttimo_vnet(void)
 {
-   struct ifqueue   scq;   /* State-change packets */
-   struct ifqueue   qrq;   /* Query response packets */
+   struct mbufq scq;   /* State-change packets */
+   struct mbufq qrq;   /* Query response packets */
struct ifnet*ifp;
struct igmp_ifinfo  *igi;
struct ifmultiaddr  *ifma;
@@ -1705,12 +1697,8 @@ igmp_fasttimo_vnet(void)
loop = (igi-igi_flags  IGIF_LOOPBACK) ? 1 : 0;
uri_fasthz = IGMP_RANDOM_DELAY(igi-igi_uri *
PR_FASTHZ);
-
-   memset(qrq, 0, sizeof(struct ifqueue));
-   IFQ_SET_MAXLEN(qrq, IGMP_MAX_G_GS_PACKETS);
-
-   memset(scq, 0, sizeof(struct ifqueue));
-   IFQ_SET_MAXLEN(scq, IGMP_MAX_STATE_CHANGE_PACKETS);
+   mbufq_init(qrq, IGMP_MAX_G_GS_PACKETS);
+   mbufq_init(scq, IGMP_MAX_STATE_CHANGE_PACKETS);
}
 
IF_ADDR_RLOCK(ifp);
@@ -1809,7 

svn commit: r278977 - in head/sys: dev/cxgb dev/cxgb/sys dev/cxgb/ulp/tom dev/xen/netfront sys

2015-02-18 Thread Gleb Smirnoff
Author: glebius
Date: Thu Feb 19 01:19:42 2015
New Revision: 278977
URL: https://svnweb.freebsd.org/changeset/base/278977

Log:
  Provide a set of inline functions to manage simple mbuf(9) queues, based
  on queue(3)'s STAILQ.  Utilize them in cxgb(4) and Xen, deleting home
  grown implementations.
  
  Sponsored by: Netflix
  Sponsored by: Nginx, Inc.

Deleted:
  head/sys/dev/cxgb/sys/mbufq.h
  head/sys/dev/xen/netfront/mbufq.h
Modified:
  head/sys/dev/cxgb/cxgb_adapter.h
  head/sys/dev/cxgb/cxgb_sge.c
  head/sys/dev/cxgb/ulp/tom/cxgb_cpl_io.c
  head/sys/dev/cxgb/ulp/tom/cxgb_toepcb.h
  head/sys/dev/xen/netfront/netfront.c
  head/sys/sys/mbuf.h

Modified: head/sys/dev/cxgb/cxgb_adapter.h
==
--- head/sys/dev/cxgb/cxgb_adapter.hWed Feb 18 23:34:03 2015
(r278976)
+++ head/sys/dev/cxgb/cxgb_adapter.hThu Feb 19 01:19:42 2015
(r278977)
@@ -59,7 +59,6 @@ $FreeBSD$
 #include dev/pci/pcivar.h
 
 #include cxgb_osdep.h
-#include sys/mbufq.h
 
 struct adapter;
 struct sge_qset;
@@ -251,7 +250,7 @@ struct sge_txq {
bus_dma_tag_t   desc_tag;
bus_dmamap_tdesc_map;
bus_dma_tag_t   entry_tag;
-   struct mbuf_head sendq;
+   struct mbufqsendq;
 
struct buf_ring *txq_mr;
struct ifaltq   *txq_ifq;

Modified: head/sys/dev/cxgb/cxgb_sge.c
==
--- head/sys/dev/cxgb/cxgb_sge.cWed Feb 18 23:34:03 2015
(r278976)
+++ head/sys/dev/cxgb/cxgb_sge.cThu Feb 19 01:19:42 2015
(r278977)
@@ -1117,9 +1117,10 @@ init_qset_cntxt(struct sge_qset *qs, u_i
qs-txq[TXQ_CTRL].cntxt_id = FW_CTRL_SGEEC_START + id;
qs-txq[TXQ_CTRL].token = FW_CTRL_TID_START + id;
 
-   mbufq_init(qs-txq[TXQ_ETH].sendq);
-   mbufq_init(qs-txq[TXQ_OFLD].sendq);
-   mbufq_init(qs-txq[TXQ_CTRL].sendq);
+   /* XXX: a sane limit is needed instead of INT_MAX */
+   mbufq_init(qs-txq[TXQ_ETH].sendq, INT_MAX);
+   mbufq_init(qs-txq[TXQ_OFLD].sendq, INT_MAX);
+   mbufq_init(qs-txq[TXQ_CTRL].sendq, INT_MAX);
 }
 
 
@@ -1820,8 +1821,8 @@ check_desc_avail(adapter_t *adap, struct
 * the control queue is only used for binding qsets which happens
 * at init time so we are guaranteed enough descriptors
 */
-   if (__predict_false(!mbufq_empty(q-sendq))) {
-addq_exit: mbufq_tail(q-sendq, m);
+   if (__predict_false(mbufq_len(q-sendq))) {
+addq_exit: (void )mbufq_enqueue(q-sendq, m);
return 1;
}
if (__predict_false(q-size - q-in_use  ndesc)) {
@@ -1936,7 +1937,7 @@ again:reclaim_completed_tx_imm(q);
}
q-in_use++;
}
-   if (!mbufq_empty(q-sendq)) {
+   if (mbufq_len(q-sendq)) {
setbit(qs-txq_stopped, TXQ_CTRL);
 
if (should_restart_tx(q) 
@@ -2319,7 +2320,7 @@ restart_offloadq(void *data, int npendin
TXQ_LOCK(qs);
 again: cleaned = reclaim_completed_tx(qs, 16, TXQ_OFLD);
 
-   while ((m = mbufq_peek(q-sendq)) != NULL) {
+   while ((m = mbufq_first(q-sendq)) != NULL) {
unsigned int gen, pidx;
struct ofld_hdr *oh = mtod(m, struct ofld_hdr *);
unsigned int ndesc = G_HDR_NDESC(oh-flags);
@@ -2485,7 +2486,7 @@ t3_sge_alloc_qset(adapter_t *sc, u_int i
printf(error %d from alloc ring tx %i\n, ret, i);
goto err;
}
-   mbufq_init(q-txq[i].sendq);
+   mbufq_init(q-txq[i].sendq, INT_MAX);
q-txq[i].gen = 1;
q-txq[i].size = p-txq_size[i];
}
@@ -3521,7 +3522,7 @@ t3_add_configured_sysctls(adapter_t *sc)
CTLFLAG_RD, qs-txq[TXQ_ETH].txq_mr-br_drops,
#tunneled packets dropped);
SYSCTL_ADD_UINT(ctx, txqpoidlist, OID_AUTO, sendqlen,
-   CTLFLAG_RD, qs-txq[TXQ_ETH].sendq.qlen,
+   CTLFLAG_RD, qs-txq[TXQ_ETH].sendq.mq_len,
0, #tunneled packets waiting to be sent);
 #if 0  
SYSCTL_ADD_UINT(ctx, txqpoidlist, OID_AUTO, 
queue_pidx,

Modified: head/sys/dev/cxgb/ulp/tom/cxgb_cpl_io.c
==
--- head/sys/dev/cxgb/ulp/tom/cxgb_cpl_io.c Wed Feb 18 23:34:03 2015
(r278976)
+++ head/sys/dev/cxgb/ulp/tom/cxgb_cpl_io.c Thu Feb 19 01:19:42 2015
(r278977)
@@ -1088,7 +1088,7 @@ send_reset(struct toepcb *toep)
req-cmd = CPL_ABORT_SEND_RST;
 
if (tp-t_state == TCPS_SYN_SENT)
-   mbufq_tail(toep-out_of_order_queue, m); /* defer */
+   (void )mbufq_enqueue(toep-out_of_order_queue, m); /* defer */
else
l2t_send(sc, m, toep-tp_l2t);
 }


svn commit: r279030 - in head/sys: net netinet netinet6

2015-02-19 Thread Gleb Smirnoff
Author: glebius
Date: Thu Feb 19 23:16:10 2015
New Revision: 279030
URL: https://svnweb.freebsd.org/changeset/base/279030

Log:
  Now that all users of _WANT_IFADDR are fixed, remove this crutch and
  hide ifaddr, in_ifaddr and in6_ifaddr under _KERNEL.
  
  Sponsored by: Netflix
  Sponsored by: Nginx, Inc.

Modified:
  head/sys/net/if_var.h
  head/sys/netinet/in_var.h
  head/sys/netinet6/in6_var.h

Modified: head/sys/net/if_var.h
==
--- head/sys/net/if_var.h   Thu Feb 19 23:14:35 2015(r279029)
+++ head/sys/net/if_var.h   Thu Feb 19 23:16:10 2015(r279030)
@@ -365,8 +365,6 @@ EVENTHANDLER_DECLARE(group_change_event,
 
 #defineTOEDEV(ifp) ((ifp)-if_llsoftc)
 
-#endif /* _KERNEL */
-
 /*
  * The ifaddr structure contains information about one address
  * of an interface.  They are maintained by the different address families,
@@ -377,7 +375,6 @@ EVENTHANDLER_DECLARE(group_change_event,
  * chunk of malloc'ed memory, where we store the three addresses
  * (ifa_addr, ifa_dstaddr and ifa_netmask) referenced here.
  */
-#if defined(_KERNEL) || defined(_WANT_IFADDR)
 struct ifaddr {
struct  sockaddr *ifa_addr; /* address of interface */
struct  sockaddr *ifa_dstaddr;  /* other end of p-to-p link */
@@ -389,6 +386,8 @@ struct ifaddr {
void(*ifa_rtrequest)/* check or clean routes (+ or -)'d */
(int, struct rtentry *, struct rt_addrinfo *);
u_short ifa_flags;  /* mostly rt_flags for cloning */
+#defineIFA_ROUTE   RTF_UP  /* route installed */
+#defineIFA_RTSELF  RTF_HOST/* loopback route to self 
installed */
u_int   ifa_refcnt; /* references to this structure */
 
counter_u64_t   ifa_ipackets;
@@ -396,11 +395,6 @@ struct ifaddr {
counter_u64_t   ifa_ibytes;
counter_u64_t   ifa_obytes;
 };
-#endif
-
-#ifdef _KERNEL
-#defineIFA_ROUTE   RTF_UP  /* route installed */
-#defineIFA_RTSELF  RTF_HOST/* loopback route to self 
installed */
 
 /* For compatibility with other BSDs. SCTP uses it. */
 #defineifa_listifa_link

Modified: head/sys/netinet/in_var.h
==
--- head/sys/netinet/in_var.h   Thu Feb 19 23:14:35 2015(r279029)
+++ head/sys/netinet/in_var.h   Thu Feb 19 23:16:10 2015(r279030)
@@ -50,7 +50,7 @@ struct in_ifinfo {
struct in_multi *ii_allhosts;   /* 224.0.0.1 membership */
 };
 
-#if defined(_KERNEL) || defined(_WANT_IFADDR)
+#ifdef _KERNEL
 /*
  * Interface address, Internet version.  One of these structures
  * is allocated for each Internet address on an interface.
@@ -71,7 +71,7 @@ struct in_ifaddr {
 #defineia_broadaddria_dstaddr
struct  sockaddr_in ia_sockmask; /* reserve space for general netmask */
 };
-#endif
+#endif /* _KERNEL */
 
 struct in_aliasreq {
charifra_name[IFNAMSIZ];/* if name, e.g. en0 */

Modified: head/sys/netinet6/in6_var.h
==
--- head/sys/netinet6/in6_var.h Thu Feb 19 23:14:35 2015(r279029)
+++ head/sys/netinet6/in6_var.h Thu Feb 19 23:16:10 2015(r279030)
@@ -110,7 +110,7 @@ struct in6_ifextra {
 
 #defineLLTABLE6(ifp)   (((struct in6_ifextra 
*)(ifp)-if_afdata[AF_INET6])-lltable)
 
-#if defined(_KERNEL) || defined(_WANT_IFADDR)
+#ifdef _KERNEL
 struct in6_ifaddr {
struct  ifaddr ia_ifa;  /* protocol-independent info */
 #defineia_ifp  ia_ifa.ifa_ifp
@@ -141,7 +141,7 @@ struct  in6_ifaddr {
 /* List of in6_ifaddr's. */
 TAILQ_HEAD(in6_ifaddrhead, in6_ifaddr);
 LIST_HEAD(in6_ifaddrlisthead, in6_ifaddr);
-#endif
+#endif /* _KERNEL */
 
 /* control structure to manage address selection policy */
 struct in6_addrpolicy {
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r279029 - head/contrib/ipfilter

2015-02-19 Thread Gleb Smirnoff
Author: glebius
Date: Thu Feb 19 23:14:35 2015
New Revision: 279029
URL: https://svnweb.freebsd.org/changeset/base/279029

Log:
  The ipftest(1) is a program that emulates ipf(4) operation and tests packets
  against rules.  It definitely doesn't need to know about kernel internals,
  such as 'struct ifaddr'.  What it does with ifaddr, is that it only takes
  ifa_addr member of it, and treats it as sockaddr, while it is only a pointer
  to sockaddr.  Fortunately, sizeof(struct ifaddr)  sizeof(struct 
sockaddr_in6),
  so no problems arise.
  
  Fix that declaring a private struct ifaddr in ipftest(1) and stop including
  if_var.h.
  
  Sponsored by: Netflix
  Sponsored by: Nginx, Inc.

Modified:
  head/contrib/ipfilter/ip_fil.c
  head/contrib/ipfilter/ipf.h

Modified: head/contrib/ipfilter/ip_fil.c
==
--- head/contrib/ipfilter/ip_fil.c  Thu Feb 19 22:42:33 2015
(r279028)
+++ head/contrib/ipfilter/ip_fil.c  Thu Feb 19 23:14:35 2015
(r279029)
@@ -44,6 +44,9 @@ static intwrite_output __P((struct ifne
 # endif
 #endif
 
+struct ifaddr {
+   struct sockaddr_storage ifa_addr;
+};
 
 int
 ipfattach(softc)

Modified: head/contrib/ipfilter/ipf.h
==
--- head/contrib/ipfilter/ipf.h Thu Feb 19 22:42:33 2015(r279028)
+++ head/contrib/ipfilter/ipf.h Thu Feb 19 23:14:35 2015(r279029)
@@ -43,9 +43,6 @@ struct file;
 #include sys/socket.h
 #include net/if.h
 
-#define_WANT_IFADDR
-#include net/if_var.h
-
 #include netinet/in.h
 #include netinet/in_systm.h
 #include netinet/ip.h
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r279031 - head/sys/netinet

2015-02-19 Thread Gleb Smirnoff
Author: glebius
Date: Thu Feb 19 23:59:27 2015
New Revision: 279031
URL: https://svnweb.freebsd.org/changeset/base/279031

Log:
  The last userland piece of in_var.h is now 'struct in_aliasreq'.  Move
  it to the top of the file, and ifdef _KERNEL the rest.

Modified:
  head/sys/netinet/in_var.h

Modified: head/sys/netinet/in_var.h
==
--- head/sys/netinet/in_var.h   Thu Feb 19 23:16:10 2015(r279030)
+++ head/sys/netinet/in_var.h   Thu Feb 19 23:59:27 2015(r279031)
@@ -33,6 +33,19 @@
 #ifndef _NETINET_IN_VAR_H_
 #define _NETINET_IN_VAR_H_
 
+/*
+ * Argument structure for SIOCAIFADDR.
+ */
+struct in_aliasreq {
+   charifra_name[IFNAMSIZ];/* if name, e.g. en0 */
+   struct  sockaddr_in ifra_addr;
+   struct  sockaddr_in ifra_broadaddr;
+#define ifra_dstaddr ifra_broadaddr
+   struct  sockaddr_in ifra_mask;
+   int ifra_vhid;
+};
+
+#ifdef _KERNEL
 #include sys/queue.h
 #include sys/fnv_hash.h
 #include sys/tree.h
@@ -50,7 +63,6 @@ struct in_ifinfo {
struct in_multi *ii_allhosts;   /* 224.0.0.1 membership */
 };
 
-#ifdef _KERNEL
 /*
  * Interface address, Internet version.  One of these structures
  * is allocated for each Internet address on an interface.
@@ -71,16 +83,7 @@ struct in_ifaddr {
 #defineia_broadaddria_dstaddr
struct  sockaddr_in ia_sockmask; /* reserve space for general netmask */
 };
-#endif /* _KERNEL */
 
-struct in_aliasreq {
-   charifra_name[IFNAMSIZ];/* if name, e.g. en0 */
-   struct  sockaddr_in ifra_addr;
-   struct  sockaddr_in ifra_broadaddr;
-#define ifra_dstaddr ifra_broadaddr
-   struct  sockaddr_in ifra_mask;
-   int ifra_vhid;
-};
 /*
  * Given a pointer to an in_ifaddr (ifaddr),
  * return a pointer to the addr as a sockaddr_in.
@@ -92,8 +95,6 @@ structin_aliasreq {
 #define IN_LNAOF(in, ifa) \
((ntohl((in).s_addr)  ~((struct in_ifaddr *)(ifa)-ia_subnetmask))
 
-
-#ifdef _KERNEL
 extern u_char  inetctlerrmap[];
 
 #define LLTABLE(ifp)   \
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


Re: svn commit: r280197 - in head/sys: dev/ixgbe modules

2015-03-17 Thread Gleb Smirnoff
  Jack,

On Tue, Mar 17, 2015 at 10:40:51PM +, Jack F Vogel wrote:
J Author: jfv
J Date: Tue Mar 17 22:40:50 2015
J New Revision: 280197
J URL: https://svnweb.freebsd.org/changeset/base/280197
J 
J Log:
J   Resolve a few build issues, add module directories back into Makefile,
J   then correct a NETMAP problem resulting from the split, and finally
J   temporarily disable the X550 functionality.
...
J Modified: head/sys/modules/Makefile
J 
==
J --- head/sys/modules/MakefileTue Mar 17 22:00:11 2015
(r280196)
J +++ head/sys/modules/MakefileTue Mar 17 22:40:50 2015
(r280197)
J @@ -175,6 +175,8 @@ SUBDIR=  \
J  ${_iwn} \
J  ${_iwnfw} \
J  ${_ixgb} \
J +${_ix} \
J +${_ixv} \
J  ${_ixl} \
J  ${_ixlv} \
J  jme \
J 

This doesn't enable build of modules, since you added empty variables. You also
need to initialize these variables at line 586, assuming the drivers build on
amd64 and i386. In case if they work on amd64 only, then at line 623.

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


Re: svn commit: r280202 - head/sys/netinet

2015-03-17 Thread Gleb Smirnoff
  Adrian,

On Wed, Mar 18, 2015 at 04:40:37AM +, Adrian Chadd wrote:
A Author: adrian
A Date: Wed Mar 18 04:40:36 2015
A New Revision: 280202
A URL: https://svnweb.freebsd.org/changeset/base/280202
A 
A Log:
A   Correctly const-ify things.

Why do you prefer caddr_t over 'char *'?

A   Found by: clang 3.6
A 
A Modified:
A   head/sys/netinet/in_rss.c
A 
A Modified: head/sys/netinet/in_rss.c
A 
==
A --- head/sys/netinet/in_rss.cWed Mar 18 02:29:51 2015
(r280201)
A +++ head/sys/netinet/in_rss.cWed Mar 18 04:40:36 2015
(r280202)
A @@ -283,7 +283,7 @@ rss_mbuf_software_hash_v4(const struct m
A  printf(%s: short TCP frame?\n, __func__);
A  return (-1);
A  }
A -th = (struct tcphdr *)((caddr_t)ip + iphlen);
A +th = (const struct tcphdr *)((c_caddr_t)ip + iphlen);
A  return rss_proto_software_hash_v4(ip-ip_src, ip-ip_dst,
A  th-th_sport,
A  th-th_dport,
A @@ -293,7 +293,7 @@ rss_mbuf_software_hash_v4(const struct m
A  } else if ((rss_gethashconfig()  RSS_HASHTYPE_RSS_UDP_IPV4) 
A  (proto == IPPROTO_UDP) 
A  (is_frag == 0)) {
A -uh = (struct udphdr *)((caddr_t)ip + iphlen);
A +uh = (const struct udphdr *)((c_caddr_t)ip + iphlen);
A  if (m-m_len  iphlen + sizeof(struct udphdr)) {
A  printf(%s: short UDP frame?\n, __func__);
A  return (-1);
A 

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


svn commit: r280136 - head/sys/vm

2015-03-16 Thread Gleb Smirnoff
Author: glebius
Date: Mon Mar 16 14:24:47 2015
New Revision: 280136
URL: https://svnweb.freebsd.org/changeset/base/280136

Log:
  Provide a comment explaining r279688.
  
  Suggested by: alc

Modified:
  head/sys/vm/vnode_pager.c

Modified: head/sys/vm/vnode_pager.c
==
--- head/sys/vm/vnode_pager.c   Mon Mar 16 14:12:41 2015(r280135)
+++ head/sys/vm/vnode_pager.c   Mon Mar 16 14:24:47 2015(r280136)
@@ -772,6 +772,14 @@ vnode_pager_generic_getpages(struct vnod
bsize = vp-v_mount-mnt_stat.f_iosize;
foff = IDX_TO_OFF(m[reqpage]-pindex);
 
+   /*
+* Synchronous and asynchronous paging operations use different
+* free pbuf counters.  This is done to avoid asynchronous requests
+* to consume all pbufs.
+* Allocate the pbuf at the very beginning of the function, so that
+* if we are low on certain kind of pbufs don't even proceed to BMAP,
+* but sleep.
+*/
freecnt = iodone != NULL ?
vnode_async_pbuf_freecnt : vnode_pbuf_freecnt;
bp = getpbuf(freecnt);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


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

2015-03-16 Thread Gleb Smirnoff
On Wed, Mar 11, 2015 at 02:36:07PM -0700, hiren panchasara wrote:
h On 02/13/15 at 11:19P, Simon J. Gerraty wrote:
h  Author: sjg
h  Date: Fri Feb 13 23:19:35 2015
h  New Revision: 278729
h  URL: https://svnweb.freebsd.org/changeset/base/278729
h  
h  Log:
hsbspace: size of bleft, mleft must match sockbuf fields to avoid
hoverflow on amd64
h
hSubmitted by:anshu...@juniper.net
hObtained from:   Juniper Networks
h 
h Talking to sjg on -arch to MFC this. If he cannot get around doing that,
h I'll do it tomorrow. 
h 
h Letting people know here to see if there are any objections.

Would that fix the bug we've been discussing?

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


Re: svn commit: r280182 - in head/sys: amd64/conf conf dev/ixgbe modules/ix modules/ixgbe modules/ixv

2015-03-17 Thread Gleb Smirnoff
On Tue, Mar 17, 2015 at 06:32:29PM +, Jack F Vogel wrote:
J Author: jfv
J Date: Tue Mar 17 18:32:28 2015
J New Revision: 280182
J URL: https://svnweb.freebsd.org/changeset/base/280182
J 
J Log:
J   Update to the Intel ixgbe driver:
J  - Split the driver into independent pf and vf loadables. This is
Jin preparation for SRIOV support which will be following shortly.
JThis also allows us to keep a seperate revision control over the
Jtwo parts, making for easier sustaining.
J  - Make the TX/RX code a shared/seperated file, in the old code base
Jthe ixv code would miss fixes that went into ixgbe, this model
Jwill eliminate that problem.
J  - The driver loadables will now match the device names, something that
Jhas been requested for some time.
J  - Rather than a modules/ixgbe there is now modules/ix and modules/ixv
J  - It will also be possible to make your static kernel with only one
Jor the other for streamlined installs, or both.
J   
J   Enjoy!

Build is broken:

cd: /usr/src/head/sys/modules/ixgbe: No such file or directory

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


svn commit: r280185 - head/sys/modules

2015-03-17 Thread Gleb Smirnoff
Author: glebius
Date: Tue Mar 17 19:07:43 2015
New Revision: 280185
URL: https://svnweb.freebsd.org/changeset/base/280185

Log:
  Fix build after r280182.

Modified:
  head/sys/modules/Makefile

Modified: head/sys/modules/Makefile
==
--- head/sys/modules/Makefile   Tue Mar 17 18:59:47 2015(r280184)
+++ head/sys/modules/Makefile   Tue Mar 17 19:07:43 2015(r280185)
@@ -175,7 +175,6 @@ SUBDIR= \
${_iwn} \
${_iwnfw} \
${_ixgb} \
-   ${_ixgbe} \
${_ixl} \
${_ixlv} \
jme \
@@ -583,7 +582,6 @@ _iwn=   iwn
 _iwnfw=iwnfw
 .endif
 _ixgb= ixgb
-_ixgbe=ixgbe
 .if ${MK_OFED} != no || defined(ALL_MODULES)
 _mlx4= mlx4
 _mlx4ib=   mlx4ib
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r280189 - in head/sys: fs/nfsclient vm

2015-03-17 Thread Gleb Smirnoff
Author: glebius
Date: Tue Mar 17 19:19:19 2015
New Revision: 280189
URL: https://svnweb.freebsd.org/changeset/base/280189

Log:
  o Enhance vm_pager_free_nonreq() function:
- Allow to call the function with vm object lock held.
- Allow to specify reqpage that doesn't match any page in the region,
  meaning freeing all pages.
  o Utilize the new function in couple more places in vnode pager.
  
  Reviewed by:  alc, kib
  Sponsored by: Netflix
  Sponsored by: Nginx, Inc.

Modified:
  head/sys/fs/nfsclient/nfs_clbio.c
  head/sys/vm/vm_pager.c
  head/sys/vm/vm_pager.h
  head/sys/vm/vnode_pager.c

Modified: head/sys/fs/nfsclient/nfs_clbio.c
==
--- head/sys/fs/nfsclient/nfs_clbio.c   Tue Mar 17 19:16:51 2015
(r280188)
+++ head/sys/fs/nfsclient/nfs_clbio.c   Tue Mar 17 19:19:19 2015
(r280189)
@@ -140,7 +140,8 @@ ncl_getpages(struct vop_getpages_args *a
 * can only occur at the file EOF.
 */
if (pages[ap-a_reqpage]-valid != 0) {
-   vm_pager_free_nonreq(object, pages, ap-a_reqpage, npages);
+   vm_pager_free_nonreq(object, pages, ap-a_reqpage, npages,
+   FALSE);
return (VM_PAGER_OK);
}
 
@@ -172,7 +173,8 @@ ncl_getpages(struct vop_getpages_args *a
 
if (error  (uio.uio_resid == count)) {
ncl_printf(nfs_getpages: error %d\n, error);
-   vm_pager_free_nonreq(object, pages, ap-a_reqpage, npages);
+   vm_pager_free_nonreq(object, pages, ap-a_reqpage, npages,
+   FALSE);
return (VM_PAGER_ERROR);
}
 

Modified: head/sys/vm/vm_pager.c
==
--- head/sys/vm/vm_pager.c  Tue Mar 17 19:16:51 2015(r280188)
+++ head/sys/vm/vm_pager.c  Tue Mar 17 19:19:19 2015(r280189)
@@ -283,29 +283,35 @@ vm_pager_object_lookup(struct pagerlst *
 }
 
 /*
- * Free the non-requested pages from the given array.
+ * Free the non-requested pages from the given array.  To remove all pages,
+ * caller should provide out of range reqpage number.
  */
 void
 vm_pager_free_nonreq(vm_object_t object, vm_page_t ma[], int reqpage,
-int npages)
+int npages, boolean_t object_locked)
 {
+   enum { UNLOCKED, CALLER_LOCKED, INTERNALLY_LOCKED } locked;
int i;
-   boolean_t object_locked;
 
-   VM_OBJECT_ASSERT_UNLOCKED(object);
-   object_locked = FALSE;
+   if (object_locked) {
+   VM_OBJECT_ASSERT_WLOCKED(object);
+   locked = CALLER_LOCKED;
+   } else {
+   VM_OBJECT_ASSERT_UNLOCKED(object);
+   locked = UNLOCKED;
+   }
for (i = 0; i  npages; ++i) {
if (i != reqpage) {
-   if (!object_locked) {
+   if (locked == UNLOCKED) {
VM_OBJECT_WLOCK(object);
-   object_locked = TRUE;
+   locked = INTERNALLY_LOCKED;
}
vm_page_lock(ma[i]);
vm_page_free(ma[i]);
vm_page_unlock(ma[i]);
}
}
-   if (object_locked)
+   if (locked == INTERNALLY_LOCKED)
VM_OBJECT_WUNLOCK(object);
 }
 

Modified: head/sys/vm/vm_pager.h
==
--- head/sys/vm/vm_pager.h  Tue Mar 17 19:16:51 2015(r280188)
+++ head/sys/vm/vm_pager.h  Tue Mar 17 19:19:19 2015(r280189)
@@ -113,7 +113,7 @@ static __inline boolean_t vm_pager_has_p
 void vm_pager_init(void);
 vm_object_t vm_pager_object_lookup(struct pagerlst *, void *);
 void vm_pager_free_nonreq(vm_object_t object, vm_page_t ma[], int reqpage,
-int npages);
+int npages, boolean_t object_locked);
 
 /*
  * vm_page_get_pages:

Modified: head/sys/vm/vnode_pager.c
==
--- head/sys/vm/vnode_pager.c   Tue Mar 17 19:16:51 2015(r280188)
+++ head/sys/vm/vnode_pager.c   Tue Mar 17 19:19:19 2015(r280189)
@@ -732,7 +732,7 @@ vnode_pager_local_getpages0(struct vnode
 */
if (mreq-valid != 0) {
vm_pager_free_nonreq(mreq-object, m, reqpage,
-   round_page(bytecount) / PAGE_SIZE);
+   round_page(bytecount) / PAGE_SIZE, FALSE);
if (iodone != NULL)
iodone(arg, m, reqpage, 0);
return (VM_PAGER_OK);
@@ -806,7 +806,7 @@ vnode_pager_generic_getpages(struct vnod
return (error);
} else if (error != 0) {
relpbuf(bp, freecnt);
-   vm_pager_free_nonreq(object, m, reqpage, count);
+   vm_pager_free_nonreq(object, m, reqpage, count, FALSE);
 

svn commit: r280187 - head/sys/dev/drm2

2015-03-17 Thread Gleb Smirnoff
Author: glebius
Date: Tue Mar 17 19:13:11 2015
New Revision: 280187
URL: https://svnweb.freebsd.org/changeset/base/280187

Log:
  Fix build.
  
  Reviewed by:  dumbbell

Modified:
  head/sys/dev/drm2/drm_edid.c

Modified: head/sys/dev/drm2/drm_edid.c
==
--- head/sys/dev/drm2/drm_edid.cTue Mar 17 19:10:51 2015
(r280186)
+++ head/sys/dev/drm2/drm_edid.cTue Mar 17 19:13:11 2015
(r280187)
@@ -1536,11 +1536,11 @@ EXPORT_SYMBOL(drm_find_cea_extension);
  */
 u8 drm_match_cea_mode(struct drm_display_mode *to_match)
 {
-   struct drm_display_mode *cea_mode;
+   const struct drm_display_mode *cea_mode;
u8 mode;
 
for (mode = 0; mode  drm_num_cea_modes; mode++) {
-   cea_mode = (struct drm_display_mode *)edid_cea_modes[mode];
+   cea_mode = (const struct drm_display_mode 
*)edid_cea_modes[mode];
 
if (drm_mode_equal(to_match, cea_mode))
return mode + 1;
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r280169 - in head/sys: net netpfil/pf

2015-03-17 Thread Gleb Smirnoff
Author: glebius
Date: Tue Mar 17 12:19:28 2015
New Revision: 280169
URL: https://svnweb.freebsd.org/changeset/base/280169

Log:
  Always lock the hash row of a source node when updating its 'states' counter.
  
  PR:   182401
  Sponsored by: Nginx, Inc.

Modified:
  head/sys/net/pfvar.h
  head/sys/netpfil/pf/pf.c
  head/sys/netpfil/pf/pf_ioctl.c

Modified: head/sys/net/pfvar.h
==
--- head/sys/net/pfvar.hTue Mar 17 11:07:59 2015(r280168)
+++ head/sys/net/pfvar.hTue Mar 17 12:19:28 2015(r280169)
@@ -1550,7 +1550,6 @@ extern struct pf_state*pf_find_state_a
 extern struct pf_src_node  *pf_find_src_node(struct pf_addr *,
struct pf_rule *, sa_family_t, int);
 extern void pf_unlink_src_node(struct pf_src_node *);
-extern void pf_unlink_src_node_locked(struct pf_src_node 
*);
 extern u_intpf_free_src_nodes(struct pf_src_node_list *);
 extern void pf_print_state(struct pf_state *);
 extern void pf_print_flags(u_int8_t);

Modified: head/sys/netpfil/pf/pf.c
==
--- head/sys/netpfil/pf/pf.cTue Mar 17 11:07:59 2015(r280168)
+++ head/sys/netpfil/pf/pf.cTue Mar 17 12:19:28 2015(r280169)
@@ -649,7 +649,10 @@ pf_find_src_node(struct pf_addr *src, st
((af == AF_INET  n-addr.v4.s_addr == src-v4.s_addr) ||
(af == AF_INET6  bcmp(n-addr, src, sizeof(*src)) == 0)))
break;
-   if (n != NULL || returnlocked == 0)
+   if (n != NULL) {
+   n-states++;
+   PF_HASHROW_UNLOCK(sh);
+   } else if (returnlocked == 0)
PF_HASHROW_UNLOCK(sh);
 
return (n);
@@ -693,6 +696,7 @@ pf_insert_src_node(struct pf_src_node **
LIST_INSERT_HEAD(sh-nodes, *sn, entry);
(*sn)-creation = time_uptime;
(*sn)-ruletype = rule-action;
+   (*sn)-states = 1;
if ((*sn)-rule.ptr != NULL)
counter_u64_add((*sn)-rule.ptr-src_nodes, 1);
PF_HASHROW_UNLOCK(sh);
@@ -709,37 +713,13 @@ pf_insert_src_node(struct pf_src_node **
 }
 
 void
-pf_unlink_src_node_locked(struct pf_src_node *src)
+pf_unlink_src_node(struct pf_src_node *src)
 {
-#ifdef INVARIANTS
-   struct pf_srchash *sh;
 
-   sh = V_pf_srchash[pf_hashsrc(src-addr, src-af)];
-   PF_HASHROW_ASSERT(sh);
-#endif
+   PF_HASHROW_ASSERT(V_pf_srchash[pf_hashsrc(src-addr, src-af)]);
LIST_REMOVE(src, entry);
if (src-rule.ptr)
counter_u64_add(src-rule.ptr-src_nodes, -1);
-   counter_u64_add(V_pf_status.scounters[SCNT_SRC_NODE_REMOVALS], 1);
-}
-
-void
-pf_unlink_src_node(struct pf_src_node *src)
-{
-   struct pf_srchash *sh;
-
-   sh = V_pf_srchash[pf_hashsrc(src-addr, src-af)];
-   PF_HASHROW_LOCK(sh);
-   pf_unlink_src_node_locked(src);
-   PF_HASHROW_UNLOCK(sh);
-}
-
-static void
-pf_free_src_node(struct pf_src_node *sn)
-{
-
-   KASSERT(sn-states == 0, (%s: %p has refs, __func__, sn));
-   uma_zfree(V_pf_sources_z, sn);
 }
 
 u_int
@@ -749,10 +729,12 @@ pf_free_src_nodes(struct pf_src_node_lis
u_int count = 0;
 
LIST_FOREACH_SAFE(sn, head, entry, tmp) {
-   pf_free_src_node(sn);
+   uma_zfree(V_pf_sources_z, sn);
count++;
}
 
+   counter_u64_add(V_pf_status.scounters[SCNT_SRC_NODE_REMOVALS], count);
+
return (count);
 }
 
@@ -1542,7 +1524,7 @@ pf_purge_expired_src_nodes()
PF_HASHROW_LOCK(sh);
LIST_FOREACH_SAFE(cur, sh-nodes, entry, next)
if (cur-states == 0  cur-expire = time_uptime) {
-   pf_unlink_src_node_locked(cur);
+   pf_unlink_src_node(cur);
LIST_INSERT_HEAD(freelist, cur, entry);
} else if (cur-rule.ptr != NULL)
cur-rule.ptr-rule_flag |= PFRULE_REFS;
@@ -1557,27 +1539,31 @@ pf_purge_expired_src_nodes()
 static void
 pf_src_tree_remove_state(struct pf_state *s)
 {
-   u_int32_t timeout;
+   struct pf_src_node *sn;
+   struct pf_srchash *sh;
+   uint32_t timeout;
+
+   timeout = s-rule.ptr-timeout[PFTM_SRC_NODE] ?
+   s-rule.ptr-timeout[PFTM_SRC_NODE] :
+   V_pf_default_rule.timeout[PFTM_SRC_NODE];
 
if (s-src_node != NULL) {
+   sn = s-src_node;
+   sh = V_pf_srchash[pf_hashsrc(sn-addr, sn-af)];
+   PF_HASHROW_LOCK(sh);
if (s-src.tcp_est)
-   --s-src_node-conn;
-   if (--s-src_node-states == 0) {
-   timeout = s-rule.ptr-timeout[PFTM_SRC_NODE];
-   if 

svn commit: r280280 - head/sys/net

2015-03-20 Thread Gleb Smirnoff
Author: glebius
Date: Fri Mar 20 14:05:17 2015
New Revision: 280280
URL: https://svnweb.freebsd.org/changeset/base/280280

Log:
  Now, when r272244 introduced counter(9) based counters for all interfaces,
  revert the r271538, which did that for vlan(4) only.
  
  No objections:melifaro
  Sponsored by: Nginx, Inc.

Modified:
  head/sys/net/if_vlan.c

Modified: head/sys/net/if_vlan.c
==
--- head/sys/net/if_vlan.c  Fri Mar 20 10:27:06 2015(r280279)
+++ head/sys/net/if_vlan.c  Fri Mar 20 14:05:17 2015(r280280)
@@ -104,12 +104,6 @@ struct vlan_mc_entry {
 struct ifvlan {
struct  ifvlantrunk *ifv_trunk;
struct  ifnet *ifv_ifp;
-   counter_u64_t   ifv_ipackets;
-   counter_u64_t   ifv_ibytes;
-   counter_u64_t   ifv_opackets;
-   counter_u64_t   ifv_obytes;
-   counter_u64_t   ifv_omcasts;
-   counter_u64_t   ifv_oerrors;
 #defineTRUNK(ifv)  ((ifv)-ifv_trunk)
 #definePARENT(ifv) ((ifv)-ifv_trunk-parent)
void*ifv_cookie;
@@ -202,7 +196,6 @@ static  void vlan_init(void *foo);
 static void vlan_input(struct ifnet *ifp, struct mbuf *m);
 static int vlan_ioctl(struct ifnet *ifp, u_long cmd, caddr_t addr);
 static void vlan_qflush(struct ifnet *ifp);
-static uint64_t vlan_get_counter(struct ifnet *ifp, ift_counter cnt);
 static int vlan_setflag(struct ifnet *ifp, int flag, int status,
 int (*func)(struct ifnet *, int));
 static int vlan_setflags(struct ifnet *ifp, int status);
@@ -955,14 +948,6 @@ vlan_clone_create(struct if_clone *ifc, 
return (ENOSPC);
}
SLIST_INIT(ifv-vlan_mc_listhead);
-   /* Prepare pcpu counters */
-   ifv-ifv_ipackets = counter_u64_alloc(M_WAITOK);
-   ifv-ifv_opackets = counter_u64_alloc(M_WAITOK);
-   ifv-ifv_ibytes = counter_u64_alloc(M_WAITOK);
-   ifv-ifv_obytes = counter_u64_alloc(M_WAITOK);
-   ifv-ifv_omcasts = counter_u64_alloc(M_WAITOK);
-   ifv-ifv_oerrors = counter_u64_alloc(M_WAITOK);
-
ifp-if_softc = ifv;
/*
 * Set the name manually rather than using if_initname because
@@ -981,7 +966,6 @@ vlan_clone_create(struct if_clone *ifc, 
ifp-if_qflush = vlan_qflush;
ifp-if_ioctl = vlan_ioctl;
ifp-if_flags = VLAN_IFFLAGS;
-   ifp-if_get_counter = vlan_get_counter;
ether_ifattach(ifp, eaddr);
/* Now undo some of the damage... */
ifp-if_baudrate = 0;
@@ -1024,12 +1008,6 @@ vlan_clone_destroy(struct if_clone *ifc,
ether_ifdetach(ifp);/* first, remove it from system-wide lists */
vlan_unconfig(ifp); /* now it can be unconfigured and freed */
if_free(ifp);
-   counter_u64_free(ifv-ifv_ipackets);
-   counter_u64_free(ifv-ifv_opackets);
-   counter_u64_free(ifv-ifv_ibytes);
-   counter_u64_free(ifv-ifv_obytes);
-   counter_u64_free(ifv-ifv_omcasts);
-   counter_u64_free(ifv-ifv_oerrors);
free(ifv, M_VLAN);
ifc_free_unit(ifc, unit);
 
@@ -1067,7 +1045,7 @@ vlan_transmit(struct ifnet *ifp, struct 
 */
if (!UP_AND_RUNNING(p)) {
m_freem(m);
-   counter_u64_add(ifv-ifv_oerrors, 1);
+   if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
return (ENETDOWN);
}
 
@@ -1094,7 +1072,7 @@ vlan_transmit(struct ifnet *ifp, struct 
 
if (n  0) {
if_printf(ifp, cannot pad short frame\n);
-   counter_u64_add(ifv-ifv_oerrors, 1);
+   if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
m_freem(m);
return (0);
}
@@ -1114,7 +1092,7 @@ vlan_transmit(struct ifnet *ifp, struct 
m = ether_vlanencap(m, ifv-ifv_vid);
if (m == NULL) {
if_printf(ifp, unable to prepend VLAN header\n);
-   counter_u64_add(ifv-ifv_oerrors, 1);
+   if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
return (0);
}
}
@@ -1124,40 +1102,14 @@ vlan_transmit(struct ifnet *ifp, struct 
 */
error = (p-if_transmit)(p, m);
if (error == 0) {
-   counter_u64_add(ifv-ifv_opackets, 1);
-   counter_u64_add(ifv-ifv_obytes, len);
-   counter_u64_add(ifv-ifv_omcasts, mcast);
+   if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1);
+   if_inc_counter(ifp, IFCOUNTER_OBYTES, len);
+   if_inc_counter(ifp, IFCOUNTER_OMCASTS, mcast);
} else
-   counter_u64_add(ifv-ifv_oerrors, 1);
+   if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
return (error);
 }
 
-static uint64_t
-vlan_get_counter(struct ifnet *ifp, ift_counter cnt)
-{
-   struct ifvlan *ifv;
-
-   ifv = ifp-if_softc;
-
-   switch (cnt) {
-   

svn commit: r280303 - head/sys/net

2015-03-20 Thread Gleb Smirnoff
Author: glebius
Date: Fri Mar 20 21:09:03 2015
New Revision: 280303
URL: https://svnweb.freebsd.org/changeset/base/280303

Log:
  Make vlan_config() the signle point of validity checks.
  
  Sponsored by: Nginx, Inc.

Modified:
  head/sys/net/if_vlan.c

Modified: head/sys/net/if_vlan.c
==
--- head/sys/net/if_vlan.c  Fri Mar 20 20:42:58 2015(r280302)
+++ head/sys/net/if_vlan.c  Fri Mar 20 21:09:03 2015(r280303)
@@ -817,14 +817,6 @@ vlan_clone_match_ethervid(const char *na
*cp = '\0';
if ((ifp = ifunit(ifname)) == NULL)
return (NULL);
-   /*
-* We can handle non-ethernet hardware types as long as
-* they handle the tagging and headers themselves.
-*/
-   if (ifp-if_type != IFT_ETHER 
-   (ifp-if_capenable  IFCAP_VLAN_HWTAGGING) == 0)
-   return (NULL);
-
/* Parse VID. */
if (*++cp == '\0')
return (NULL);
@@ -892,13 +884,7 @@ vlan_clone_create(struct if_clone *ifc, 
return error;
p = ifunit(vlr.vlr_parent);
if (p == NULL)
-   return ENXIO;
-   /*
-* Don't let the caller set up a VLAN VID with
-* anything except VLID bits.
-*/
-   if (vlr.vlr_tag  ~EVL_VLID_MASK)
-   return (EINVAL);
+   return (ENXIO);
error = ifc_name2unit(name, unit);
if (error != 0)
return (error);
@@ -910,13 +896,6 @@ vlan_clone_create(struct if_clone *ifc, 
ethertag = 1;
unit = -1;
wildcard = 0;
-
-   /*
-* Don't let the caller set up a VLAN VID with
-* anything except VLID bits.
-*/
-   if (vid  ~EVL_VLID_MASK)
-   return (EINVAL);
} else {
ethertag = 0;
 
@@ -1198,14 +1177,22 @@ vlan_config(struct ifvlan *ifv, struct i
struct ifnet *ifp;
int error = 0;
 
-   /* VID numbers 0x0 and 0xFFF are reserved */
-   if (vid == 0 || vid == 0xFFF)
-   return (EINVAL);
+   /*
+* We can handle non-ethernet hardware types as long as
+* they handle the tagging and headers themselves.
+*/
if (p-if_type != IFT_ETHER 
(p-if_capenable  IFCAP_VLAN_HWTAGGING) == 0)
return (EPROTONOSUPPORT);
if ((p-if_flags  VLAN_IFFLAGS) != VLAN_IFFLAGS)
return (EPROTONOSUPPORT);
+   /*
+* Don't let the caller set up a VLAN VID with
+* anything except VLID bits.
+* VID numbers 0x0 and 0xFFF are reserved.
+*/
+   if (vid == 0 || vid == 0xFFF || (vid  ~EVL_VLID_MASK))
+   return (EINVAL);
if (ifv-ifv_trunk)
return (EBUSY);
 
@@ -1670,14 +1657,6 @@ vlan_ioctl(struct ifnet *ifp, u_long cmd
error = ENOENT;
break;
}
-   /*
-* Don't let the caller set up a VLAN VID with
-* anything except VLID bits.
-*/
-   if (vlr.vlr_tag  ~EVL_VLID_MASK) {
-   error = EINVAL;
-   break;
-   }
error = vlan_config(ifv, p, vlr.vlr_tag);
if (error)
break;
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r280302 - head/sys/net

2015-03-20 Thread Gleb Smirnoff
Author: glebius
Date: Fri Mar 20 20:42:58 2015
New Revision: 280302
URL: https://svnweb.freebsd.org/changeset/base/280302

Log:
  In vlan_clone_match_ethervid():
  - Use ifunit() instead of going through the interface list ourselves.
  - Remove unused parameter.
  - Move the most important comment above the function.
  
  Sponsored by: Nginx, Inc.

Modified:
  head/sys/net/if_vlan.c

Modified: head/sys/net/if_vlan.c
==
--- head/sys/net/if_vlan.c  Fri Mar 20 20:08:36 2015(r280301)
+++ head/sys/net/if_vlan.c  Fri Mar 20 20:42:58 2015(r280302)
@@ -208,8 +208,7 @@ static  void vlan_link_state(struct ifnet
 static void vlan_capabilities(struct ifvlan *ifv);
 static void vlan_trunk_capabilities(struct ifnet *ifp);
 
-static struct ifnet *vlan_clone_match_ethervid(struct if_clone *,
-const char *, int *);
+static struct ifnet *vlan_clone_match_ethervid(const char *, int *);
 static int vlan_clone_match(struct if_clone *, const char *);
 static int vlan_clone_create(struct if_clone *, char *, size_t, caddr_t);
 static int vlan_clone_destroy(struct if_clone *, struct ifnet *);
@@ -801,40 +800,41 @@ VNET_SYSUNINIT(vnet_vlan_uninit, SI_SUB_
 vnet_vlan_uninit, NULL);
 #endif
 
+/*
+ * Check for etherif.vlan style interface names.
+ */
 static struct ifnet *
-vlan_clone_match_ethervid(struct if_clone *ifc, const char *name, int *vidp)
+vlan_clone_match_ethervid(const char *name, int *vidp)
 {
-   const char *cp;
+   char ifname[IFNAMSIZ];
+   char *cp;
struct ifnet *ifp;
int vid;
 
-   /* Check for etherif.vlan style interface names. */
-   IFNET_RLOCK_NOSLEEP();
-   TAILQ_FOREACH(ifp, V_ifnet, if_link) {
-   /*
-* We can handle non-ethernet hardware types as long as
-* they handle the tagging and headers themselves.
-*/
-   if (ifp-if_type != IFT_ETHER 
-   (ifp-if_capenable  IFCAP_VLAN_HWTAGGING) == 0)
-   continue;
-   if (strncmp(ifp-if_xname, name, strlen(ifp-if_xname)) != 0)
-   continue;
-   cp = name + strlen(ifp-if_xname);
-   if (*cp++ != '.')
-   continue;
-   if (*cp == '\0')
-   continue;
-   vid = 0;
-   for(; *cp = '0'  *cp = '9'; cp++)
-   vid = (vid * 10) + (*cp - '0');
-   if (*cp != '\0')
-   continue;
-   if (vidp != NULL)
-   *vidp = vid;
-   break;
-   }
-   IFNET_RUNLOCK_NOSLEEP();
+   strlcpy(ifname, name, IFNAMSIZ);
+   if ((cp = strchr(ifname, '.')) == NULL)
+   return (NULL);
+   *cp = '\0';
+   if ((ifp = ifunit(ifname)) == NULL)
+   return (NULL);
+   /*
+* We can handle non-ethernet hardware types as long as
+* they handle the tagging and headers themselves.
+*/
+   if (ifp-if_type != IFT_ETHER 
+   (ifp-if_capenable  IFCAP_VLAN_HWTAGGING) == 0)
+   return (NULL);
+
+   /* Parse VID. */
+   if (*++cp == '\0')
+   return (NULL);
+   vid = 0;
+   for(; *cp = '0'  *cp = '9'; cp++)
+   vid = (vid * 10) + (*cp - '0');
+   if (*cp != '\0')
+   return (NULL);
+   if (vidp != NULL)
+   *vidp = vid;
 
return (ifp);
 }
@@ -844,7 +844,7 @@ vlan_clone_match(struct if_clone *ifc, c
 {
const char *cp;
 
-   if (vlan_clone_match_ethervid(ifc, name, NULL) != NULL)
+   if (vlan_clone_match_ethervid(name, NULL) != NULL)
return (1);
 
if (strncmp(vlanname, name, strlen(vlanname)) != 0)
@@ -906,7 +906,7 @@ vlan_clone_create(struct if_clone *ifc, 
ethertag = 1;
vid = vlr.vlr_tag;
wildcard = (unit  0);
-   } else if ((p = vlan_clone_match_ethervid(ifc, name, vid)) != NULL) {
+   } else if ((p = vlan_clone_match_ethervid(name, vid)) != NULL) {
ethertag = 1;
unit = -1;
wildcard = 0;
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r280173 - head/sys/kern

2015-03-17 Thread Gleb Smirnoff
Author: glebius
Date: Tue Mar 17 14:16:50 2015
New Revision: 280173
URL: https://svnweb.freebsd.org/changeset/base/280173

Log:
  Reduce header pollution.

Modified:
  head/sys/kern/uipc_mbufhash.c

Modified: head/sys/kern/uipc_mbufhash.c
==
--- head/sys/kern/uipc_mbufhash.c   Tue Mar 17 13:21:49 2015
(r280172)
+++ head/sys/kern/uipc_mbufhash.c   Tue Mar 17 14:16:50 2015
(r280173)
@@ -24,13 +24,8 @@ __FBSDID($FreeBSD$);
 #include opt_inet6.h
 
 #include sys/param.h
-#include sys/kernel.h
 #include sys/mbuf.h
 #include sys/fnv_hash.h
-#include sys/socket.h
-
-#include net/if.h
-#include net/if_var.h
 
 #include net/ethernet.h
 
@@ -46,8 +41,6 @@ __FBSDID($FreeBSD$);
 #include netinet/ip6.h
 #endif
 
-#include net/if_vlan_var.h
-
 static const void *
 m_ether_tcpip_hash_gethdr(const struct mbuf *m, const u_int off,
 const u_int len, void *buf)
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


Re: svn commit: r279828 - head/sys/dev/cadence

2015-03-10 Thread Gleb Smirnoff
On Mon, Mar 09, 2015 at 10:39:59PM +, Ian Lepore wrote:
I Author: ian
I Date: Mon Mar  9 22:39:58 2015
I New Revision: 279828
I URL: https://svnweb.freebsd.org/changeset/base/279828
I 
I Log:
I   Use the new ifnet API.  Also, allocate bus_dma_maps as needed instead of
I   pre-allocating them all at start-up.  Also fix a bug in cgem_stop(); 
before,
I   it wasn't properly unloading dma maps due to a cut-and-paste error.

Ian, the new ifnet API isn't the last word in ifnet API. :)

Since you are already into that, I'd appreciate if you look
into projects/ifnet branch and convert cgem(4) to it.

As examples, you can look at msk(4), bge(4), xl(4) and vtnet(4)
in the branch.

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


Re: svn commit: r279764 - head/sys/vm

2015-03-10 Thread Gleb Smirnoff
On Tue, Mar 10, 2015 at 12:18:13PM +0200, Konstantin Belousov wrote:
K On Tue, Mar 10, 2015 at 01:01:41PM +0300, Gleb Smirnoff wrote:
K  On Sun, Mar 08, 2015 at 02:13:47AM +, Konstantin Belousov wrote:
K  K Author: kib
K  K Date: Sun Mar  8 02:13:46 2015
K  K New Revision: 279764
K  K URL: https://svnweb.freebsd.org/changeset/base/279764
K  K 
K  K Log:
K  K   Fix function name in the panic message.
K  
K  Why not use %s, __func__ always and never encounter this problem
K  in future?
K 
K Because you cannot grep for the panic string when __func__ is used.

Grepping for panic string doesn't work in general. A panic message
can report pointers or numbers, which make text not unique. Actually,
the messages that do report extra information are more useful. Also,
if panic string resides in the source code under several levels of
indentation, it is likely to be split into two lines.

But you can always grep for the function name and locate the panic
or KASSERT in the function manually, which isn't a big deal. And
if %s, __func__ is used, you will never get to a wrong function.

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


Re: svn commit: r279819 - head/sys/dev/hyperv/netvsc

2015-03-10 Thread Gleb Smirnoff
On Mon, Mar 09, 2015 at 08:11:17PM +, Xin LI wrote:
X Author: delphij
X Date: Mon Mar  9 20:11:16 2015
X New Revision: 279819
X URL: https://svnweb.freebsd.org/changeset/base/279819
X 
X Log:
X   Fix CARP when in use in a HyperV environment:
X   
X- Bump link state when stopping or starting the interface;
X- Don't handle SIOCGIFADDR specially, similar to r277103.
X   
X   This change is based on a previous revision from Andy Zhang
X   (Microsoft) who did the diagnostic work and many thanks to
X   them for their help in supporting the HyperV work.
X   
X   PR:kern/187203
X   MFC after: 2 weeks

Thanks a lot, Xin and Andy!

This was on my queue, but due to lack of HyperV at hand I constantly
delayed fixing that.

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


Re: svn commit: r279764 - head/sys/vm

2015-03-10 Thread Gleb Smirnoff
On Sun, Mar 08, 2015 at 02:13:47AM +, Konstantin Belousov wrote:
K Author: kib
K Date: Sun Mar  8 02:13:46 2015
K New Revision: 279764
K URL: https://svnweb.freebsd.org/changeset/base/279764
K 
K Log:
K   Fix function name in the panic message.

Why not use %s, __func__ always and never encounter this problem
in future?

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


  1   2   3   4   5   6   7   8   9   10   >