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

2012-10-11 Thread Pyun YongHyeon
Author: yongari
Date: Thu Oct 11 06:07:48 2012
New Revision: 241437
URL: http://svn.freebsd.org/changeset/base/241437

Log:
  For 5717C/5719C/5720C and 57765 PHYs, do not perform any special
  handling(jumbo, wire speed etc) in brgphy_reset().  Touching
  BRGPHY_MII_AUXCTL register seems to confuse APE firmware such that
  it couldn't establish a link.

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

Modified: head/sys/dev/mii/brgphy.c
==
--- head/sys/dev/mii/brgphy.c   Thu Oct 11 05:48:04 2012(r241436)
+++ head/sys/dev/mii/brgphy.c   Thu Oct 11 06:07:48 2012(r241437)
@@ -918,6 +918,15 @@ brgphy_reset(struct mii_softc *sc)
break;
}
break;
+   case MII_OUI_BROADCOM3:
+   switch (sc-mii_mpd_model) {
+   case MII_MODEL_BROADCOM3_BCM5717C:
+   case MII_MODEL_BROADCOM3_BCM5719C:
+   case MII_MODEL_BROADCOM3_BCM5720C:
+   case MII_MODEL_BROADCOM3_BCM57765:
+   return;
+   }
+   break;
}
 
ifp = sc-mii_pdata-mii_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


svn commit: r241438 - head/sys/dev/bge

2012-10-11 Thread Pyun YongHyeon
Author: yongari
Date: Thu Oct 11 06:43:43 2012
New Revision: 241438
URL: http://svn.freebsd.org/changeset/base/241438

Log:
  Add APE firmware support and improve firmware handshake procedure.
  This change will enable IPMI access on 5717/5718/5719/5720 and 5761
  controllers. Because ASF is not available when APE firmware is
  present, bge_allow_asf tunable is ignored when driver detects APE
  firmware.  Also bge(4) no longer performs two resets(one blind
  reset and the other reset with firmware in mind) in device attach.
  Now bge(4) performs a reset with enough information in bge_reset().
  The APE firmware also needs special handling to make suspend/resume
  work but it was not implemented yet.
  
  With this change, bge(4) should work on any 5717/5718/5719/5720
  controllers. Special thanks to Mike Hibler at Emulab who setup
  remote debugging on Dell R820. Without his help I couldn't be able
  to address several issues happened on Dell Rx20 systems. And many
  thanks to Broadcom for continuing to support FreeBSD!
  
  Submitted by: davidch (initial version)
  H/W donated by:   Broadcom
  Tested by:many
  Tested on:Del R820/R720/R620/R420/R320 and HP Proliant DL 360 G8

Modified:
  head/sys/dev/bge/if_bge.c
  head/sys/dev/bge/if_bgereg.h

Modified: head/sys/dev/bge/if_bge.c
==
--- head/sys/dev/bge/if_bge.c   Thu Oct 11 06:07:48 2012(r241437)
+++ head/sys/dev/bge/if_bge.c   Thu Oct 11 06:43:43 2012(r241438)
@@ -461,8 +461,9 @@ static void bge_miibus_statchg(device_t)
 static int bge_poll(struct ifnet *ifp, enum poll_cmd cmd, int count);
 #endif
 
-#defineBGE_RESET_START 1
-#defineBGE_RESET_STOP  2
+#defineBGE_RESET_SHUTDOWN  0
+#defineBGE_RESET_START 1
+#defineBGE_RESET_SUSPEND   2
 static void bge_sig_post_reset(struct bge_softc *, int);
 static void bge_sig_legacy(struct bge_softc *, int);
 static void bge_sig_pre_reset(struct bge_softc *, int);
@@ -470,6 +471,13 @@ static void bge_stop_fw(struct bge_softc
 static int bge_reset(struct bge_softc *);
 static void bge_link_upd(struct bge_softc *);
 
+static void bge_ape_lock_init(struct bge_softc *);
+static void bge_ape_read_fw_ver(struct bge_softc *);
+static int bge_ape_lock(struct bge_softc *, int);
+static void bge_ape_unlock(struct bge_softc *, int);
+static void bge_ape_send_event(struct bge_softc *, uint32_t);
+static void bge_ape_driver_state_change(struct bge_softc *, int);
+
 /*
  * The BGE_REGISTER_DEBUG option is only for low-level debugging.  It may
  * leak information to untrusted users.  It is also known to cause alignment
@@ -478,6 +486,7 @@ static void bge_link_upd(struct bge_soft
 #ifdef BGE_REGISTER_DEBUG
 static int bge_sysctl_debug_info(SYSCTL_HANDLER_ARGS);
 static int bge_sysctl_reg_read(SYSCTL_HANDLER_ARGS);
+static int bge_sysctl_ape_read(SYSCTL_HANDLER_ARGS);
 static int bge_sysctl_mem_read(SYSCTL_HANDLER_ARGS);
 #endif
 static void bge_add_sysctls(struct bge_softc *);
@@ -643,6 +652,318 @@ bge_writembx(struct bge_softc *sc, int o
 }
 
 /*
+ * Clear all stale locks and select the lock for this driver instance.
+ */
+static void
+bge_ape_lock_init(struct bge_softc *sc)
+{
+   uint32_t bit, regbase;
+   int i;
+
+   if (sc-bge_asicrev == BGE_ASICREV_BCM5761)
+   regbase = BGE_APE_LOCK_GRANT;
+   else
+   regbase = BGE_APE_PER_LOCK_GRANT;
+
+   /* Clear any stale locks. */
+   for (i = BGE_APE_LOCK_PHY0; i = BGE_APE_LOCK_GPIO; i++) {
+   switch (i) {
+   case BGE_APE_LOCK_PHY0:
+   case BGE_APE_LOCK_PHY1:
+   case BGE_APE_LOCK_PHY2:
+   case BGE_APE_LOCK_PHY3:
+   bit = BGE_APE_LOCK_GRANT_DRIVER0;
+   break;
+   default:
+   if (sc-bge_func_addr != 0)
+   bit = BGE_APE_LOCK_GRANT_DRIVER0;
+   else
+   bit = (1  sc-bge_func_addr);
+   }
+   APE_WRITE_4(sc, regbase + 4 * i, bit);
+   }
+
+   /* Select the PHY lock based on the device's function number. */
+   switch (sc-bge_func_addr) {
+   case 0:
+   sc-bge_phy_ape_lock = BGE_APE_LOCK_PHY0;
+   break;
+   case 1:
+   sc-bge_phy_ape_lock = BGE_APE_LOCK_PHY1;
+   break;
+   case 2:
+   sc-bge_phy_ape_lock = BGE_APE_LOCK_PHY2;
+   break;
+   case 3:
+   sc-bge_phy_ape_lock = BGE_APE_LOCK_PHY3;
+   break;
+   default:
+   device_printf(sc-bge_dev,
+   PHY lock not supported on this function\n);
+   }
+}
+
+/*
+ * Check for APE firmware, set flags, and print version info.
+ */
+static void
+bge_ape_read_fw_ver(struct bge_softc *sc)
+{
+   const char *fwtype;
+   uint32_t apedata, 

svn commit: r241440 - in head: lib/libc/gen share/man/man5

2012-10-11 Thread Stefan Farfeleder
Author: stefanf
Date: Thu Oct 11 07:54:29 2012
New Revision: 241440
URL: http://svn.freebsd.org/changeset/base/241440

Log:
  Decode the first two fstab fields with strunvis(3). This allows having spaces
  in devices and mount paths, encoded as \s or \040.
  
  PR:   bin/117687
  Submitted by: Martin Kammerhofer
  Discussed on: arch

Modified:
  head/lib/libc/gen/fstab.c
  head/share/man/man5/fstab.5

Modified: head/lib/libc/gen/fstab.c
==
--- head/lib/libc/gen/fstab.c   Thu Oct 11 07:39:51 2012(r241439)
+++ head/lib/libc/gen/fstab.c   Thu Oct 11 07:54:29 2012(r241440)
@@ -46,6 +46,7 @@ __FBSDID($FreeBSD$);
 #include stdlib.h
 #include string.h
 #include unistd.h
+#include vis.h
 #include un-namespace.h
 
 static FILE *_fs_fp;
@@ -149,11 +150,15 @@ fstabscan(void)
 /* OLD_STYLE_FSTAB */
while ((cp = strsep(p,  \t\n)) != NULL  *cp == '\0')
;
+   if (strunvis(cp, cp)  0)
+   goto bad;
_fs_fstab.fs_spec = cp;
if (!_fs_fstab.fs_spec || *_fs_fstab.fs_spec == '#')
continue;
while ((cp = strsep(p,  \t\n)) != NULL  *cp == '\0')
;
+   if (strunvis(cp, cp)  0)
+   goto bad;
_fs_fstab.fs_file = cp;
fixfsfile();
while ((cp = strsep(p,  \t\n)) != NULL  *cp == '\0')

Modified: head/share/man/man5/fstab.5
==
--- head/share/man/man5/fstab.5 Thu Oct 11 07:39:51 2012(r241439)
+++ head/share/man/man5/fstab.5 Thu Oct 11 07:54:29 2012(r241440)
@@ -32,7 +32,7 @@
 .\ @(#)fstab.58.1 (Berkeley) 6/5/93
 .\ $FreeBSD$
 .\
-.Dd June 7, 2011
+.Dd October 11, 2012
 .Dt FSTAB 5
 .Os
 .Sh NAME
@@ -66,12 +66,20 @@ The first field,
 .Pq Fa fs_spec ,
 describes the special device or
 remote file system to be mounted.
+The contents are decoded by the
+.Xr strunvis 3
+function.
+This allows using spaces or tabs in the device name which would be
+interpreted as field separators otherwise.
 .Pp
 The second field,
 .Pq Fa fs_file ,
 describes the mount point for the file system.
 For swap partitions, this field should be specified as
 .Dq none .
+The contents are decoded by the
+.Xr strunvis 3
+function, as above.
 .Pp
 The third field,
 .Pq Fa fs_vfstype ,
@@ -338,6 +346,7 @@ resides in
 .Xr mount 8 ,
 .Xr quotacheck 8 ,
 .Xr quotaon 8 ,
+.Xr strunvis 3 ,
 .Xr swapon 8 ,
 .Xr umount 8
 .Sh HISTORY
___
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: r241441 - head/lib/libc/gen

2012-10-11 Thread Stefan Farfeleder
Author: stefanf
Date: Thu Oct 11 08:18:28 2012
New Revision: 241441
URL: http://svn.freebsd.org/changeset/base/241441

Log:
  Fix my last commit.  Only call strunvis after properly checking the argument 
is
  not NULL.

Modified:
  head/lib/libc/gen/fstab.c

Modified: head/lib/libc/gen/fstab.c
==
--- head/lib/libc/gen/fstab.c   Thu Oct 11 07:54:29 2012(r241440)
+++ head/lib/libc/gen/fstab.c   Thu Oct 11 08:18:28 2012(r241441)
@@ -150,16 +150,18 @@ fstabscan(void)
 /* OLD_STYLE_FSTAB */
while ((cp = strsep(p,  \t\n)) != NULL  *cp == '\0')
;
-   if (strunvis(cp, cp)  0)
-   goto bad;
_fs_fstab.fs_spec = cp;
-   if (!_fs_fstab.fs_spec || *_fs_fstab.fs_spec == '#')
+   if (_fs_fstab.fs_spec == NULL || *_fs_fstab.fs_spec == '#')
continue;
+   if (strunvis(_fs_fstab.fs_spec, _fs_fstab.fs_spec)  0)
+   goto bad;
while ((cp = strsep(p,  \t\n)) != NULL  *cp == '\0')
;
-   if (strunvis(cp, cp)  0)
-   goto bad;
_fs_fstab.fs_file = cp;
+   if (_fs_fstab.fs_file == NULL)
+   goto bad;
+   if (strunvis(_fs_fstab.fs_file, _fs_fstab.fs_file)  0)
+   goto bad;
fixfsfile();
while ((cp = strsep(p,  \t\n)) != NULL  *cp == '\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: r241373 - head/lib/libc/stdlib

2012-10-11 Thread Pawel Jakub Dawidek
On Tue, Oct 09, 2012 at 01:51:05PM -0400, Eitan Adler wrote:
 On 9 October 2012 13:27,  m...@freebsd.org wrote:
  The original behavior can be recovered by using inline assembly to
  fetch the value from a register into a local C variable; this would at
  least not rely on undefined behavior.  But I agree it's of dubious
  value anyways.
 
 I proposed this (with a patch). We want to move to not using
 /dev/random and instead make a kernel system call directly. The patch
 for this is not finished yet though.

You should do something similar to:

http://people.freebsd.org/~pjd/patches/libc_arc4random.c.patch

-- 
Pawel Jakub Dawidek   http://www.wheelsystems.com
FreeBSD committer http://www.FreeBSD.org
Am I Evil? Yes, I Am! http://tupytaj.pl


pgpF47iS54IbM.pgp
Description: PGP signature


Re: svn commit: r241373 - head/lib/libc/stdlib

2012-10-11 Thread Andrey Chernov
On 11.10.2012 19:23, Peter Wemm wrote:
 On Thu, Oct 11, 2012 at 6:14 AM, Andrey Chernov a...@freebsd.org wrote:
 On 11.10.2012 15:44, Pawel Jakub Dawidek wrote:
 On Tue, Oct 09, 2012 at 01:51:05PM -0400, Eitan Adler wrote:
 On 9 October 2012 13:27,  m...@freebsd.org wrote:
 The original behavior can be recovered by using inline assembly to
 fetch the value from a register into a local C variable; this would at
 least not rely on undefined behavior.  But I agree it's of dubious
 value anyways.

 I proposed this (with a patch). We want to move to not using
 /dev/random and instead make a kernel system call directly. The patch
 for this is not finished yet though.

 You should do something similar to:

   http://people.freebsd.org/~pjd/patches/libc_arc4random.c.patch


 Already half of year I told people of our serious problem with kernel's
 arc4 (used here in sysctl) - it have very weak initialization at the
 kernel start (only from processor clock) which is auto-fixed because of
 its periodic reseeds, but only at the next reseed which happens late. I
 post two patches (both working, one using atomic, another don't use it)
 which reseeds kernel's arc4 as fast as we have enough real entropy.
 NetBSD don't have this problem because of their different kernel's arc4
 implementation.
 
 How late is late?  Since this was a userland patch, has it been
 reseeded by then?

See /sys/libkern/arc4random.c
#define ARC4_RESEED_SECONDS 300
i.e. first 5 minutes at least it is very bad seeded and vulnerable. But
we don't have guarantee to have enough entropy even after first 5
minutes, it very depends of entropy sources turned on the machine
configuration at whole (diskless, etc).

Moreover, arc4random(3) code have its own reseed happens after
arc4_count = 160;
(divided by 4) iterations which increases bad seeded bytes initially
taken from kernel's arc4 until whole count will be exhausted which is
_very_ long time (consider that typical application issue only several
rare arc4random(3) calls and exits, left arc4_count not decreased
globally at all).

 Regardless, this is getting way off topic from using an xor of an
 uninitialized userland variable and what the compiler optimizer might
 do with it.
 
 Of course that's assuming it is even a memory based stack.  The sparc
 or ia64 register stack makes that xor even more dubious.

I pass this subj to the people who knows clang compiler better to say
for sure is it right to generate LLVM intermediate
call void @srand(i32 undef)
or not. Xoring the stack (or register) there is not essential step.

___
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: r241446 - head/sys/netgraph/netflow

2012-10-11 Thread Alexander V. Chernikov
Author: melifaro
Date: Thu Oct 11 16:15:18 2012
New Revision: 241446
URL: http://svn.freebsd.org/changeset/base/241446

Log:
  Add NG_NETFLOW_V9INFO_TYPE command to be able to request netflowv9-specific
  data.
  
  Submitted by: Dmitry Luhtionov dmitryluhtionov at gmail.com
  MFC after:2 weeks

Modified:
  head/sys/netgraph/netflow/netflow_v9.c
  head/sys/netgraph/netflow/ng_netflow.c
  head/sys/netgraph/netflow/ng_netflow.h

Modified: head/sys/netgraph/netflow/netflow_v9.c
==
--- head/sys/netgraph/netflow/netflow_v9.c  Thu Oct 11 15:49:42 2012
(r241445)
+++ head/sys/netgraph/netflow/netflow_v9.c  Thu Oct 11 16:15:18 2012
(r241446)
@@ -480,3 +480,14 @@ ng_netflow_v9_cache_flush(priv_p priv)
for (i = 0; i  priv-flowsets_count; i++)
free(priv-v9_flowsets[i], M_NETFLOW_GENERAL);
 }
+
+/* Get a snapshot of NetFlow v9 settings */
+void
+ng_netflow_copyv9info(priv_p priv, struct ng_netflow_v9info *i)
+{
+
+   i-templ_time = priv-templ_time;
+   i-templ_packets = priv-templ_packets;
+   i-mtu = priv-mtu;
+}
+

Modified: head/sys/netgraph/netflow/ng_netflow.c
==
--- head/sys/netgraph/netflow/ng_netflow.c  Thu Oct 11 15:49:42 2012
(r241445)
+++ head/sys/netgraph/netflow/ng_netflow.c  Thu Oct 11 16:15:18 2012
(r241446)
@@ -138,6 +138,14 @@ static const struct ng_parse_type ng_net
ng_netflow_setmtu_type_fields
 };
 
+/* Parse type for struct ng_netflow_v9info */
+static const struct ng_parse_struct_field ng_netflow_v9info_type_fields[]
+   = NG_NETFLOW_V9INFO_TYPE;
+static const struct ng_parse_type ng_netflow_v9info_type = {
+   ng_parse_struct_type,
+   ng_netflow_v9info_type_fields
+};
+
 /* List of commands and how to convert arguments to/from ASCII */
 static const struct ng_cmdlist ng_netflow_cmds[] = {
{
@@ -196,6 +204,13 @@ static const struct ng_cmdlist ng_netflo
ng_netflow_setmtu_type,
NULL
},
+   {
+NGM_NETFLOW_COOKIE,
+NGM_NETFLOW_V9INFO,
+v9info,
+NULL,
+ng_netflow_v9info_type
+   },
{ 0 }
 };
 
@@ -526,6 +541,17 @@ ng_netflow_rcvmsg (node_p node, item_p i
 
break;
}
+   case NGM_NETFLOW_V9INFO:
+   {
+   struct ng_netflow_v9info *i;
+
+   NG_MKRESPONSE(resp, msg, sizeof(struct 
ng_netflow_v9info),
+   M_NOWAIT);
+   i = (struct ng_netflow_v9info *)resp-data;
+   ng_netflow_copyv9info(priv, i);
+
+   break;
+   }
default:
ERROUT(EINVAL); /* unknown command */
break;

Modified: head/sys/netgraph/netflow/ng_netflow.h
==
--- head/sys/netgraph/netflow/ng_netflow.h  Thu Oct 11 15:49:42 2012
(r241445)
+++ head/sys/netgraph/netflow/ng_netflow.h  Thu Oct 11 16:15:18 2012
(r241446)
@@ -34,6 +34,7 @@
 
 #define NG_NETFLOW_NODE_TYPE   netflow
 #define NGM_NETFLOW_COOKIE 1309868867
+#define NGM_NETFLOW_V9_COOKIE  1349865386
 
 #defineNG_NETFLOW_MAXIFACESUSHRT_MAX
 
@@ -58,6 +59,7 @@ enum {
 NGM_NETFLOW_SETCONFIG  = 7,/* set flow generation options */
 NGM_NETFLOW_SETTEMPLATE= 8,/* set v9 flow template periodic */
 NGM_NETFLOW_SETMTU = 9,/* set outgoing interface MTU */
+NGM_NETFLOW_V9INFO = 10|NGM_READONLY|NGM_HASREPLY, /* get v9 info 
*/
 };
 
 /* This structure is returned by the NGM_NETFLOW_INFO message */
@@ -147,6 +149,13 @@ struct ngnf_show_header {
uint32_tnentries;   /* number of records in response */
 };
 
+/* This structure is used in NGM_NETFLOW_V9INFO message */
+struct ng_netflow_v9info {
+   uint16_ttempl_packets;  /* v9 template packets */
+   uint16_ttempl_time; /* v9 template time */
+   uint16_tmtu;/* v9 MTU */
+};
+
 /* XXXGL
  * Somewhere flow_rec6 is casted to flow_rec, and flow6_entry_data is
  * casted to flow_entry_data. After casting, fle-r.fib is accessed.
@@ -347,6 +356,14 @@ struct flow6_entry {
{ NULL }\
 }
 
+/* Parse the v9info structure */
+#defineNG_NETFLOW_V9INFO_TYPE {\
+   { v9 template packets,ng_parse_uint16_type },\
+   { v9 template time,   ng_parse_uint16_type },\
+   { v9 MTU, ng_parse_uint16_type },\
+   { NULL }\
+}
+
 /* Private hook data */
 struct ng_netflow_iface {
hook_p  hook;   /* NULL when disconnected */
@@ -422,6 +439,7 @@ struct netflow {
 

svn commit: r241456 - head/sys/cam

2012-10-11 Thread Alexander Motin
Author: mav
Date: Thu Oct 11 20:14:11 2012
New Revision: 241456
URL: http://svn.freebsd.org/changeset/base/241456

Log:
  Use separate malloc buckets for CAM devices, CCBs and paths. This will
  make it easier to track down the source of any use after free problems.
  
  Submitted by: ken@

Modified:
  head/sys/cam/cam_xpt.c

Modified: head/sys/cam/cam_xpt.c
==
--- head/sys/cam/cam_xpt.c  Thu Oct 11 19:57:11 2012(r241455)
+++ head/sys/cam/cam_xpt.c  Thu Oct 11 20:14:11 2012(r241456)
@@ -78,6 +78,9 @@ __FBSDID($FreeBSD$);
 
 /* Datastructures internal to the xpt layer */
 MALLOC_DEFINE(M_CAMXPT, CAM XPT, CAM XPT buffers);
+MALLOC_DEFINE(M_CAMDEV, CAM DEV, CAM devices);
+MALLOC_DEFINE(M_CAMCCB, CAM CCB, CAM CCBs);
+MALLOC_DEFINE(M_CAMPATH, CAM path, CAM paths);
 
 /* Object for defering XPT actions to a taskqueue */
 struct xpt_task {
@@ -3397,7 +3400,7 @@ xpt_create_path(struct cam_path **new_pa
struct cam_path *path;
cam_status status;
 
-   path = (struct cam_path *)malloc(sizeof(*path), M_CAMXPT, M_NOWAIT);
+   path = (struct cam_path *)malloc(sizeof(*path), M_CAMPATH, M_NOWAIT);
 
if (path == NULL) {
status = CAM_RESRC_UNAVAIL;
@@ -3405,7 +3408,7 @@ xpt_create_path(struct cam_path **new_pa
}
status = xpt_compile_path(path, perph, path_id, target_id, lun_id);
if (status != CAM_REQ_CMP) {
-   free(path, M_CAMXPT);
+   free(path, M_CAMPATH);
path = NULL;
}
*new_path_ptr = path;
@@ -3422,7 +3425,7 @@ xpt_create_path_unlocked(struct cam_path
cam_status status;
intneed_unlock = 0;
 
-   path = (struct cam_path *)malloc(sizeof(*path), M_CAMXPT, M_WAITOK);
+   path = (struct cam_path *)malloc(sizeof(*path), M_CAMPATH, M_WAITOK);
 
if (path_id != CAM_BUS_WILDCARD) {
bus = xpt_find_bus(path_id);
@@ -3437,7 +3440,7 @@ xpt_create_path_unlocked(struct cam_path
xpt_release_bus(bus);
}
if (status != CAM_REQ_CMP) {
-   free(path, M_CAMXPT);
+   free(path, M_CAMPATH);
path = NULL;
}
*new_path_ptr = path;
@@ -3540,7 +3543,7 @@ xpt_free_path(struct cam_path *path)
 
CAM_DEBUG(path, CAM_DEBUG_TRACE, (xpt_free_path\n));
xpt_release_path(path);
-   free(path, M_CAMXPT);
+   free(path, M_CAMPATH);
 }
 
 void
@@ -4377,7 +4380,7 @@ xpt_alloc_ccb()
 {
union ccb *new_ccb;
 
-   new_ccb = malloc(sizeof(*new_ccb), M_CAMXPT, M_ZERO|M_WAITOK);
+   new_ccb = malloc(sizeof(*new_ccb), M_CAMCCB, M_ZERO|M_WAITOK);
return (new_ccb);
 }
 
@@ -4386,14 +4389,14 @@ xpt_alloc_ccb_nowait()
 {
union ccb *new_ccb;
 
-   new_ccb = malloc(sizeof(*new_ccb), M_CAMXPT, M_ZERO|M_NOWAIT);
+   new_ccb = malloc(sizeof(*new_ccb), M_CAMCCB, M_ZERO|M_NOWAIT);
return (new_ccb);
 }
 
 void
 xpt_free_ccb(union ccb *free_ccb)
 {
-   free(free_ccb, M_CAMXPT);
+   free(free_ccb, M_CAMCCB);
 }
 
 
@@ -4545,7 +4548,7 @@ xpt_alloc_device(struct cam_eb *bus, str
device = NULL;
} else {
device = (struct cam_ed *)malloc(sizeof(*device),
-M_CAMXPT, M_NOWAIT|M_ZERO);
+M_CAMDEV, M_NOWAIT|M_ZERO);
}
 
if (device != NULL) {
@@ -4558,13 +4561,13 @@ xpt_alloc_device(struct cam_eb *bus, str
device-sim = bus-sim;
/* Initialize our queues */
if (camq_init(device-drvq, 0) != 0) {
-   free(device, M_CAMXPT);
+   free(device, M_CAMDEV);
return (NULL);
}
if (cam_ccbq_init(device-ccbq,
  bus-sim-max_dev_openings) != 0) {
camq_fini(device-drvq);
-   free(device, M_CAMXPT);
+   free(device, M_CAMDEV);
return (NULL);
}
SLIST_INIT(device-asyncs);
@@ -4628,7 +4631,7 @@ xpt_release_device(struct cam_ed *device
free(device-serial_num, M_CAMXPT);
 
xpt_release_target(device-target);
-   free(device, M_CAMXPT);
+   free(device, M_CAMDEV);
} else
device-refcount--;
 }
___
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: r241457 - head/etc/sendmail

2012-10-11 Thread Peter Wemm
Author: peter
Date: Thu Oct 11 20:46:04 2012
New Revision: 241457
URL: http://svn.freebsd.org/changeset/base/241457

Log:
  Point freebsd.org cluster machines to mx1 for their smarthost.

Modified:
  head/etc/sendmail/freefall.mc

Modified: head/etc/sendmail/freefall.mc
==
--- head/etc/sendmail/freefall.mc   Thu Oct 11 20:14:11 2012
(r241456)
+++ head/etc/sendmail/freefall.mc   Thu Oct 11 20:46:04 2012
(r241457)
@@ -43,5 +43,5 @@ divert(0)dnl
 VERSIONID(`$FreeBSD$')
 
 OSTYPE(freebsd6)
-FEATURE(nullclient, hub.$m)
+FEATURE(nullclient, mx1.$m)
 MASQUERADE_AS(FreeBSD.org)
___
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: r241463 - head/sys/dev/etherswitch/arswitch

2012-10-11 Thread Aleksandr Rybalko
Author: ray
Date: Thu Oct 11 21:19:42 2012
New Revision: 241463
URL: http://svn.freebsd.org/changeset/base/241463

Log:
  Fix tiypo.
  
  Submitted by: Luiz Otavio O Souza
  Approved by:  adrian (mentor)

Modified:
  head/sys/dev/etherswitch/arswitch/arswitchvar.h

Modified: head/sys/dev/etherswitch/arswitch/arswitchvar.h
==
--- head/sys/dev/etherswitch/arswitch/arswitchvar.h Thu Oct 11 21:15:54 
2012(r241462)
+++ head/sys/dev/etherswitch/arswitch/arswitchvar.h Thu Oct 11 21:19:42 
2012(r241463)
@@ -70,7 +70,7 @@ struct arswitch_softc {
 #defineARSWITCH_UNLOCK(_sc)\
mtx_unlock((_sc)-sc_mtx)
 #defineARSWITCH_LOCK_ASSERT(_sc, _what)\
-   mtx_assert((_s)c-sc_mtx, (_what))
+   mtx_assert((_sc)-sc_mtx, (_what))
 #defineARSWITCH_TRYLOCK(_sc)   \
mtx_trylock((_sc)-sc_mtx)
 
___
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: r241464 - head/tools/tools/netmap

2012-10-11 Thread Ed Maste
Author: emaste
Date: Thu Oct 11 21:24:07 2012
New Revision: 241464
URL: http://svn.freebsd.org/changeset/base/241464

Log:
  Make local function static.

Modified:
  head/tools/tools/netmap/pcap.c

Modified: head/tools/tools/netmap/pcap.c
==
--- head/tools/tools/netmap/pcap.c  Thu Oct 11 21:19:42 2012
(r241463)
+++ head/tools/tools/netmap/pcap.c  Thu Oct 11 21:24:07 2012
(r241464)
@@ -49,7 +49,7 @@ int verbose = 0;
 __FUNCTION__, __LINE__, ##__VA_ARGS__);\
} while (0)
 
-inline void prefetch (const void *x)
+static inline void prefetch (const void *x)
 {
__asm volatile(prefetcht0 %0 :: m (*(const unsigned long *)x));
 }
___
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: r241469 - head/sys/dev/virtio

2012-10-11 Thread Peter Grehan
Author: grehan
Date: Thu Oct 11 23:03:42 2012
New Revision: 241469
URL: http://svn.freebsd.org/changeset/base/241469

Log:
  Patch from Bryan to fix a virtqueue issue:
  
  virtqueue: Fix non-indirect virtqueues
  
  We really must walk the entire descriptor chain in order
  to append the to be free'd chain to the existing free
  chain.
  
  Submitted by: Bryan Venteicher (bry...@daemoninthecloset.org)
  Reported by:  cognet

Modified:
  head/sys/dev/virtio/virtqueue.c

Modified: head/sys/dev/virtio/virtqueue.c
==
--- head/sys/dev/virtio/virtqueue.c Thu Oct 11 23:02:35 2012
(r241468)
+++ head/sys/dev/virtio/virtqueue.c Thu Oct 11 23:03:42 2012
(r241469)
@@ -780,8 +780,8 @@ vq_ring_free_chain(struct virtqueue *vq,
VQ_RING_ASSERT_CHAIN_TERM(vq);
 
vq-vq_free_cnt += dxp-ndescs;
+   dxp-ndescs--;
 
-#ifdef INVARIANTS
if ((dp-flags  VRING_DESC_F_INDIRECT) == 0) {
while (dp-flags  VRING_DESC_F_NEXT) {
VQ_RING_ASSERT_VALID_IDX(vq, dp-next);
@@ -789,10 +789,9 @@ vq_ring_free_chain(struct virtqueue *vq,
dxp-ndescs--;
}
}
-   VQASSERT(vq, dxp-ndescs == 1,
+
+   VQASSERT(vq, dxp-ndescs == 0,
failed to free entire desc chain, remaining: %d, dxp-ndescs);
-#endif
-   dxp-ndescs = 0;
 
/*
 * We must append the existing free chain, if any, to the end of
___
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: r241470 - in head: share/man/man4 sys/dev/virtio sys/dev/virtio/scsi sys/modules/virtio sys/modules/virtio/scsi

2012-10-11 Thread Peter Grehan
Author: grehan
Date: Thu Oct 11 23:41:18 2012
New Revision: 241470
URL: http://svn.freebsd.org/changeset/base/241470

Log:
  Virtio SCSI driver
  
  Submitted by: Bryan Venteicher  bryanv at daemoninthecloset dot org
  Reviewed by:  grehan

Added:
  head/share/man/man4/virtio_scsi.4   (contents, props changed)
  head/sys/dev/virtio/scsi/
  head/sys/dev/virtio/scsi/virtio_scsi.c   (contents, props changed)
  head/sys/dev/virtio/scsi/virtio_scsi.h   (contents, props changed)
  head/sys/dev/virtio/scsi/virtio_scsivar.h   (contents, props changed)
  head/sys/modules/virtio/scsi/
  head/sys/modules/virtio/scsi/Makefile   (contents, props changed)
Modified:
  head/share/man/man4/Makefile
  head/share/man/man4/virtio.4
  head/sys/dev/virtio/virtio.c
  head/sys/dev/virtio/virtio.h
  head/sys/modules/virtio/Makefile

Modified: head/share/man/man4/Makefile
==
--- head/share/man/man4/MakefileThu Oct 11 23:03:42 2012
(r241469)
+++ head/share/man/man4/MakefileThu Oct 11 23:41:18 2012
(r241470)
@@ -531,6 +531,7 @@ MAN=aac.4 \
${_virtio.4} \
${_virtio_balloon.4} \
${_virtio_blk.4} \
+   ${_virtio_scsi.4} \
vkbd.4 \
vlan.4 \
vpo.4 \
@@ -768,6 +769,7 @@ _nxge.4=nxge.4
 _virtio.4= virtio.4
 _virtio_balloon.4=virtio_balloon.4
 _virtio_blk.4= virtio_blk.4
+_virtio_scsi.4= virtio_scsi.4
 _vtnet.4=  vtnet.4
 _vxge.4=   vxge.4
 _padlock.4=padlock.4

Modified: head/share/man/man4/virtio.4
==
--- head/share/man/man4/virtio.4Thu Oct 11 23:03:42 2012
(r241469)
+++ head/share/man/man4/virtio.4Thu Oct 11 23:41:18 2012
(r241470)
@@ -72,6 +72,10 @@ device driver.
 An emulated disk controller is provided by the
 .Xr virtio_blk 4
 device driver.
+.It Nm SCSI
+An emulated SCSI HBA is provided by the
+.Xr virtio_scsi 4
+device driver.
 .It Nm Balloon
 A pseudo-device to allow the VM to release memory back to the hypervisor is
 provided by the
@@ -81,6 +85,7 @@ device driver.
 .Sh SEE ALSO
 .Xr virtio_balloon 4 ,
 .Xr virtio_blk 4 ,
+.Xr virtio_scsi 4 ,
 .Xr vtnet 4
 .Sh HISTORY
 Support for VirtIO first appeared in

Added: head/share/man/man4/virtio_scsi.4
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/share/man/man4/virtio_scsi.4   Thu Oct 11 23:41:18 2012
(r241470)
@@ -0,0 +1,92 @@
+.\ Copyright (c) 2012 Bryan Venteicher
+.\ All rights reserved.
+.\
+.\ Redistribution and use in source and binary forms, with or without
+.\ modification, are permitted provided that the following conditions
+.\ are met:
+.\ 1. Redistributions of source code must retain the above copyright
+.\notice, this list of conditions and the following disclaimer.
+.\ 2. Redistributions in binary form must reproduce the above copyright
+.\notice, this list of conditions and the following disclaimer in the
+.\documentation and/or other materials provided with the distribution.
+.\
+.\ THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\ ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\ SUCH DAMAGE.
+.\
+.\ $FreeBSD$
+.\
+.Dd June 24, 2012
+.Dt VIRTIO_SCSI 4
+.Os
+.Sh NAME
+.Nm virtio_scsi
+.Nd VirtIO SCSI driver
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd device virtio_scsi
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+virtio_scsi_load=YES
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+device driver provides support for VirtIO SCSI devices.
+.Sh LOADER TUNABLES
+Tunables can be set at the
+.Xr loader 8
+prompt before booting the kernel or stored in
+.Xr loader.conf 5 .
+.Bl -tag -width xx
+.It Va hw.vtscsi.bus_reset_disable
+In the initial QEMU release with VirtIO SCSI support, in-flight
+operations were not aborted when stopping the device, rendering
+bus reset ineffective. This tunable disables attempts to issue
+reset bus commands. The default value is 1.
+.El
+.Sh DEBUGGING
+To enable debugging 

svn commit: r241471 - head/share/man/man9

2012-10-11 Thread Kevin Lo
Author: kevlo
Date: Fri Oct 12 01:31:02 2012
New Revision: 241471
URL: http://svn.freebsd.org/changeset/base/241471

Log:
  Since the moduledata structure member priv is a void pointer, using
  NULL instead of 0 when dealing with pointers.

Modified:
  head/share/man/man9/module.9

Modified: head/share/man/man9/module.9
==
--- head/share/man/man9/module.9Thu Oct 11 23:41:18 2012
(r241470)
+++ head/share/man/man9/module.9Fri Oct 12 01:31:02 2012
(r241471)
@@ -99,7 +99,7 @@ static int foo_handler(module_t mod, int
 static moduledata_t mod_data= {
 foo,
 foo_handler,
-0
+   NULL
 };
 
 MODULE_VERSION(foo, 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


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

2012-10-11 Thread Gleb Smirnoff
On Fri, Oct 12, 2012 at 01:31:03AM +, Kevin Lo wrote:
K Author: kevlo
K Date: Fri Oct 12 01:31:02 2012
K New Revision: 241471
K URL: http://svn.freebsd.org/changeset/base/241471
K 
K Log:
K   Since the moduledata structure member priv is a void pointer, using
K   NULL instead of 0 when dealing with pointers.
K 
K Modified:
K   head/share/man/man9/module.9
K 
K Modified: head/share/man/man9/module.9
K 
==
K --- head/share/man/man9/module.9 Thu Oct 11 23:41:18 2012
(r241470)
K +++ head/share/man/man9/module.9 Fri Oct 12 01:31:02 2012
(r241471)
K @@ -99,7 +99,7 @@ static int foo_handler(module_t mod, int
K  static moduledata_t mod_data= {
K  foo,
K  foo_handler,
K -0
K +NULL
K  };
K  
K  MODULE_VERSION(foo, 1);

I think we should provide C99 sparse initializers for structures in
all manpages in section 9, as well as use only such initializers in any new
code added to tree.

-- 
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