svn commit: r221619 - stable/8/sys/dev/cxgbe

2011-05-08 Thread Navdeep Parhar
Author: np
Date: Sun May  8 06:25:50 2011
New Revision: 221619
URL: http://svn.freebsd.org/changeset/base/221619

Log:
  MFC r221516:
  Bump up the number of egress queues that the driver is allowed to use.

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

Modified: stable/8/sys/dev/cxgbe/t4_main.c
==
--- stable/8/sys/dev/cxgbe/t4_main.cSun May  8 05:45:06 2011
(r221618)
+++ stable/8/sys/dev/cxgbe/t4_main.cSun May  8 06:25:50 2011
(r221619)
@@ -388,7 +388,7 @@ t4_attach(device_t dev)
 
/* These are total (sum of all ports) limits for a bus driver */
rc = -t4_cfg_pfvf(sc, sc-mbox, sc-pf, 0,
-   64, /* max # of egress queues */
+   128,/* max # of egress queues */
64, /* max # of egress Ethernet or control queues */
64, /* max # of ingress queues with fl/interrupt */
0,  /* max # of ingress queues without interrupt */
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r221620 - head/sys/dev/ath/ath_hal/ar5416

2011-05-08 Thread Adrian Chadd
Author: adrian
Date: Sun May  8 07:21:09 2011
New Revision: 221620
URL: http://svn.freebsd.org/changeset/base/221620

Log:
  Fiddle with the PLL initialisation order to match ath9k/Atheros HAL.
  
  This seems to make the AR9160 behave better during heavy scanning,
  where before it'd hang and require a hard reset to recover.
  
  Obtained From:Linux ath9k, Atheros

Modified:
  head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c

Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c
==
--- head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c  Sun May  8 06:25:50 
2011(r221619)
+++ head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c  Sun May  8 07:21:09 
2011(r221620)
@@ -521,7 +521,6 @@ ar5416InitBB(struct ath_hal *ah, const s
/* Turn on PLL on 5416 */
HALDEBUG(ah, HAL_DEBUG_RESET, %s %s channel\n,
__func__, IEEE80211_IS_CHAN_5GHZ(chan) ? 5GHz : 2GHz);
-   AH5416(ah)-ah_initPLL(ah, chan);
 
/* Activate the PHY (includes baseband activate and synthesizer on) */
OS_REG_WRITE(ah, AR_PHY_ACTIVE, AR_PHY_ACTIVE_EN);
@@ -674,6 +673,10 @@ ar5416ChipReset(struct ath_hal *ah, cons
if (!ar5416SetPowerMode(ah, HAL_PM_AWAKE, AH_TRUE))
   return AH_FALSE;
 
+#ifdef notyet
+   ahp-ah_chipFullSleep = AH_FALSE;
+#endif
+
AH5416(ah)-ah_initPLL(ah, chan);
 
/*
@@ -682,8 +685,7 @@ ar5416ChipReset(struct ath_hal *ah, cons
 * with an active radio can result in corrupted shifts to the
 * radio device.
 */
-   if (chan != AH_NULL)
-   ar5416SetRfMode(ah, chan);
+   ar5416SetRfMode(ah, chan);
 
return AH_TRUE; 
 }
@@ -1103,7 +1105,11 @@ ar5416Disable(struct ath_hal *ah)
 {
if (!ar5212SetPowerMode(ah, HAL_PM_AWAKE, AH_TRUE))
return AH_FALSE;
-   return ar5416SetResetReg(ah, HAL_RESET_COLD);
+   if (! ar5416SetResetReg(ah, HAL_RESET_COLD))
+   return AH_FALSE;
+
+   AH5416(ah)-ah_initPLL(ah, AH_NULL);
+   return AH_TRUE;
 }
 
 /*
@@ -1115,7 +1121,11 @@ ar5416Disable(struct ath_hal *ah)
 HAL_BOOL
 ar5416PhyDisable(struct ath_hal *ah)
 {
-   return ar5416SetResetReg(ah, HAL_RESET_WARM);
+   if (! ar5416SetResetReg(ah, HAL_RESET_WARM))
+   return AH_FALSE;
+
+   AH5416(ah)-ah_initPLL(ah, AH_NULL);
+   return AH_TRUE;
 }
 
 /*
@@ -1278,8 +1288,6 @@ ar5416SetReset(struct ath_hal *ah, int t
}
 }
 
-AH5416(ah)-ah_initPLL(ah, AH_NULL);
-
 return AH_TRUE;
 }
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r221621 - stable/8/sys/dev/usb

2011-05-08 Thread Hans Petter Selasky
Author: hselasky
Date: Sun May  8 08:17:16 2011
New Revision: 221621
URL: http://svn.freebsd.org/changeset/base/221621

Log:
  MFC r214221, r216072 and r214809.
  Make configuration of USB stack more flexible.

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

Modified: stable/8/sys/dev/usb/usb_device.c
==
--- stable/8/sys/dev/usb/usb_device.c   Sun May  8 07:21:09 2011
(r221620)
+++ stable/8/sys/dev/usb/usb_device.c   Sun May  8 08:17:16 2011
(r221621)
@@ -97,8 +97,10 @@ static void  usb_suspend_resume_sub(struc
 static voidusbd_clear_stall_proc(struct usb_proc_msg *_pm);
 static usb_error_t usb_config_parse(struct usb_device *, uint8_t, uint8_t);
 static voidusbd_set_device_strings(struct usb_device *);
-#if USB_HAVE_UGEN
+#if USB_HAVE_DEVCTL
 static voidusb_notify_addq(const char *type, struct usb_device *);
+#endif
+#if USB_HAVE_UGEN
 static voidusb_fifo_free_wrap(struct usb_device *, uint8_t, uint8_t);
 static struct cdev *usb_make_dev(struct usb_device *, int, int);
 static voidusb_cdev_create(struct usb_device *);
@@ -1865,7 +1867,9 @@ config_done:
printf(%s: %s at %s\n, udev-ugen_name,
usb_get_manufacturer(udev),
device_get_nameunit(udev-bus-bdev));
+#endif
 
+#if USB_HAVE_DEVCTL
usb_notify_addq(ATTACH, udev);
 #endif
 done:
@@ -2011,9 +2015,11 @@ usb_free_device(struct usb_device *udev,
bus = udev-bus;
usb_set_device_state(udev, USB_STATE_DETACHED);
 
-#if USB_HAVE_UGEN
+#if USB_HAVE_DEVCTL
usb_notify_addq(DETACH, udev);
+#endif
 
+#if USB_HAVE_UGEN
printf(%s: %s at %s (disconnected)\n, udev-ugen_name,
usb_get_manufacturer(udev), device_get_nameunit(bus-bdev));
 
@@ -2380,7 +2386,7 @@ usbd_get_device_index(struct usb_device 
return (udev-device_index);
 }
 
-#if USB_HAVE_UGEN
+#if USB_HAVE_DEVCTL
 /**
  * usb_notify_addq
  *
@@ -2416,7 +2422,9 @@ usb_notify_addq_compat(const char *type,
/* String it all together. */
snprintf(data, buf_size,
%s
+#if USB_HAVE_UGEN
%s 
+#endif
at port=%u 
vendor=0x%04x 
product=0x%04x 
@@ -2424,20 +2432,27 @@ usb_notify_addq_compat(const char *type,
devsubclass=0x%02x 
sernum=\%s\ 
release=0x%04x 
-   on 
-   %s\n,
+#if USB_HAVE_UGEN
+   on %s\n
+#endif
+   ,
ntype,
+#if USB_HAVE_UGEN
udev-ugen_name,
+#endif
udev-port_no,
UGETW(udev-ddesc.idVendor),
UGETW(udev-ddesc.idProduct),
udev-ddesc.bDeviceClass,
udev-ddesc.bDeviceSubClass,
usb_get_serial(udev),
-   UGETW(udev-ddesc.bcdDevice),
-   udev-parent_hub != NULL ?
+   UGETW(udev-ddesc.bcdDevice)
+#if USB_HAVE_UGEN
+   , udev-parent_hub != NULL ?
udev-parent_hub-ugen_name :
-   device_get_nameunit(device_get_parent(udev-bus-bdev)));
+   device_get_nameunit(device_get_parent(udev-bus-bdev))
+#endif
+   );
 
devctl_queue_data(data);
 }
@@ -2457,7 +2472,10 @@ usb_notify_addq(const char *type, struct
/* announce the device */
sb = sbuf_new_auto();
sbuf_printf(sb,
+#if USB_HAVE_UGEN
+   ugen=%s 
cdev=%s 
+#endif
vendor=0x%04x 
product=0x%04x 
devclass=0x%02x 
@@ -2466,8 +2484,14 @@ usb_notify_addq(const char *type, struct
release=0x%04x 
mode=%s 
port=%u 
-   parent=%s,
+#if USB_HAVE_UGEN
+   parent=%s
+#endif
+   ,
+#if USB_HAVE_UGEN
+   udev-ugen_name,
udev-ugen_name,
+#endif
UGETW(udev-ddesc.idVendor),
UGETW(udev-ddesc.idProduct),
udev-ddesc.bDeviceClass,
@@ -2475,10 +2499,13 @@ usb_notify_addq(const char *type, struct
usb_get_serial(udev),
UGETW(udev-ddesc.bcdDevice),
(udev-flags.usb_mode == USB_MODE_HOST) ? host : device,
-   udev-port_no,
-   udev-parent_hub != NULL ?
-   udev-parent_hub-ugen_name :
-   device_get_nameunit(device_get_parent(udev-bus-bdev)));
+   udev-port_no
+#if USB_HAVE_UGEN
+   , udev-parent_hub != NULL ?
+   udev-parent_hub-ugen_name :
+   device_get_nameunit(device_get_parent(udev-bus-bdev))
+#endif
+   );
sbuf_finish(sb);
devctl_notify(USB, DEVICE, type, sbuf_data(sb));

svn commit: r221622 - head/sys/dev/ath/ath_hal

2011-05-08 Thread Adrian Chadd
Author: adrian
Date: Sun May  8 08:18:30 2011
New Revision: 221622
URL: http://svn.freebsd.org/changeset/base/221622

Log:
  These EEPROM bits actually defined whether HT/20 and HT/40 support
  for the given channel is available.
  
  It isn't used yet; ar5416GetWirelessModes() needs to be taught
  about this rather than assuming HT20/HT40 is available.

Modified:
  head/sys/dev/ath/ath_hal/ah_eeprom_v14.h

Modified: head/sys/dev/ath/ath_hal/ah_eeprom_v14.h
==
--- head/sys/dev/ath/ath_hal/ah_eeprom_v14.hSun May  8 08:17:16 2011
(r221621)
+++ head/sys/dev/ath/ath_hal/ah_eeprom_v14.hSun May  8 08:18:30 2011
(r221622)
@@ -95,10 +95,10 @@
 
 #defineAR5416_OPFLAGS_11A  0x01
 #defineAR5416_OPFLAGS_11G  0x02
-#defineAR5416_OPFLAGS_5G_HT40  0x04
-#defineAR5416_OPFLAGS_2G_HT40  0x08
-#defineAR5416_OPFLAGS_5G_HT20  0x10
-#defineAR5416_OPFLAGS_2G_HT20  0x20
+#defineAR5416_OPFLAGS_N_5G_HT400x04/* If set, disable 5G 
HT40 */
+#defineAR5416_OPFLAGS_N_2G_HT400x08
+#defineAR5416_OPFLAGS_N_5G_HT200x10
+#defineAR5416_OPFLAGS_N_2G_HT200x20
 
 /* RF silent fields in EEPROM */
 #defineEEP_RFSILENT_ENABLED0x0001  /* enabled/disabled */
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r221623 - head/sys/dev/usb

2011-05-08 Thread Hans Petter Selasky
Author: hselasky
Date: Sun May  8 08:22:11 2011
New Revision: 221623
URL: http://svn.freebsd.org/changeset/base/221623

Log:
  Cleanup usb_notify_addq_compat(). It should not
  be needed any more.
  
  MFC after:7 days

Modified:
  head/sys/dev/usb/usb_device.c

Modified: head/sys/dev/usb/usb_device.c
==
--- head/sys/dev/usb/usb_device.c   Sun May  8 08:18:30 2011
(r221622)
+++ head/sys/dev/usb/usb_device.c   Sun May  8 08:22:11 2011
(r221623)
@@ -2387,77 +2387,6 @@ usbd_get_device_index(struct usb_device 
 }
 
 #if USB_HAVE_DEVCTL
-/**
- * usb_notify_addq
- *
- * This function will generate events for dev.
- **/
-#ifndef BURN_BRIDGES
-static void
-usb_notify_addq_compat(const char *type, struct usb_device *udev)
-{
-   char *data = NULL;
-   const char *ntype;
-   struct malloc_type *mt;
-   const size_t buf_size = 512;
-
-   /* Convert notify type */
-   if (strcmp(type, ATTACH) == 0)
-   ntype = +;
-   else if (strcmp(type, DETACH) == 0)
-   ntype = -;
-   else
-   return;
-
-   mtx_lock(malloc_mtx);
-   mt = malloc_desc2type(bus);   /* XXX M_BUS */
-   mtx_unlock(malloc_mtx);
-   if (mt == NULL)
-   return;
-
-   data = malloc(buf_size, mt, M_NOWAIT);
-   if (data == NULL)
-   return;
-
-   /* String it all together. */
-   snprintf(data, buf_size,
-   %s
-#if USB_HAVE_UGEN
-   %s 
-#endif
-   at port=%u 
-   vendor=0x%04x 
-   product=0x%04x 
-   devclass=0x%02x 
-   devsubclass=0x%02x 
-   sernum=\%s\ 
-   release=0x%04x 
-#if USB_HAVE_UGEN
-   on %s\n
-#endif
-   ,
-   ntype,
-#if USB_HAVE_UGEN
-   udev-ugen_name,
-#endif
-   udev-port_no,
-   UGETW(udev-ddesc.idVendor),
-   UGETW(udev-ddesc.idProduct),
-   udev-ddesc.bDeviceClass,
-   udev-ddesc.bDeviceSubClass,
-   usb_get_serial(udev),
-   UGETW(udev-ddesc.bcdDevice)
-#if USB_HAVE_UGEN
-   , udev-parent_hub != NULL ?
-   udev-parent_hub-ugen_name :
-   device_get_nameunit(device_get_parent(udev-bus-bdev))
-#endif
-   );
-
-   devctl_queue_data(data);
-}
-#endif
-
 static void
 usb_notify_addq(const char *type, struct usb_device *udev)
 {
@@ -2465,10 +2394,6 @@ usb_notify_addq(const char *type, struct
struct sbuf *sb;
int i;
 
-#ifndef BURN_BRIDGES
-   usb_notify_addq_compat(type, udev);
-#endif
-
/* announce the device */
sb = sbuf_new_auto();
sbuf_printf(sb,
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r221624 - head/sys/geom/eli

2011-05-08 Thread Pawel Jakub Dawidek
Author: pjd
Date: Sun May  8 09:08:50 2011
New Revision: 221624
URL: http://svn.freebsd.org/changeset/base/221624

Log:
  Add magic field to the g_eli_key structure to detect if we are really
  operating on proper structures.
  
  MFC after:1 week

Modified:
  head/sys/geom/eli/g_eli_key_cache.c

Modified: head/sys/geom/eli/g_eli_key_cache.c
==
--- head/sys/geom/eli/g_eli_key_cache.c Sun May  8 08:22:11 2011
(r221623)
+++ head/sys/geom/eli/g_eli_key_cache.c Sun May  8 09:08:50 2011
(r221624)
@@ -57,9 +57,13 @@ static uint64_t g_eli_key_cache_misses;
 SYSCTL_UQUAD(_kern_geom_eli, OID_AUTO, key_cache_misses, CTLFLAG_RW,
 g_eli_key_cache_misses, 0, Key cache misses);
 
+#defineG_ELI_KEY_MAGIC 0xe11341c
+
 struct g_eli_key {
/* Key value, must be first in the structure. */
uint8_t gek_key[G_ELI_DATAKEYLEN];
+   /* Magic. */
+   int gek_magic;
/* Key number. */
uint64_tgek_keyno;
/* Reference counter. */
@@ -98,6 +102,7 @@ g_eli_key_fill(struct g_eli_softc *sc, s
sizeof(hmacdata), key-gek_key, 0);
key-gek_keyno = keyno;
key-gek_count = 0;
+   key-gek_magic = G_ELI_KEY_MAGIC;
 }
 
 static struct g_eli_key *
@@ -150,6 +155,7 @@ g_eli_key_replace(struct g_eli_softc *sc
 {
 
mtx_assert(sc-sc_ekeys_lock, MA_OWNED);
+   KASSERT(key-gek_magic == G_ELI_KEY_MAGIC, (Invalid magic.));
 
RB_REMOVE(g_eli_key_tree, sc-sc_ekeys_tree, key);
TAILQ_REMOVE(sc-sc_ekeys_queue, key, gek_next);
@@ -167,7 +173,7 @@ g_eli_key_remove(struct g_eli_softc *sc,
 {
 
mtx_assert(sc-sc_ekeys_lock, MA_OWNED);
-
+   KASSERT(key-gek_magic == G_ELI_KEY_MAGIC, (Invalid magic.));
KASSERT(key-gek_count == 0, (gek_count=%d, key-gek_count));
 
RB_REMOVE(g_eli_key_tree, sc-sc_ekeys_tree, key);
@@ -276,6 +282,8 @@ g_eli_key_hold(struct g_eli_softc *sc, o
/* We have all the keys, so avoid some overhead. */
key = RB_FIND(g_eli_key_tree, sc-sc_ekeys_tree, keysearch);
KASSERT(key != NULL, (No key %ju found., (uintmax_t)keyno));
+   KASSERT(key-gek_magic == G_ELI_KEY_MAGIC,
+   (Invalid key magic.));
return (key-gek_key);
}
 
@@ -306,6 +314,8 @@ g_eli_key_hold(struct g_eli_softc *sc, o
key-gek_count++;
mtx_unlock(sc-sc_ekeys_lock);
 
+   KASSERT(key-gek_magic == G_ELI_KEY_MAGIC, (Invalid key magic.));
+
return (key-gek_key);
 }
 
@@ -317,6 +327,8 @@ g_eli_key_drop(struct g_eli_softc *sc, u
if ((sc-sc_flags  G_ELI_FLAG_SINGLE_KEY) != 0)
return;
 
+   KASSERT(key-gek_magic == G_ELI_KEY_MAGIC, (Invalid key magic.));
+
if (sc-sc_ekeys_total == sc-sc_ekeys_allocated)
return;
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r221621 - stable/8/sys/dev/usb

2011-05-08 Thread Jason Hellenthal

Hans,

Was this intended. ? udev-ugen_name,

On Sun, May 08, 2011 at 08:17:17AM +, Hans Petter Selasky wrote: 
 Author: hselasky
 Date: Sun May  8 08:17:16 2011
 New Revision: 221621
 URL: http://svn.freebsd.org/changeset/base/221621
 

[...]

 +#if USB_HAVE_UGEN
 + parent=%s
 +#endif
 + ,
 +#if USB_HAVE_UGEN
 + udev-ugen_name,
   udev-ugen_name,
 +#endif

[...]

 +#if USB_HAVE_UGEN
   udev-ugen_name,
 + udev-ugen_name,
 +#endif

-- 

 Regards, (jhell)
 Jason Hellenthal



pgpbJcH3HKoNL.pgp
Description: PGP signature


svn commit: r221625 - head/sys/geom/eli

2011-05-08 Thread Pawel Jakub Dawidek
Author: pjd
Date: Sun May  8 09:09:49 2011
New Revision: 221625
URL: http://svn.freebsd.org/changeset/base/221625

Log:
  Drop proper key.
  
  MFC after:1 week

Modified:
  head/sys/geom/eli/g_eli_integrity.c

Modified: head/sys/geom/eli/g_eli_integrity.c
==
--- head/sys/geom/eli/g_eli_integrity.c Sun May  8 09:08:50 2011
(r221624)
+++ head/sys/geom/eli/g_eli_integrity.c Sun May  8 09:09:49 2011
(r221625)
@@ -149,7 +149,7 @@ g_eli_auth_read_done(struct cryptop *crp
bp-bio_error = crp-crp_etype;
}
sc = bp-bio_to-geom-softc;
-   g_eli_key_drop(sc, crp-crp_desc-crd_key);
+   g_eli_key_drop(sc, crp-crp_desc-crd_next-crd_key);
/*
 * Do we have all sectors already?
 */
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r221626 - head/sys/geom/eli

2011-05-08 Thread Pawel Jakub Dawidek
Author: pjd
Date: Sun May  8 09:11:04 2011
New Revision: 221626
URL: http://svn.freebsd.org/changeset/base/221626

Log:
  Remove prototype for a function that no longer exist.
  
  MFC after:1 week

Modified:
  head/sys/geom/eli/g_eli.h

Modified: head/sys/geom/eli/g_eli.h
==
--- head/sys/geom/eli/g_eli.h   Sun May  8 09:09:49 2011(r221625)
+++ head/sys/geom/eli/g_eli.h   Sun May  8 09:11:04 2011(r221626)
@@ -509,8 +509,6 @@ void g_eli_config(struct gctl_req *req, 
 void g_eli_read_done(struct bio *bp);
 void g_eli_write_done(struct bio *bp);
 int g_eli_crypto_rerun(struct cryptop *crp);
-uint8_t *g_eli_crypto_key(struct g_eli_softc *sc, off_t offset,
-size_t blocksize);
 void g_eli_crypto_ivgen(struct g_eli_softc *sc, off_t offset, u_char *iv,
 size_t size);
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r221627 - head/sys/netinet

2011-05-08 Thread Michael Tuexen
Author: tuexen
Date: Sun May  8 09:11:59 2011
New Revision: 221627
URL: http://svn.freebsd.org/changeset/base/221627

Log:
  Fix a locking issue showing up on Mac OS X when subscribing to
  authentication events. DTLS/SCTP renegotiations trigger the bug.
  
  MFC after: 2 weeks.

Modified:
  head/sys/netinet/sctp_auth.c
  head/sys/netinet/sctp_auth.h
  head/sys/netinet/sctp_indata.c
  head/sys/netinet/sctp_input.c
  head/sys/netinet/sctp_input.h
  head/sys/netinet/sctp_output.c
  head/sys/netinet/sctp_output.h
  head/sys/netinet/sctp_pcb.c
  head/sys/netinet/sctp_timer.c
  head/sys/netinet/sctp_usrreq.c
  head/sys/netinet/sctp_var.h
  head/sys/netinet/sctputil.c

Modified: head/sys/netinet/sctp_auth.c
==
--- head/sys/netinet/sctp_auth.cSun May  8 09:11:04 2011
(r221626)
+++ head/sys/netinet/sctp_auth.cSun May  8 09:11:59 2011
(r221627)
@@ -598,7 +598,11 @@ sctp_auth_key_acquire(struct sctp_tcb *s
 }
 
 void
-sctp_auth_key_release(struct sctp_tcb *stcb, uint16_t key_id)
+sctp_auth_key_release(struct sctp_tcb *stcb, uint16_t key_id, int so_locked
+#if !defined(__APPLE__)  !defined(SCTP_SO_LOCK_TESTING)
+SCTP_UNUSED
+#endif
+)
 {
sctp_sharedkey_t *skey;
 
@@ -616,7 +620,7 @@ sctp_auth_key_release(struct sctp_tcb *s
if ((skey-refcount = 1)  (skey-deactivated)) {
/* notify ULP that key is no longer used */
sctp_ulp_notify(SCTP_NOTIFY_AUTH_FREE_KEY, stcb,
-   key_id, 0, SCTP_SO_LOCKED);
+   key_id, 0, so_locked);
SCTPDBG(SCTP_DEBUG_AUTH2,
%s: stcb %p key %u no longer used, %d\n,
__FUNCTION__, stcb, key_id, skey-refcount);

Modified: head/sys/netinet/sctp_auth.h
==
--- head/sys/netinet/sctp_auth.hSun May  8 09:11:04 2011
(r221626)
+++ head/sys/netinet/sctp_auth.hSun May  8 09:11:59 2011
(r221627)
@@ -156,7 +156,9 @@ sctp_copy_skeylist(const struct sctp_key
 
 /* ref counts on shared keys, by key id */
 extern void sctp_auth_key_acquire(struct sctp_tcb *stcb, uint16_t keyid);
-extern void sctp_auth_key_release(struct sctp_tcb *stcb, uint16_t keyid);
+extern void 
+sctp_auth_key_release(struct sctp_tcb *stcb, uint16_t keyid,
+int so_locked);
 
 
 /* hmac list handling */

Modified: head/sys/netinet/sctp_indata.c
==
--- head/sys/netinet/sctp_indata.c  Sun May  8 09:11:04 2011
(r221626)
+++ head/sys/netinet/sctp_indata.c  Sun May  8 09:11:59 2011
(r221627)
@@ -375,7 +375,7 @@ abandon:
chk-data = NULL;
}
/* Now free the address and data */
-   sctp_free_a_chunk(stcb, chk);
+   sctp_free_a_chunk(stcb, chk, SCTP_SO_NOT_LOCKED);
/* sa_ignore FREED_MEMORY */
}
return;
@@ -479,7 +479,7 @@ abandon:
sctp_ucount_decr(asoc-cnt_on_reasm_queue);
/* free up the chk */
chk-data = NULL;
-   sctp_free_a_chunk(stcb, chk);
+   sctp_free_a_chunk(stcb, chk, SCTP_SO_NOT_LOCKED);
 
if (asoc-fragmented_delivery_inprogress == 0) {
/*
@@ -1011,7 +1011,7 @@ sctp_queue_data_for_reasm(struct sctp_tc
sctp_m_freem(chk-data);
chk-data = NULL;
}
-   sctp_free_a_chunk(stcb, chk);
+   sctp_free_a_chunk(stcb, chk, SCTP_SO_NOT_LOCKED);
return;
} else {
last_flags = at-rec.data.rcv_flags;
@@ -2416,7 +2416,7 @@ sctp_sack_check(struct sctp_tcb *stcb, i
stcb-sctp_ep, stcb, NULL, SCTP_FROM_SCTP_INDATA + 
SCTP_LOC_18);
}
sctp_send_shutdown(stcb, stcb-asoc.primary_destination);
-   sctp_send_sack(stcb);
+   sctp_send_sack(stcb, SCTP_SO_NOT_LOCKED);
} else {
int is_a_gap;
 
@@ -2466,7 +2466,7 @@ sctp_sack_check(struct sctp_tcb *stcb, i
 * there are gaps or duplicates.
 */

(void)SCTP_OS_TIMER_STOP(stcb-asoc.dack_timer.timer);
-   sctp_send_sack(stcb);
+   sctp_send_sack(stcb, SCTP_SO_NOT_LOCKED);
}
} else {
if 
(!SCTP_OS_TIMER_PENDING(stcb-asoc.dack_timer.timer)) {
@@ -3993,7 +3993,7 @@ sctp_express_handle_sack(struct sctp_tcb
   

svn commit: r221628 - head/sys/geom/eli

2011-05-08 Thread Pawel Jakub Dawidek
Author: pjd
Date: Sun May  8 09:17:56 2011
New Revision: 221628
URL: http://svn.freebsd.org/changeset/base/221628

Log:
  When support for multiple encryption keys was committed, GELI integrity mode
  was not updated to pass CRD_F_KEY_EXPLICIT flag to opencrypto. This resulted 
in
  always using first key.
  
  We need to support providers created with this bug, so set special
  G_ELI_FLAG_FIRST_KEY flag for GELI provider in integrity mode with version
  smaller than 6 and pass the CRD_F_KEY_EXPLICIT flag to opencrypto only if
  G_ELI_FLAG_FIRST_KEY doesn't exist.
  
  Reported by:  Anton Yuzhaninov cit...@citrin.ru
  MFC after:1 week

Modified:
  head/sys/geom/eli/g_eli.c
  head/sys/geom/eli/g_eli.h
  head/sys/geom/eli/g_eli_integrity.c

Modified: head/sys/geom/eli/g_eli.c
==
--- head/sys/geom/eli/g_eli.c   Sun May  8 09:11:59 2011(r221627)
+++ head/sys/geom/eli/g_eli.c   Sun May  8 09:17:56 2011(r221628)
@@ -329,7 +329,12 @@ g_eli_newsession(struct g_eli_worker *wr
crie.cri_klen = sc-sc_ekeylen;
if (sc-sc_ealgo == CRYPTO_AES_XTS)
crie.cri_klen = 1;
-   crie.cri_key = sc-sc_ekey;
+   if ((sc-sc_flags  G_ELI_FLAG_FIRST_KEY) != 0) {
+   crie.cri_key = g_eli_key_hold(sc, 0,
+   LIST_FIRST(sc-sc_geom-consumer)-provider-sectorsize);
+   } else {
+   crie.cri_key = sc-sc_ekey;
+   }
if (sc-sc_flags  G_ELI_FLAG_AUTH) {
bzero(cria, sizeof(cria));
cria.cri_alg = sc-sc_aalgo;
@@ -368,6 +373,9 @@ g_eli_newsession(struct g_eli_worker *wr
panic(%s: invalid condition, __func__);
}
 
+   if ((sc-sc_flags  G_ELI_FLAG_FIRST_KEY) != 0)
+   g_eli_key_drop(sc, crie.cri_key);
+
return (error);
 }
 
@@ -708,6 +716,8 @@ g_eli_create(struct gctl_req *req, struc
sc-sc_flags |= G_ELI_FLAG_NATIVE_BYTE_ORDER;
if (md-md_version  5)
sc-sc_flags |= G_ELI_FLAG_SINGLE_KEY;
+   if (md-md_version  6  (sc-sc_flags  G_ELI_FLAG_AUTH) != 0)
+   sc-sc_flags |= G_ELI_FLAG_FIRST_KEY;
sc-sc_ealgo = md-md_ealgo;
sc-sc_nkey = nkey;
 

Modified: head/sys/geom/eli/g_eli.h
==
--- head/sys/geom/eli/g_eli.h   Sun May  8 09:11:59 2011(r221627)
+++ head/sys/geom/eli/g_eli.h   Sun May  8 09:17:56 2011(r221628)
@@ -63,10 +63,19 @@
  * 2 - Added G_ELI_FLAG_READONLY.
  * 3 - Added 'configure' subcommand.
  * 4 - IV is generated from offset converted to little-endian
- * (flag G_ELI_FLAG_NATIVE_BYTE_ORDER will be set for older versions).
+ * (the G_ELI_FLAG_NATIVE_BYTE_ORDER flag will be set for older versions).
  * 5 - Added multiple encrypton keys and AES-XTS support.
+ * 6 - Fixed usage of multiple keys for authenticated providers (the
+ * G_ELI_FLAG_FIRST_KEY flag will be set for older versions).
  */
-#defineG_ELI_VERSION   5
+#defineG_ELI_VERSION_000
+#defineG_ELI_VERSION_011
+#defineG_ELI_VERSION_022
+#defineG_ELI_VERSION_033
+#defineG_ELI_VERSION_044
+#defineG_ELI_VERSION_055
+#defineG_ELI_VERSION_066
+#defineG_ELI_VERSION   G_ELI_VERSION_06
 
 /* ON DISK FLAGS. */
 /* Use random, onetime keys. */
@@ -92,6 +101,8 @@
 #defineG_ELI_FLAG_SINGLE_KEY   0x0008
 /* Device suspended. */
 #defineG_ELI_FLAG_SUSPEND  0x0010
+/* Provider uses first encryption key. */
+#defineG_ELI_FLAG_FIRST_KEY0x0020
 
 #defineG_ELI_NEW_BIO   255
 

Modified: head/sys/geom/eli/g_eli_integrity.c
==
--- head/sys/geom/eli/g_eli_integrity.c Sun May  8 09:11:59 2011
(r221627)
+++ head/sys/geom/eli/g_eli_integrity.c Sun May  8 09:17:56 2011
(r221628)
@@ -513,6 +513,8 @@ g_eli_auth_run(struct g_eli_worker *wr, 
crde-crd_skip = sc-sc_alen;
crde-crd_len = data_secsize;
crde-crd_flags = CRD_F_IV_EXPLICIT | CRD_F_IV_PRESENT;
+   if ((sc-sc_flags  G_ELI_FLAG_FIRST_KEY) == 0)
+   crde-crd_flags |= CRD_F_KEY_EXPLICIT;
if (bp-bio_cmd == BIO_WRITE)
crde-crd_flags |= CRD_F_ENCRYPT;
crde-crd_alg = sc-sc_ealgo;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r221629 - head/sys/geom/eli

2011-05-08 Thread Pawel Jakub Dawidek
Author: pjd
Date: Sun May  8 09:25:16 2011
New Revision: 221629
URL: http://svn.freebsd.org/changeset/base/221629

Log:
  Detect and handle metadata of version 6.
  
  MFC after:1 week

Modified:
  head/sys/geom/eli/g_eli.h

Modified: head/sys/geom/eli/g_eli.h
==
--- head/sys/geom/eli/g_eli.h   Sun May  8 09:17:56 2011(r221628)
+++ head/sys/geom/eli/g_eli.h   Sun May  8 09:25:16 2011(r221629)
@@ -265,7 +265,7 @@ eli_metadata_decode_v0(const u_char *dat
 }
 
 static __inline int
-eli_metadata_decode_v1v2v3v4v5(const u_char *data, struct g_eli_metadata *md)
+eli_metadata_decode_v1v2v3v4v5v6(const u_char *data, struct g_eli_metadata *md)
 {
MD5_CTX ctx;
const u_char *p;
@@ -296,15 +296,16 @@ eli_metadata_decode(const u_char *data, 
bcopy(data, md-md_magic, sizeof(md-md_magic));
md-md_version = le32dec(data + sizeof(md-md_magic));
switch (md-md_version) {
-   case 0:
+   case G_ELI_VERSION_00:
error = eli_metadata_decode_v0(data, md);
break;
-   case 1:
-   case 2:
-   case 3:
-   case 4:
-   case 5:
-   error = eli_metadata_decode_v1v2v3v4v5(data, md);
+   case G_ELI_VERSION_01:
+   case G_ELI_VERSION_02:
+   case G_ELI_VERSION_03:
+   case G_ELI_VERSION_04:
+   case G_ELI_VERSION_05:
+   case G_ELI_VERSION_06:
+   error = eli_metadata_decode_v1v2v3v4v5v6(data, md);
break;
default:
error = EINVAL;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r221630 - head/sys/geom/eli

2011-05-08 Thread Pawel Jakub Dawidek
Author: pjd
Date: Sun May  8 09:25:54 2011
New Revision: 221630
URL: http://svn.freebsd.org/changeset/base/221630

Log:
  Version 6 is compatible with version 5 when it comes to control commands.
  
  MFC after:1 week

Modified:
  head/sys/geom/eli/g_eli_ctl.c

Modified: head/sys/geom/eli/g_eli_ctl.c
==
--- head/sys/geom/eli/g_eli_ctl.c   Sun May  8 09:25:16 2011
(r221629)
+++ head/sys/geom/eli/g_eli_ctl.c   Sun May  8 09:25:54 2011
(r221630)
@@ -1014,7 +1014,12 @@ g_eli_config(struct gctl_req *req, struc
gctl_error(req, No '%s' argument., version);
return;
}
-   if (*version != G_ELI_VERSION) {
+   while (*version != G_ELI_VERSION) {
+   if (G_ELI_VERSION == G_ELI_VERSION_06 
+   *version == G_ELI_VERSION_05) {
+   /* Compatible. */
+   break;
+   }
gctl_error(req, Userland and kernel parts are out of sync.);
return;
}
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r221631 - head/sys/geom/eli

2011-05-08 Thread Pawel Jakub Dawidek
Author: pjd
Date: Sun May  8 09:29:21 2011
New Revision: 221631
URL: http://svn.freebsd.org/changeset/base/221631

Log:
  Export GELI class version via sysctl kern.geom.eli.version.
  
  MFC after:1 week

Modified:
  head/sys/geom/eli/g_eli.c

Modified: head/sys/geom/eli/g_eli.c
==
--- head/sys/geom/eli/g_eli.c   Sun May  8 09:25:54 2011(r221630)
+++ head/sys/geom/eli/g_eli.c   Sun May  8 09:29:21 2011(r221631)
@@ -57,6 +57,9 @@ MALLOC_DEFINE(M_ELI, eli data, GEOM_E
 
 SYSCTL_DECL(_kern_geom);
 SYSCTL_NODE(_kern_geom, OID_AUTO, eli, CTLFLAG_RW, 0, GEOM_ELI stuff);
+static int g_eli_version = G_ELI_VERSION;
+SYSCTL_INT(_kern_geom_eli, OID_AUTO, version, CTLFLAG_RD, g_eli_version, 0,
+GELI version);
 int g_eli_debug = 0;
 TUNABLE_INT(kern.geom.eli.debug, g_eli_debug);
 SYSCTL_INT(_kern_geom_eli, OID_AUTO, debug, CTLFLAG_RW, g_eli_debug, 0,
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r221632 - head/sbin/hastd

2011-05-08 Thread Mikolaj Golub
Author: trociny
Date: Sun May  8 09:31:17 2011
New Revision: 221632
URL: http://svn.freebsd.org/changeset/base/221632

Log:
  Fix isitme(), which is used to check if node-specific configuration
  belongs to our node, and was returning false positive if the first
  part of a node name matches short hostname.
  
  Approved by:  pjd (mentor)

Modified:
  head/sbin/hastd/parse.y

Modified: head/sbin/hastd/parse.y
==
--- head/sbin/hastd/parse.y Sun May  8 09:29:21 2011(r221631)
+++ head/sbin/hastd/parse.y Sun May  8 09:31:17 2011(r221632)
@@ -92,8 +92,10 @@ isitme(const char *name)
 * Now check if it matches first part of the host name.
 */
pos = strchr(buf, '.');
-   if (pos != NULL  pos != buf  strncmp(buf, name, pos - buf) == 0)
+   if (pos != NULL  (size_t)(pos - buf) == strlen(name) 
+   strncmp(buf, name, pos - buf) == 0) {
return (1);
+   }
 
/*
 * At the end check if name is equal to our host's UUID.
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r221621 - stable/8/sys/dev/usb

2011-05-08 Thread Hans Petter Selasky
On Sunday 08 May 2011 10:45:37 Jason Hellenthal wrote:
 Hans,
 
 Was this intended. ? udev-ugen_name,
 

No, we added a second variable, ugen=ugenX.Y. That's why it is listed twice. I 
think if ugen_name is NULL, the print statement will not panic.

Thanks for your comment!

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


svn commit: r221633 - head/sbin/geom/class/eli

2011-05-08 Thread Pawel Jakub Dawidek
Author: pjd
Date: Sun May  8 09:46:09 2011
New Revision: 221633
URL: http://svn.freebsd.org/changeset/base/221633

Log:
  Document the following sysctls:
  
  kern.geom.eli.version
  kern.geom.eli.key_cache_limit
  kern.geom.eli.key_cache_hits
  kern.geom.eli.key_cache_misses
  
  MFC after:1 week

Modified:
  head/sbin/geom/class/eli/geli.8

Modified: head/sbin/geom/class/eli/geli.8
==
--- head/sbin/geom/class/eli/geli.8 Sun May  8 09:31:17 2011
(r221632)
+++ head/sbin/geom/class/eli/geli.8 Sun May  8 09:46:09 2011
(r221633)
@@ -1,4 +1,4 @@
-.\ Copyright (c) 2005-2010 Pawel Jakub Dawidek p...@freebsd.org
+.\ Copyright (c) 2005-2011 Pawel Jakub Dawidek pa...@dawidek.net
 .\ All rights reserved.
 .\
 .\ Redistribution and use in source and binary forms, with or without
@@ -627,9 +627,13 @@ variables can be used to control the beh
 .Nm ELI
 GEOM class.
 The default value is shown next to each variable.
-All variables can also be set in
+Some variables can also be set in
 .Pa /boot/loader.conf .
 .Bl -tag -width indent
+.It Va kern.geom.eli.version
+Version number of the
+.Nm ELI
+GEOM class.
 .It Va kern.geom.eli.debug : No 0
 Debug level of the
 .Nm ELI
@@ -668,6 +672,22 @@ When set to 1, can speed-up crypto opera
 Batching allows to reduce number of interrupts by responding on a group of
 crypto requests with one interrupt.
 The crypto card and the driver has to support this feature.
+.It Va kern.geom.eli.key_cache_limit : No 8192
+Specifies how many encryption keys to cache.
+The default limit
+.No ( 8192
+keys) will allow to cache all keys for 4TB provider with 512 bytes sectors and
+will take around 1MB of memory.
+.It Va kern.geom.eli.key_cache_hits
+Reports how many times we were looking up a key and it was already in cache.
+This sysctl is not updated for providers that need less keys than the limit
+specified in
+.Va kern.geom.eli.key_cache_limit .
+.It Va kern.geom.eli.key_cache_misses
+Reports how many times we were looking up a key and it was not in cache.
+This sysctl is not updated for providers that need less keys than the limit
+specified in
+.Va kern.geom.eli.key_cache_limit .
 .El
 .Sh EXIT STATUS
 Exit status is 0 on success, and 1 if the command fails.
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r221604 - head/usr.sbin/usbdump

2011-05-08 Thread Bruce Evans

On Sat, 7 May 2011, Garrett Cooper wrote:


On Sat, May 7, 2011 at 10:13 AM,  m...@freebsd.org wrote:

On Sat, May 7, 2011 at 9:36 AM, Hans Petter Selasky hsela...@c2i.net wrote:

On Saturday 07 May 2011 18:28:24 Hans Petter Selasky wrote:

? - Use memcpy() instead of bcopy().


- Use memset() instead of bzero().


Why? ?It usually falls through to the same code in libc. ?Is there
some standardization on memfoo versus bfoo here?


As part of adding lots of style bugs I suppose.


   bfoo is marked legacy per POSIX 2001.1; example:
http://pubs.opengroup.org/onlinepubs/009695399/functions/bcopy.html .


bfoo was correctly left out of POSIX.1-1988.  However, POSIX.1-2001 brought
back lots of historical cruft 13 years after POSIX.1-1988 deprecated it by
not having it at all.  However2, the bcopy family is not historical cruft
in BSD.


A lot of folks (Linux leading the charge) are actively working to
deprecate the APIs.


Another reason to not deprecate it in BSD :-).

bzero() is technically better than memset() since it doesn't waste
space or time for an extra arg.  bcmp() is technically better than
memcmp() for the usual case where you only want a binary result.  The
other bcopy functions are just different spellings of the newer
interfaces.

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

Re: svn commit: r221604 - head/usr.sbin/usbdump

2011-05-08 Thread Bruce Evans

On Sat, 7 May 2011, Hans Petter Selasky wrote:


On Saturday 07 May 2011 19:13:27 m...@freebsd.org wrote:

On Sat, May 7, 2011 at 9:36 AM, Hans Petter Selasky hsela...@c2i.net

wrote:

On Saturday 07 May 2011 18:28:24 Hans Petter Selasky wrote:

  - Use memcpy() instead of bcopy().


- Use memset() instead of bzero().


Why?  It usually falls through to the same code in libc.  Is there
some standardization on memfoo versus bfoo here?


I thought that memset() was a compiler builtin and bzero() optimised for
larger amounts of data?


In the kernel, compiler builtins aren't used, memset() is slightly
pessimized, and bzero() is not optimized (except in old versions of
FreeBSD on i386, attempts were made to optimize bzero() for large data
at a tiny cost to small data).  A better implementation would use the
compiler builtin for both.  My version does this, but the gains (or
losses) from using builtins for this and other things in the kernel
insignificant.  Here it is for bzero():

#define bzero(p, n) ({  \
if (__builtin_constant_p(n)  (n) = 32)\
__builtin_memset((p), 0, (n));  \
else\
(bzero)((p), (n));  \
})

This hard-codes the limit of 32 for the builtin since some versions of
gcc use a worse limit.

In userland, on at least amd64 and i386, the extern bzero() and memset()
are unoptimized, but the compiler builtin is used for memset() only.  A
better implementation of bzero() would use the compiler builtin for it
too.  The above is not good enough for libc, since it evaluates args more
than once and has a hard-coded gccism.

The correct optimizations for bzero() etc. are very machine-dependent
and context-dependent and are far too hard for anyone or the compiler
or the CPU to get right (but I believe newer Intel CPUs are closer to
making unoptimized stosb as fast as possible).  Context-dependent parts
include whether the data should go through cache(s) (it shouldn't iff
it won't be used soon and the memory system is such that not going
through caches is either faster or saves time later).

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


svn commit: r221634 - head/sys/dev/iwn

2011-05-08 Thread Bernhard Schmidt
Author: bschmidt
Date: Sun May  8 10:19:29 2011
New Revision: 221634
URL: http://svn.freebsd.org/changeset/base/221634

Log:
  Re-add 2 device IDs which got lost.
  
  Pointed out by:   benjsc

Modified:
  head/sys/dev/iwn/if_iwn.c

Modified: head/sys/dev/iwn/if_iwn.c
==
--- head/sys/dev/iwn/if_iwn.c   Sun May  8 09:46:09 2011(r221633)
+++ head/sys/dev/iwn/if_iwn.c   Sun May  8 10:19:29 2011(r221634)
@@ -92,8 +92,10 @@ static const struct iwn_ident iwn_ident_
{ 0x8086, 0x4229, Intel(R) Wireless WiFi Link 4965 },
{ 0x8086, 0x422b, Intel(R) Centrino(R) Ultimate-N 6300 },
{ 0x8086, 0x422c, Intel(R) Centrino(R) Advanced-N 6200 },
+   { 0x8086, 0x422d, Intel(R) Wireless WiFi Link 4965 },
{ 0x8086, 0x4230, Intel(R) Wireless WiFi Link 4965 },
{ 0x8086, 0x4232, Intel(R) WiFi Link 5100  },
+   { 0x8086, 0x4233, Intel(R) Wireless WiFi Link 4965 },
{ 0x8086, 0x4235, Intel(R) Ultimate N WiFi Link 5300   },
{ 0x8086, 0x4236, Intel(R) Ultimate N WiFi Link 5300   },
{ 0x8086, 0x4237, Intel(R) WiFi Link 5100  },
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r221635 - head/sys/dev/iwn

2011-05-08 Thread Bernhard Schmidt
Author: bschmidt
Date: Sun May  8 10:21:42 2011
New Revision: 221635
URL: http://svn.freebsd.org/changeset/base/221635

Log:
  The 6000 series adapters have a slightly different offset for band 6,
  2GHz HT40 channels.

Modified:
  head/sys/dev/iwn/if_iwn.c
  head/sys/dev/iwn/if_iwnreg.h

Modified: head/sys/dev/iwn/if_iwn.c
==
--- head/sys/dev/iwn/if_iwn.c   Sun May  8 10:19:29 2011(r221634)
+++ head/sys/dev/iwn/if_iwn.c   Sun May  8 10:21:42 2011(r221635)
@@ -1784,7 +1784,10 @@ iwn5000_read_eeprom(struct iwn_softc *sc
 
/* Read the list of authorized channels (20MHz ones only). */
for (i = 0; i  5; i++) {
-   addr = base + iwn5000_regulatory_bands[i];
+   if (sc-hw_type = IWN_HW_REV_TYPE_6000)
+   addr = base + iwn6000_regulatory_bands[i];
+   else
+   addr = base + iwn5000_regulatory_bands[i];
iwn_read_eeprom_channels(sc, i, addr);
}
 

Modified: head/sys/dev/iwn/if_iwnreg.h
==
--- head/sys/dev/iwn/if_iwnreg.hSun May  8 10:19:29 2011
(r221634)
+++ head/sys/dev/iwn/if_iwnreg.hSun May  8 10:21:42 2011
(r221635)
@@ -1403,6 +1403,7 @@ struct iwn_fw_tlv {
 #define IWN5000_EEPROM_BAND4   0x02e
 #define IWN5000_EEPROM_BAND5   0x03a
 #define IWN5000_EEPROM_BAND6   0x041
+#define IWN6000_EEPROM_BAND6   0x040
 #define IWN5000_EEPROM_BAND7   0x049
 #define IWN6000_EEPROM_ENHINFO 0x054
 #define IWN5000_EEPROM_CRYSTAL 0x128
@@ -1486,6 +1487,16 @@ static const uint32_t iwn5000_regulatory
IWN5000_EEPROM_BAND7
 };
 
+static const uint32_t iwn6000_regulatory_bands[IWN_NBANDS] = {
+   IWN5000_EEPROM_BAND1,
+   IWN5000_EEPROM_BAND2,
+   IWN5000_EEPROM_BAND3,
+   IWN5000_EEPROM_BAND4,
+   IWN5000_EEPROM_BAND5,
+   IWN6000_EEPROM_BAND6,
+   IWN5000_EEPROM_BAND7
+};
+
 #define IWN_CHAN_BANDS_COUNT7
 #define IWN_MAX_CHAN_PER_BAND  14
 static const struct iwn_chan_band {
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r221636 - head/sys/dev/iwn

2011-05-08 Thread Bernhard Schmidt
Author: bschmidt
Date: Sun May  8 10:31:22 2011
New Revision: 221636
URL: http://svn.freebsd.org/changeset/base/221636

Log:
  Hook HT channel setup.

Modified:
  head/sys/dev/iwn/if_iwn.c

Modified: head/sys/dev/iwn/if_iwn.c
==
--- head/sys/dev/iwn/if_iwn.c   Sun May  8 10:21:42 2011(r221635)
+++ head/sys/dev/iwn/if_iwn.c   Sun May  8 10:31:22 2011(r221636)
@@ -154,9 +154,7 @@ static void iwn4965_print_power_group(st
 static voidiwn5000_read_eeprom(struct iwn_softc *);
 static uint32_tiwn_eeprom_channel_flags(struct iwn_eeprom_chan *);
 static voidiwn_read_eeprom_band(struct iwn_softc *, int);
-#if 0  /* HT */
 static voidiwn_read_eeprom_ht40(struct iwn_softc *, int);
-#endif
 static voidiwn_read_eeprom_channels(struct iwn_softc *, int, uint32_t);
 static struct iwn_eeprom_chan *iwn_find_eeprom_channel(struct iwn_softc *,
struct ieee80211_channel *);
@@ -1696,7 +1694,7 @@ iwn4965_read_eeprom(struct iwn_softc *sc
iwn_read_prom_data(sc, IWN4965_EEPROM_DOMAIN, sc-eeprom_domain, 4);
 
/* Read the list of authorized channels (20MHz ones only). */
-   for (i = 0; i  5; i++) {
+   for (i = 0; i  7; i++) {
addr = iwn4965_regulatory_bands[i];
iwn_read_eeprom_channels(sc, i, addr);
}
@@ -1783,7 +1781,7 @@ iwn5000_read_eeprom(struct iwn_softc *sc
sc-eeprom_domain, 4);
 
/* Read the list of authorized channels (20MHz ones only). */
-   for (i = 0; i  5; i++) {
+   for (i = 0; i  7; i++) {
if (sc-hw_type = IWN_HW_REV_TYPE_6000)
addr = base + iwn6000_regulatory_bands[i];
else
@@ -1889,18 +1887,15 @@ iwn_read_eeprom_band(struct iwn_softc *s
add chan %d flags 0x%x maxpwr %d\n, chan,
channels[i].flags, channels[i].maxpwr);
 
-#if 0  /* HT */
-   /* XXX no constraints on using HT20 */
-   /* add HT20, HT40 added separately */
-   c = ic-ic_channels[ic-ic_nchans++];
-   c[0] = c[-1];
-   c-ic_flags |= IEEE80211_CHAN_HT20;
-   /* XXX NARROW ='s 1/2 and 1/4 width? */
-#endif
+   if (sc-sc_flags  IWN_FLAG_HAS_11N) {
+   /* add HT20, HT40 added separately */
+   c = ic-ic_channels[ic-ic_nchans++];
+   c[0] = c[-1];
+   c-ic_flags |= IEEE80211_CHAN_HT20;
+   }
}
 }
 
-#if 0  /* HT */
 static void
 iwn_read_eeprom_ht40(struct iwn_softc *sc, int n)
 {
@@ -1909,55 +1904,59 @@ iwn_read_eeprom_ht40(struct iwn_softc *s
struct iwn_eeprom_chan *channels = sc-eeprom_channels[n];
const struct iwn_chan_band *band = iwn_bands[n];
struct ieee80211_channel *c, *cent, *extc;
-   int i;
+   uint8_t chan;
+   int i, nflags;
+
+   if (!(sc-sc_flags  IWN_FLAG_HAS_11N))
+   return;
 
for (i = 0; i  band-nchan; i++) {
-   if (!(channels[i].flags  IWN_EEPROM_CHAN_VALID) ||
-   !(channels[i].flags  IWN_EEPROM_CHAN_WIDE)) {
+   if (!(channels[i].flags  IWN_EEPROM_CHAN_VALID)) {
DPRINTF(sc, IWN_DEBUG_RESET,
skip chan %d flags 0x%x maxpwr %d\n,
band-chan[i], channels[i].flags,
channels[i].maxpwr);
continue;
}
+   chan = band-chan[i];
+   nflags = iwn_eeprom_channel_flags(channels[i]);
+
/*
 * Each entry defines an HT40 channel pair; find the
 * center channel, then the extension channel above.
 */
-   cent = ieee80211_find_channel_byieee(ic, band-chan[i],
-   band-flags  ~IEEE80211_CHAN_HT);
+   cent = ieee80211_find_channel_byieee(ic, chan,
+   (n == 5 ? IEEE80211_CHAN_G : IEEE80211_CHAN_A));
if (cent == NULL) { /* XXX shouldn't happen */
device_printf(sc-sc_dev,
-   %s: no entry for channel %d\n,
-   __func__, band-chan[i]);
+   %s: no entry for channel %d\n, __func__, chan);
continue;
}
extc = ieee80211_find_channel(ic, cent-ic_freq+20,
-   band-flags  ~IEEE80211_CHAN_HT);
+   (n == 5 ? IEEE80211_CHAN_G : IEEE80211_CHAN_A));
if (extc == NULL) {
DPRINTF(sc, IWN_DEBUG_RESET,
-   skip chan %d, extension channel not found\n,
-   band-chan[i]);
+   %s: skip chan %d, extension channel not found\n,
+   __func__, chan);
   

svn commit: r221637 - head/sys/dev/iwn

2011-05-08 Thread Bernhard Schmidt
Author: bschmidt
Date: Sun May  8 10:35:16 2011
New Revision: 221637
URL: http://svn.freebsd.org/changeset/base/221637

Log:
  Use the enhanced TX power information availabe on newer EEPROMs.

Modified:
  head/sys/dev/iwn/if_iwn.c
  head/sys/dev/iwn/if_iwnreg.h
  head/sys/dev/iwn/if_iwnvar.h

Modified: head/sys/dev/iwn/if_iwn.c
==
--- head/sys/dev/iwn/if_iwn.c   Sun May  8 10:31:22 2011(r221636)
+++ head/sys/dev/iwn/if_iwn.c   Sun May  8 10:35:16 2011(r221637)
@@ -2033,18 +2033,22 @@ static void
 iwn_read_eeprom_enhinfo(struct iwn_softc *sc)
 {
struct iwn_eeprom_enhinfo enhinfo[35];
+   struct ifnet *ifp = sc-sc_ifp;
+   struct ieee80211com *ic = ifp-if_l2com;
+   struct ieee80211_channel *c;
uint16_t val, base;
int8_t maxpwr;
-   int i;
+   uint8_t flags;
+   int i, j;
 
iwn_read_prom_data(sc, IWN5000_EEPROM_REG, val, 2);
base = le16toh(val);
iwn_read_prom_data(sc, base + IWN6000_EEPROM_ENHINFO,
enhinfo, sizeof enhinfo);
 
-   memset(sc-enh_maxpwr, 0, sizeof sc-enh_maxpwr);
for (i = 0; i  nitems(enhinfo); i++) {
-   if (enhinfo[i].chan == 0 || enhinfo[i].reserved != 0)
+   flags = enhinfo[i].flags;
+   if (!(flags  IWN_ENHINFO_VALID))
continue;   /* Skip invalid entries. */
 
maxpwr = 0;
@@ -2058,11 +2062,34 @@ iwn_read_eeprom_enhinfo(struct iwn_softc
maxpwr = MAX(maxpwr, enhinfo[i].mimo2);
else if (sc-ntxchains == 3)
maxpwr = MAX(maxpwr, enhinfo[i].mimo3);
-   maxpwr /= 2;/* Convert half-dBm to dBm. */
 
-   DPRINTF(sc, IWN_DEBUG_RESET, enhinfo %d, maxpwr=%d\n, i,
-   maxpwr);
-   sc-enh_maxpwr[i] = maxpwr;
+   for (j = 0; j  ic-ic_nchans; j++) {
+   c = ic-ic_channels[j];
+   if ((flags  IWN_ENHINFO_5GHZ)) {
+   if (!IEEE80211_IS_CHAN_A(c))
+   continue;
+   } else if ((flags  IWN_ENHINFO_OFDM)) {
+   if (!IEEE80211_IS_CHAN_G(c))
+   continue;
+   } else if (!IEEE80211_IS_CHAN_B(c))
+   continue;
+   if ((flags  IWN_ENHINFO_HT40)) {
+   if (!IEEE80211_IS_CHAN_HT40(c))
+   continue;
+   } else {
+   if (IEEE80211_IS_CHAN_HT40(c))
+   continue;
+   }
+   if (enhinfo[i].chan != 0 
+   enhinfo[i].chan != c-ic_ieee)
+   continue;
+
+   DPRINTF(sc, IWN_DEBUG_RESET,
+   channel %d(%x), maxpwr %d\n, c-ic_ieee,
+   c-ic_flags, maxpwr / 2);
+   c-ic_maxregpower = maxpwr / 2;
+   c-ic_maxpower = maxpwr;
+   }
}
 }
 

Modified: head/sys/dev/iwn/if_iwnreg.h
==
--- head/sys/dev/iwn/if_iwnreg.hSun May  8 10:31:22 2011
(r221636)
+++ head/sys/dev/iwn/if_iwnreg.hSun May  8 10:35:16 2011
(r221637)
@@ -1433,7 +1433,17 @@ struct iwn_eeprom_chan {
 } __packed;
 
 struct iwn_eeprom_enhinfo {
-   uint16_tchan;
+   uint8_t flags;
+#define IWN_ENHINFO_VALID  0x01
+#define IWN_ENHINFO_5GHZ   0x02
+#define IWN_ENHINFO_OFDM   0x04
+#define IWN_ENHINFO_HT40   0x08
+#define IWN_ENHINFO_HTAP   0x10
+#define IWN_ENHINFO_RES1   0x20
+#define IWN_ENHINFO_RES2   0x40
+#define IWN_ENHINFO_COMMON 0x80
+
+   uint8_t chan;
int8_t  chain[3];   /* max power in half-dBm */
uint8_t reserved;
int8_t  mimo2;  /* max power in half-dBm */

Modified: head/sys/dev/iwn/if_iwnvar.h
==
--- head/sys/dev/iwn/if_iwnvar.hSun May  8 10:31:22 2011
(r221636)
+++ head/sys/dev/iwn/if_iwnvar.hSun May  8 10:35:16 2011
(r221637)
@@ -295,7 +295,6 @@ struct iwn_softc {
int8_t  maxpwr2GHz;
int8_t  maxpwr5GHz;
int8_t  maxpwr[IEEE80211_CHAN_MAX];
-   int8_t  enh_maxpwr[35];
 
int32_t temp_off;
uint32_tint_mask;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to 

svn commit: r221638 - head/sys/dev/iwn

2011-05-08 Thread Bernhard Schmidt
Author: bschmidt
Date: Sun May  8 10:54:50 2011
New Revision: 221638
URL: http://svn.freebsd.org/changeset/base/221638

Log:
  Allocate all TX rings, those will be use for TX packet aggregation.

Modified:
  head/sys/dev/iwn/if_iwn.c

Modified: head/sys/dev/iwn/if_iwn.c
==
--- head/sys/dev/iwn/if_iwn.c   Sun May  8 10:35:16 2011(r221637)
+++ head/sys/dev/iwn/if_iwn.c   Sun May  8 10:54:50 2011(r221638)
@@ -1489,13 +1489,6 @@ iwn_alloc_tx_ring(struct iwn_softc *sc, 
__func__, error);
goto fail;
}
-   /*
-* We only use rings 0 through 4 (4 EDCA + cmd) so there is no need
-* to allocate commands space for other rings.
-* XXX Do we really need to allocate descriptors for other rings?
-*/
-   if (qid  4)
-   return 0;
 
size = IWN_TX_RING_COUNT * sizeof (struct iwn_tx_cmd);
error = iwn_dma_contig_alloc(sc, ring-cmd_dma, (void **)ring-cmd,
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r221639 - head/sys/dev/iwn

2011-05-08 Thread Bernhard Schmidt
Author: bschmidt
Date: Sun May  8 10:57:44 2011
New Revision: 221639
URL: http://svn.freebsd.org/changeset/base/221639

Log:
  RX aggregation is slightly different then the legacy path, we will only
  receive one RX_PHY for each aggregate and not one RX_PHY per frame.

Modified:
  head/sys/dev/iwn/if_iwn.c

Modified: head/sys/dev/iwn/if_iwn.c
==
--- head/sys/dev/iwn/if_iwn.c   Sun May  8 10:54:50 2011(r221638)
+++ head/sys/dev/iwn/if_iwn.c   Sun May  8 10:57:44 2011(r221639)
@@ -2253,7 +2253,6 @@ iwn_rx_done(struct iwn_softc *sc, struct
%s: missing RX_PHY\n, __func__);
return;
}
-   sc-last_rx_valid = 0;
stat = sc-last_rx_stat;
} else
stat = (struct iwn_rx_stat *)(desc + 1);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r221640 - head/sys/dev/iwn

2011-05-08 Thread Bernhard Schmidt
Author: bschmidt
Date: Sun May  8 11:01:53 2011
New Revision: 221640
URL: http://svn.freebsd.org/changeset/base/221640

Log:
  Disable background scan support for 4965 adapters.
  
  On legacy channels every once in a while the firmware throws a SYSASSERT
  on line 208. On HT channels though this does always happen and I'm not
  aware of any workaround currently.

Modified:
  head/sys/dev/iwn/if_iwn.c

Modified: head/sys/dev/iwn/if_iwn.c
==
--- head/sys/dev/iwn/if_iwn.c   Sun May  8 10:57:44 2011(r221639)
+++ head/sys/dev/iwn/if_iwn.c   Sun May  8 11:01:53 2011(r221640)
@@ -584,12 +584,14 @@ iwn_attach(device_t dev)
| IEEE80211_C_SHSLOT/* short slot time supported */
| IEEE80211_C_WPA
| IEEE80211_C_SHPREAMBLE/* short preamble supported */
-   | IEEE80211_C_BGSCAN/* background scanning */
 #if 0
| IEEE80211_C_IBSS  /* ibss/adhoc mode */
 #endif
| IEEE80211_C_WME   /* WME */
;
+   if (sc-hw_type != IWN_HW_REV_TYPE_4965)
+   ic-ic_caps |= IEEE80211_C_BGSCAN; /* background scanning */
+
 #if 0  /* HT */
/* XXX disable until HT channel setup works */
ic-ic_htcaps =
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r221641 - head/sys/dev/iwn

2011-05-08 Thread Bernhard Schmidt
Author: bschmidt
Date: Sun May  8 11:03:16 2011
New Revision: 221641
URL: http://svn.freebsd.org/changeset/base/221641

Log:
  Add HT capabilities to probe requests.

Modified:
  head/sys/dev/iwn/if_iwn.c

Modified: head/sys/dev/iwn/if_iwn.c
==
--- head/sys/dev/iwn/if_iwn.c   Sun May  8 11:01:53 2011(r221640)
+++ head/sys/dev/iwn/if_iwn.c   Sun May  8 11:03:16 2011(r221641)
@@ -4942,6 +4942,7 @@ iwn_scan(struct iwn_softc *sc)
struct ifnet *ifp = sc-sc_ifp;
struct ieee80211com *ic = ifp-if_l2com;
struct ieee80211_scan_state *ss = ic-ic_scan;  /*XXX*/
+   struct ieee80211_node *ni = ss-ss_vap-iv_bss;
struct iwn_scan_hdr *hdr;
struct iwn_cmd_data *tx;
struct iwn_scan_essid *essid;
@@ -5028,10 +5029,8 @@ iwn_scan(struct iwn_softc *sc)
frm = ieee80211_add_rates(frm, rs);
if (rs-rs_nrates  IEEE80211_RATE_SIZE)
frm = ieee80211_add_xrates(frm, rs);
-#if 0  /* HT */
-   if (ic-ic_flags  IEEE80211_F_HTON)
-   frm = ieee80211_add_htcaps(frm, ic);
-#endif
+   if (ic-ic_htcaps  IEEE80211_HTC_HT)
+   frm = ieee80211_add_htcap(frm, ni);
 
/* Set length of probe request. */
tx-len = htole16(frm - (uint8_t *)wh);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r221642 - head/sys/dev/iwn

2011-05-08 Thread Bernhard Schmidt
Author: bschmidt
Date: Sun May  8 11:05:03 2011
New Revision: 221642
URL: http://svn.freebsd.org/changeset/base/221642

Log:
  Read chainmask information before announcing it.

Modified:
  head/sys/dev/iwn/if_iwn.c

Modified: head/sys/dev/iwn/if_iwn.c
==
--- head/sys/dev/iwn/if_iwn.c   Sun May  8 11:03:16 2011(r221641)
+++ head/sys/dev/iwn/if_iwn.c   Sun May  8 11:05:03 2011(r221642)
@@ -550,21 +550,6 @@ iwn_attach(device_t dev)
/* Clear pending interrupts. */
IWN_WRITE(sc, IWN_INT, 0x);
 
-   /* Count the number of available chains. */
-   sc-ntxchains =
-   ((sc-txchainmask  2)  1) +
-   ((sc-txchainmask  1)  1) +
-   ((sc-txchainmask  0)  1);
-   sc-nrxchains =
-   ((sc-rxchainmask  2)  1) +
-   ((sc-rxchainmask  1)  1) +
-   ((sc-rxchainmask  0)  1);
-   if (bootverbose) {
-   device_printf(dev, MIMO %dT%dR, %.4s, address %6D\n,
-   sc-ntxchains, sc-nrxchains, sc-eeprom_domain,
-   macaddr, :);
-   }
-
ifp = sc-sc_ifp = if_alloc(IFT_IEEE80211);
if (ifp == NULL) {
device_printf(dev, can not allocate ifnet structure\n);
@@ -592,6 +577,28 @@ iwn_attach(device_t dev)
if (sc-hw_type != IWN_HW_REV_TYPE_4965)
ic-ic_caps |= IEEE80211_C_BGSCAN; /* background scanning */
 
+   /* Read MAC address, channels, etc from EEPROM. */
+   if ((error = iwn_read_eeprom(sc, macaddr)) != 0) {
+   device_printf(dev, could not read EEPROM, error %d\n,
+   error);
+   goto fail;
+   }
+
+   /* Count the number of available chains. */
+   sc-ntxchains =
+   ((sc-txchainmask  2)  1) +
+   ((sc-txchainmask  1)  1) +
+   ((sc-txchainmask  0)  1);
+   sc-nrxchains =
+   ((sc-rxchainmask  2)  1) +
+   ((sc-rxchainmask  1)  1) +
+   ((sc-rxchainmask  0)  1);
+   if (bootverbose) {
+   device_printf(dev, MIMO %dT%dR, %.4s, address %6D\n,
+   sc-ntxchains, sc-nrxchains, sc-eeprom_domain,
+   macaddr, :);
+   }
+
 #if 0  /* HT */
/* XXX disable until HT channel setup works */
ic-ic_htcaps =
@@ -623,13 +630,6 @@ iwn_attach(device_t dev)
ic-ic_htcaps |= IEEE80211_HTCAP_SMPS_DIS;
 #endif
 
-   /* Read MAC address, channels, etc from EEPROM. */
-   if ((error = iwn_read_eeprom(sc, macaddr)) != 0) {
-   device_printf(dev, could not read EEPROM, error %d\n,
-   error);
-   goto fail;
-   }
-
 #if 0  /* HT */
/* Set supported HT rates. */
ic-ic_sup_mcs[0] = 0xff;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r221643 - head/sbin/hastd

2011-05-08 Thread Pawel Jakub Dawidek
Author: pjd
Date: Sun May  8 11:10:56 2011
New Revision: 221643
URL: http://svn.freebsd.org/changeset/base/221643

Log:
  Allow to specify remote as 'none' again which was broken by r219351, where
  'none' was defined as a value for checksum.
  
  Reported by:  trasz
  MFC after:1 week

Modified:
  head/sbin/hastd/parse.y

Modified: head/sbin/hastd/parse.y
==
--- head/sbin/hastd/parse.y Sun May  8 11:05:03 2011(r221642)
+++ head/sbin/hastd/parse.y Sun May  8 11:10:56 2011(r221643)
@@ -289,6 +289,7 @@ yy_config_free(struct hastd_config *conf
 %token FULLSYNC MEMSYNC ASYNC NONE CRC32 SHA256 HOLE LZF
 %token NUM STR OB CB
 
+%type str remote_str
 %type num replication_type
 %type num checksum_type
 %type num compression_type
@@ -796,7 +797,7 @@ resource_node_entry:
source_statement
;
 
-remote_statement:  REMOTE STR
+remote_statement:  REMOTE remote_str
{
assert(depth == 2);
if (mynode) {
@@ -813,6 +814,12 @@ remote_statement:  REMOTE STR
}
;
 
+remote_str:
+   NONE{ $$ = strdup(none); }
+   |
+   STR { }
+   ;
+
 source_statement:  SOURCE STR
{
assert(depth == 2);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r221644 - head/sys/geom/part

2011-05-08 Thread Andrey V. Elsukov
Author: ae
Date: Sun May  8 11:16:17 2011
New Revision: 221644
URL: http://svn.freebsd.org/changeset/base/221644

Log:
  Limit number of sectors that can be addressed.
  
  MFC after:1 week

Modified:
  head/sys/geom/part/g_part_mbr.c

Modified: head/sys/geom/part/g_part_mbr.c
==
--- head/sys/geom/part/g_part_mbr.c Sun May  8 11:10:56 2011
(r221643)
+++ head/sys/geom/part/g_part_mbr.c Sun May  8 11:16:17 2011
(r221644)
@@ -262,7 +262,7 @@ g_part_mbr_create(struct g_part_table *b
if (pp-sectorsize  MBRSIZE)
return (ENOSPC);
 
-   msize = MIN(pp-mediasize / pp-sectorsize, 0x);
+   msize = MIN(pp-mediasize / pp-sectorsize, UINT_MAX);
basetable-gpt_first = basetable-gpt_sectors;
basetable-gpt_last = msize - (msize % basetable-gpt_sectors) - 1;
 
@@ -433,7 +433,7 @@ g_part_mbr_read(struct g_part_table *bas
 
pp = cp-provider;
table = (struct g_part_mbr_table *)basetable;
-   msize = pp-mediasize / pp-sectorsize;
+   msize = MIN(pp-mediasize / pp-sectorsize, UINT_MAX);
 
buf = g_read_data(cp, 0L, pp-sectorsize, error);
if (buf == NULL)
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r221645 - head/sys/geom/part

2011-05-08 Thread Andrey V. Elsukov
Author: ae
Date: Sun May  8 11:20:27 2011
New Revision: 221645
URL: http://svn.freebsd.org/changeset/base/221645

Log:
  Limit number of sectors that can be addressed.
  
  MFC after:1 week

Modified:
  head/sys/geom/part/g_part_pc98.c

Modified: head/sys/geom/part/g_part_pc98.c
==
--- head/sys/geom/part/g_part_pc98.cSun May  8 11:16:17 2011
(r221644)
+++ head/sys/geom/part/g_part_pc98.cSun May  8 11:20:27 2011
(r221645)
@@ -261,7 +261,7 @@ g_part_pc98_create(struct g_part_table *
 
cyl = basetable-gpt_heads * basetable-gpt_sectors;
 
-   msize = MIN(pp-mediasize / SECSIZE, 0x);
+   msize = MIN(pp-mediasize / SECSIZE, UINT_MAX);
basetable-gpt_first = cyl;
basetable-gpt_last = msize - (msize % cyl) - 1;
 
@@ -451,7 +451,7 @@ g_part_pc98_read(struct g_part_table *ba
 
pp = cp-provider;
table = (struct g_part_pc98_table *)basetable;
-   msize = pp-mediasize / SECSIZE;
+   msize = MIN(pp-mediasize / SECSIZE, UINT_MAX);
 
buf = g_read_data(cp, 0L, BOOTSIZE, error);
if (buf == NULL)
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r221646 - in head: bin/sh tools/regression/bin/sh/builtins tools/regression/bin/sh/expansion

2011-05-08 Thread Jilles Tjoelker
Author: jilles
Date: Sun May  8 11:32:20 2011
New Revision: 221646
URL: http://svn.freebsd.org/changeset/base/221646

Log:
  sh: Add UTF-8 support to pattern matching.
  
  ?, [...] patterns match codepoints instead of bytes. They do not match
  invalid sequences. [...] patterns must not contain invalid sequences
  otherwise they will not match anything. This is so that ${var#?} removes the
  first codepoint, not the first byte, without putting UTF-8 knowledge into
  the ${var#pattern} code. However, * continues to match any string and an
  invalid sequence matches an identical invalid sequence. (This differs from
  fnmatch(3).)

Added:
  head/tools/regression/bin/sh/builtins/case5.0   (contents, props changed)
  head/tools/regression/bin/sh/expansion/trim8.0   (contents, props changed)
Modified:
  head/bin/sh/expand.c

Modified: head/bin/sh/expand.c
==
--- head/bin/sh/expand.cSun May  8 11:20:27 2011(r221645)
+++ head/bin/sh/expand.cSun May  8 11:32:20 2011(r221646)
@@ -52,6 +52,7 @@ __FBSDID($FreeBSD$);
 #include stdlib.h
 #include string.h
 #include unistd.h
+#include wchar.h
 
 /*
  * Routines to expand arguments to commands.  We have to deal with
@@ -111,16 +112,16 @@ static void addfname(char *);
 static struct strlist *expsort(struct strlist *);
 static struct strlist *msort(struct strlist *, int);
 static char *cvtnum(int, char *);
-static int collate_range_cmp(int, int);
+static int collate_range_cmp(wchar_t, wchar_t);
 
 static int
-collate_range_cmp(int c1, int c2)
+collate_range_cmp(wchar_t c1, wchar_t c2)
 {
-   static char s1[2], s2[2];
+   static wchar_t s1[2], s2[2];
 
s1[0] = c1;
s2[0] = c2;
-   return (strcoll(s1, s2));
+   return (wcscoll(s1, s2));
 }
 
 /*
@@ -1377,6 +1378,23 @@ msort(struct strlist *list, int len)
 
 
 
+static wchar_t
+get_wc(const char **p)
+{
+   wchar_t c;
+   int chrlen;
+
+   chrlen = mbtowc(c, *p, 4);
+   if (chrlen == 0)
+   return 0;
+   else if (chrlen == -1)
+   c = 0;
+   else
+   *p += chrlen;
+   return c;
+}
+
+
 /*
  * Returns true if the pattern matches the string.
  */
@@ -1386,6 +1404,7 @@ patmatch(const char *pattern, const char
 {
const char *p, *q;
char c;
+   wchar_t wc, wc2;
 
p = pattern;
q = string;
@@ -1404,7 +1423,11 @@ patmatch(const char *pattern, const char
case '?':
if (squoted  *q == CTLESC)
q++;
-   if (*q++ == '\0')
+   if (localeisutf8)
+   wc = get_wc(q);
+   else
+   wc = *q++;
+   if (wc == '\0')
return 0;
break;
case '*':
@@ -1434,7 +1457,7 @@ patmatch(const char *pattern, const char
case '[': {
const char *endp;
int invert, found;
-   char chr;
+   wchar_t chr;
 
endp = p;
if (*endp == '!' || *endp == '^')
@@ -1455,8 +1478,11 @@ patmatch(const char *pattern, const char
p++;
}
found = 0;
-   chr = *q++;
-   if (squoted  chr == CTLESC)
+   if (squoted  *q == CTLESC)
+   q++;
+   if (localeisutf8)
+   chr = get_wc(q);
+   else
chr = *q++;
if (chr == '\0')
return 0;
@@ -1466,19 +1492,31 @@ patmatch(const char *pattern, const char
continue;
if (c == CTLESC)
c = *p++;
+   if (localeisutf8  c  0x80) {
+   p--;
+   wc = get_wc(p);
+   if (wc == 0) /* bad utf-8 */
+   return 0;
+   } else
+   wc = c;
if (*p == '-'  p[1] != ']') {
p++;
while (*p == CTLQUOTEMARK)
p++;
if (*p == CTLESC)
p++;
-   if (   collate_range_cmp(chr, c) = 0
-collate_range_cmp(chr, *p) = 0
+ 

Re: svn commit: r221645 - head/sys/geom/part

2011-05-08 Thread Kostik Belousov
On Sun, May 08, 2011 at 11:20:27AM +, Andrey V. Elsukov wrote:
 Author: ae
 Date: Sun May  8 11:20:27 2011
 New Revision: 221645
 URL: http://svn.freebsd.org/changeset/base/221645
 
 Log:
   Limit number of sectors that can be addressed.
   
   MFC after:  1 week
 
 Modified:
   head/sys/geom/part/g_part_pc98.c
 
 Modified: head/sys/geom/part/g_part_pc98.c
 ==
 --- head/sys/geom/part/g_part_pc98.c  Sun May  8 11:16:17 2011
 (r221644)
 +++ head/sys/geom/part/g_part_pc98.c  Sun May  8 11:20:27 2011
 (r221645)
 @@ -261,7 +261,7 @@ g_part_pc98_create(struct g_part_table *
  
   cyl = basetable-gpt_heads * basetable-gpt_sectors;
  
 - msize = MIN(pp-mediasize / SECSIZE, 0x);
 + msize = MIN(pp-mediasize / SECSIZE, UINT_MAX);
Shouldn't this be UINT32_MAX (consistently) ?


pgpfJpbFL9n4K.pgp
Description: PGP signature


svn commit: r221647 - head/sys/geom/part

2011-05-08 Thread Andrey V. Elsukov
Author: ae
Date: Sun May  8 11:42:51 2011
New Revision: 221647
URL: http://svn.freebsd.org/changeset/base/221647

Log:
  Replace UINT_MAX to UINT32_MAX.
  
  Pointed out by:   kib
  MFC after:1 week

Modified:
  head/sys/geom/part/g_part_mbr.c
  head/sys/geom/part/g_part_pc98.c

Modified: head/sys/geom/part/g_part_mbr.c
==
--- head/sys/geom/part/g_part_mbr.c Sun May  8 11:32:20 2011
(r221646)
+++ head/sys/geom/part/g_part_mbr.c Sun May  8 11:42:51 2011
(r221647)
@@ -262,7 +262,7 @@ g_part_mbr_create(struct g_part_table *b
if (pp-sectorsize  MBRSIZE)
return (ENOSPC);
 
-   msize = MIN(pp-mediasize / pp-sectorsize, UINT_MAX);
+   msize = MIN(pp-mediasize / pp-sectorsize, UINT32_MAX);
basetable-gpt_first = basetable-gpt_sectors;
basetable-gpt_last = msize - (msize % basetable-gpt_sectors) - 1;
 
@@ -433,7 +433,7 @@ g_part_mbr_read(struct g_part_table *bas
 
pp = cp-provider;
table = (struct g_part_mbr_table *)basetable;
-   msize = MIN(pp-mediasize / pp-sectorsize, UINT_MAX);
+   msize = MIN(pp-mediasize / pp-sectorsize, UINT32_MAX);
 
buf = g_read_data(cp, 0L, pp-sectorsize, error);
if (buf == NULL)

Modified: head/sys/geom/part/g_part_pc98.c
==
--- head/sys/geom/part/g_part_pc98.cSun May  8 11:32:20 2011
(r221646)
+++ head/sys/geom/part/g_part_pc98.cSun May  8 11:42:51 2011
(r221647)
@@ -261,7 +261,7 @@ g_part_pc98_create(struct g_part_table *
 
cyl = basetable-gpt_heads * basetable-gpt_sectors;
 
-   msize = MIN(pp-mediasize / SECSIZE, UINT_MAX);
+   msize = MIN(pp-mediasize / SECSIZE, UINT32_MAX);
basetable-gpt_first = cyl;
basetable-gpt_last = msize - (msize % cyl) - 1;
 
@@ -451,7 +451,7 @@ g_part_pc98_read(struct g_part_table *ba
 
pp = cp-provider;
table = (struct g_part_pc98_table *)basetable;
-   msize = MIN(pp-mediasize / SECSIZE, UINT_MAX);
+   msize = MIN(pp-mediasize / SECSIZE, UINT32_MAX);
 
buf = g_read_data(cp, 0L, BOOTSIZE, error);
if (buf == NULL)
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r221648 - head/sys/dev/iwn

2011-05-08 Thread Bernhard Schmidt
Author: bschmidt
Date: Sun May  8 11:49:50 2011
New Revision: 221648
URL: http://svn.freebsd.org/changeset/base/221648

Log:
  Prepare for transmitting frames at MCS rates:
  - instead of calling iwn_plcp_signal() for every frame, map the expected
value directly within wn-ridx
  - concat plcp, rflags and xrflags, there is no clean byte boundary within
the flags, for example the antenna setting uses bit 6, 7 and 8
  - there is still need for a custom rate to plcp mapping, as those expected
by the hardware are not conform to the std

Modified:
  head/sys/dev/iwn/if_iwn.c
  head/sys/dev/iwn/if_iwnreg.h
  head/sys/dev/iwn/if_iwnvar.h

Modified: head/sys/dev/iwn/if_iwn.c
==
--- head/sys/dev/iwn/if_iwn.c   Sun May  8 11:42:51 2011(r221647)
+++ head/sys/dev/iwn/if_iwn.c   Sun May  8 11:49:50 2011(r221648)
@@ -199,7 +199,6 @@ static void iwn5000_update_sched(struct 
 #ifdef notyet
 static voidiwn5000_reset_sched(struct iwn_softc *, int, int);
 #endif
-static uint8_t iwn_plcp_signal(int);
 static int iwn_tx_data(struct iwn_softc *, struct mbuf *,
struct ieee80211_node *);
 static int iwn_tx_data_raw(struct iwn_softc *, struct mbuf *,
@@ -2094,15 +2093,48 @@ iwn_node_alloc(struct ieee80211vap *vap,
return malloc(sizeof (struct iwn_node), M_80211_NODE,M_NOWAIT | M_ZERO);
 }
 
+static __inline int
+rate2plcp(int rate)
+{
+   switch (rate  0xff) {
+   case 12:return 0xd;
+   case 18:return 0xf;
+   case 24:return 0x5;
+   case 36:return 0x7;
+   case 48:return 0x9;
+   case 72:return 0xb;
+   case 96:return 0x1;
+   case 108:   return 0x3;
+   case 2: return 10;
+   case 4: return 20;
+   case 11:return 55;
+   case 22:return 110;
+   }
+   return 0;
+}
+
 static void
 iwn_newassoc(struct ieee80211_node *ni, int isnew)
 {
+   struct ieee80211com *ic = ni-ni_ic;
+   struct iwn_softc *sc = ic-ic_ifp-if_softc;
struct iwn_node *wn = (void *)ni;
-   int ridx, i;
+   uint8_t txant;
+   int i, plcp, rate, ridx;
+
+   /* Use the first valid TX antenna. */
+   txant = IWN_LSB(sc-txchainmask);
 
for (i = 0; i  ni-ni_rates.rs_nrates; i++) {
-   ridx = iwn_plcp_signal(ni-ni_rates.rs_rates[i]);
-   wn-ridx[i] = ridx;
+   rate = ni-ni_rates.rs_rates[i]  IEEE80211_RATE_VAL;
+   plcp = rate2plcp(rate);
+   ridx = ic-ic_rt-rateCodeToIndex[rate];
+
+   if (ridx  IWN_RIDX_OFDM6 
+   IEEE80211_IS_CHAN_2GHZ(ni-ni_chan))
+   plcp |= IWN_RFLAG_CCK;
+   plcp |= IWN_RFLAG_ANT(txant);
+   wn-ridx[rate] = htole32(plcp);
}
 }
 
@@ -3087,18 +3119,6 @@ iwn5000_reset_sched(struct iwn_softc *sc
 }
 #endif
 
-static uint8_t
-iwn_plcp_signal(int rate) {
-   int i;
-
-   for (i = 0; i  IWN_RIDX_MAX + 1; i++) {
-   if ((rate  IEEE80211_RATE_VAL) == iwn_rates[i].rate)
-   return i;
-   }
-
-   return 0;
-}
-
 static int
 iwn_tx_data(struct iwn_softc *sc, struct mbuf *m, struct ieee80211_node *ni)
 {
@@ -3111,7 +3131,6 @@ iwn_tx_data(struct iwn_softc *sc, struct
struct iwn_tx_data *data;
struct iwn_tx_cmd *cmd;
struct iwn_cmd_data *tx;
-   const struct iwn_rate *rinfo;
struct ieee80211_frame *wh;
struct ieee80211_key *k = NULL;
struct mbuf *m1;
@@ -3155,8 +3174,7 @@ iwn_tx_data(struct iwn_softc *sc, struct
(void) ieee80211_ratectl_rate(ni, NULL, 0);
rate = ni-ni_txrate;
}
-   ridx = iwn_plcp_signal(rate);
-   rinfo = iwn_rates[ridx];
+   ridx = ic-ic_rt-rateCodeToIndex[rate];
 
/* Encrypt the frame if need be. */
if (wh-i_fc[1]  IEEE80211_FC1_WEP) {
@@ -3175,7 +3193,7 @@ iwn_tx_data(struct iwn_softc *sc, struct
struct iwn_tx_radiotap_header *tap = sc-sc_txtap;
 
tap-wt_flags = 0;
-   tap-wt_rate = rinfo-rate;
+   tap-wt_rate = rate;
if (k != NULL)
tap-wt_flags |= IEEE80211_RADIOTAP_F_WEP;
 
@@ -3262,14 +3280,13 @@ iwn_tx_data(struct iwn_softc *sc, struct
tx-rts_ntries = 60;
tx-data_ntries = 15;
tx-lifetime = htole32(IWN_LIFETIME_INFINITE);
-   tx-plcp = rinfo-plcp;
-   tx-rflags = rinfo-flags;
+   tx-rate = wn-ridx[rate];
if (tx-id == sc-broadcast_id) {
/* Group or management frame. */
tx-linkq = 0;
/* XXX Alternate between antenna A and B? */
txant = IWN_LSB(sc-txchainmask);
-   tx-rflags |= IWN_RFLAG_ANT(txant);
+   tx-rate |= htole32(IWN_RFLAG_ANT(txant));
} else {

svn commit: r221649 - head/sys/dev/iwn

2011-05-08 Thread Bernhard Schmidt
Author: bschmidt
Date: Sun May  8 11:54:38 2011
New Revision: 221649
URL: http://svn.freebsd.org/changeset/base/221649

Log:
  Add support for transmitting frames at MCS rates.

Modified:
  head/sys/dev/iwn/if_iwn.c
  head/sys/dev/iwn/if_iwnreg.h

Modified: head/sys/dev/iwn/if_iwn.c
==
--- head/sys/dev/iwn/if_iwn.c   Sun May  8 11:49:50 2011(r221648)
+++ head/sys/dev/iwn/if_iwn.c   Sun May  8 11:54:38 2011(r221649)
@@ -2119,22 +2119,47 @@ iwn_newassoc(struct ieee80211_node *ni, 
struct ieee80211com *ic = ni-ni_ic;
struct iwn_softc *sc = ic-ic_ifp-if_softc;
struct iwn_node *wn = (void *)ni;
-   uint8_t txant;
+   uint8_t txant1, txant2;
int i, plcp, rate, ridx;
 
/* Use the first valid TX antenna. */
-   txant = IWN_LSB(sc-txchainmask);
+   txant1 = IWN_LSB(sc-txchainmask);
+   txant2 = IWN_LSB(sc-txchainmask  ~txant1);
+
+   if (IEEE80211_IS_CHAN_HT(ni-ni_chan)) {
+   ridx = ni-ni_rates.rs_nrates - 1;
+   for (i = ni-ni_htrates.rs_nrates - 1; i = 0; i--) {
+   plcp = ni-ni_htrates.rs_rates[i] | IWN_RFLAG_MCS;
+   if (IEEE80211_IS_CHAN_HT40(ni-ni_chan)) {
+   plcp |= IWN_RFLAG_HT40;
+   if (ni-ni_htcap  IEEE80211_HTCAP_SHORTGI40)
+   plcp |= IWN_RFLAG_SGI;
+   } else if (ni-ni_htcap  IEEE80211_HTCAP_SHORTGI20)
+   plcp |= IWN_RFLAG_SGI;
+   if (i  7)
+   plcp |= IWN_RFLAG_ANT(txant1 | txant2);
+   else
+   plcp |= IWN_RFLAG_ANT(txant1);
+   if (ridx = 0) {
+   rate = ni-ni_rates.rs_rates[ridx];
+   rate = IEEE80211_RATE_VAL;
+   wn-ridx[rate] = plcp;
+   }
+   wn-ridx[IEEE80211_RATE_MCS | i] = plcp;
+   ridx--;
+   }
+   } else {
+   for (i = 0; i  ni-ni_rates.rs_nrates; i++) {
+   rate = ni-ni_rates.rs_rates[i]  IEEE80211_RATE_VAL;
 
-   for (i = 0; i  ni-ni_rates.rs_nrates; i++) {
-   rate = ni-ni_rates.rs_rates[i]  IEEE80211_RATE_VAL;
-   plcp = rate2plcp(rate);
-   ridx = ic-ic_rt-rateCodeToIndex[rate];
-
-   if (ridx  IWN_RIDX_OFDM6 
-   IEEE80211_IS_CHAN_2GHZ(ni-ni_chan))
-   plcp |= IWN_RFLAG_CCK;
-   plcp |= IWN_RFLAG_ANT(txant);
-   wn-ridx[rate] = htole32(plcp);
+   plcp = rate2plcp(rate);
+   ridx = ic-ic_rt-rateCodeToIndex[rate];
+   if (ridx  IWN_RIDX_OFDM6 
+   IEEE80211_IS_CHAN_2GHZ(ni-ni_chan))
+   plcp |= IWN_RFLAG_CCK;
+   plcp |= IWN_RFLAG_ANT(txant1);
+   wn-ridx[rate] = htole32(plcp);
+   }
}
 }
 
@@ -3849,11 +3874,21 @@ iwn_set_link_quality(struct iwn_softc *s
linkq.ampdu_limit = htole16(4000);  /* 4ms */
 
/* Start at highest available bit-rate. */
-   txrate = rs-rs_nrates - 1;
+   if (IEEE80211_IS_CHAN_HT(ni-ni_chan))
+   txrate = ni-ni_htrates.rs_nrates - 1;
+   else
+   txrate = rs-rs_nrates - 1;
for (i = 0; i  IWN_MAX_TX_RETRIES; i++) {
-   rate = rs-rs_rates[txrate]  IEEE80211_RATE_VAL;
+   if (IEEE80211_IS_CHAN_HT(ni-ni_chan))
+   rate = IEEE80211_RATE_MCS | txrate;
+   else
+   rate = rs-rs_rates[txrate]  IEEE80211_RATE_VAL;
linkq.retry[i] = wn-ridx[rate];
 
+   if ((le32toh(wn-ridx[rate])  IWN_RFLAG_MCS) 
+   (le32toh(wn-ridx[rate])  0xff)  7)
+   linkq.mimo = i + 1;
+
/* Next retry at immediate lower bit-rate. */
if (txrate  0)
txrate--;

Modified: head/sys/dev/iwn/if_iwnreg.h
==
--- head/sys/dev/iwn/if_iwnreg.hSun May  8 11:49:50 2011
(r221648)
+++ head/sys/dev/iwn/if_iwnreg.hSun May  8 11:54:38 2011
(r221649)
@@ -625,7 +625,12 @@ struct iwn4965_node_info {
uint32_treserved7;
 } __packed;
 
+#define IWN_RFLAG_MCS  (1  8)
 #define IWN_RFLAG_CCK  (1  9)
+#define IWN_RFLAG_GREENFIELD   (1  10)
+#define IWN_RFLAG_HT40 (1  11)
+#define IWN_RFLAG_DUPLICATE(1  12)
+#define IWN_RFLAG_SGI  (1  13)
 #define IWN_RFLAG_ANT(x)   ((x)  14)
 
 /* Structure for command IWN_CMD_TX_DATA. */
___

svn commit: r221650 - head/sys/dev/iwn

2011-05-08 Thread Bernhard Schmidt
Author: bschmidt
Date: Sun May  8 11:58:23 2011
New Revision: 221650
URL: http://svn.freebsd.org/changeset/base/221650

Log:
  Add support for RX packet aggregation.

Modified:
  head/sys/dev/iwn/if_iwn.c
  head/sys/dev/iwn/if_iwnvar.h

Modified: head/sys/dev/iwn/if_iwn.c
==
--- head/sys/dev/iwn/if_iwn.c   Sun May  8 11:54:38 2011(r221649)
+++ head/sys/dev/iwn/if_iwn.c   Sun May  8 11:58:23 2011(r221650)
@@ -251,11 +251,11 @@ static uint8_t*ieee80211_add_ssid(uint8
 static int iwn_scan(struct iwn_softc *);
 static int iwn_auth(struct iwn_softc *, struct ieee80211vap *vap);
 static int iwn_run(struct iwn_softc *, struct ieee80211vap *vap);
+static int iwn_ampdu_rx_start(struct ieee80211_node *,
+   struct ieee80211_rx_ampdu *, int, int, int);
+static voidiwn_ampdu_rx_stop(struct ieee80211_node *,
+   struct ieee80211_rx_ampdu *);
 #if 0  /* HT */
-static int iwn_ampdu_rx_start(struct ieee80211com *,
-   struct ieee80211_node *, uint8_t);
-static voidiwn_ampdu_rx_stop(struct ieee80211com *,
-   struct ieee80211_node *, uint8_t);
 static int iwn_ampdu_tx_start(struct ieee80211com *,
struct ieee80211_node *, uint8_t);
 static voidiwn_ampdu_tx_stop(struct ieee80211com *,
@@ -653,9 +653,11 @@ iwn_attach(device_t dev)
ic-ic_vap_delete = iwn_vap_delete;
ic-ic_raw_xmit = iwn_raw_xmit;
ic-ic_node_alloc = iwn_node_alloc;
-#if 0  /* HT */
+   sc-sc_ampdu_rx_start = ic-ic_ampdu_rx_start;
ic-ic_ampdu_rx_start = iwn_ampdu_rx_start;
+   sc-sc_ampdu_rx_stop = ic-ic_ampdu_rx_stop;
ic-ic_ampdu_rx_stop = iwn_ampdu_rx_stop;
+#if 0  /* HT */
ic-ic_ampdu_tx_start = iwn_ampdu_tx_start;
ic-ic_ampdu_tx_stop = iwn_ampdu_tx_stop;
 #endif
@@ -2434,6 +2436,8 @@ iwn_rx_done(struct iwn_softc *sc, struct
 
/* Send the frame to the 802.11 layer. */
if (ni != NULL) {
+   if (ni-ni_flags  IEEE80211_NODE_HT)
+   m-m_flags |= M_AMPDU;
(void)ieee80211_input(ni, m, rssi - nf, nf);
/* Node is no longer needed. */
ieee80211_free_node(ni);
@@ -3765,7 +3769,8 @@ iwn_cmd(struct iwn_softc *sc, int code, 
bus_addr_t paddr;
int totlen, error;
 
-   IWN_LOCK_ASSERT(sc);
+   if (async == 0)
+   IWN_LOCK_ASSERT(sc);
 
desc = ring-desc[ring-cur];
data = ring-data[ring-cur];
@@ -5321,30 +5326,39 @@ iwn_run(struct iwn_softc *sc, struct iee
 #undef MS
 }
 
-#if 0  /* HT */
 /*
  * This function is called by upper layer when an ADDBA request is received
  * from another STA and before the ADDBA response is sent.
  */
 static int
-iwn_ampdu_rx_start(struct ieee80211com *ic, struct ieee80211_node *ni,
-uint8_t tid)
+iwn_ampdu_rx_start(struct ieee80211_node *ni, struct ieee80211_rx_ampdu *rap,
+int baparamset, int batimeout, int baseqctl)
 {
-   struct ieee80211_rx_ba *ba = ni-ni_rx_ba[tid];
-   struct iwn_softc *sc = ic-ic_softc;
+#define MS(_v, _f) (((_v)  _f)  _f##_S)
+   struct iwn_softc *sc = ni-ni_ic-ic_ifp-if_softc;
struct iwn_ops *ops = sc-ops;
struct iwn_node *wn = (void *)ni;
struct iwn_node_info node;
+   uint16_t ssn;
+   uint8_t tid;
+   int error;
+
+   tid = MS(le16toh(baparamset), IEEE80211_BAPS_TID);
+   ssn = MS(le16toh(baseqctl), IEEE80211_BASEQ_START);
 
memset(node, 0, sizeof node);
node.id = wn-id;
node.control = IWN_NODE_UPDATE;
node.flags = IWN_FLAG_SET_ADDBA;
node.addba_tid = tid;
-   node.addba_ssn = htole16(ba-ba_winstart);
+   node.addba_ssn = htole16(ssn);
DPRINTF(sc, IWN_DEBUG_RECV, ADDBA RA=%d TID=%d SSN=%d\n,
-   wn-id, tid, ba-ba_winstart);
-   return ops-add_node(sc, node, 1);
+   wn-id, tid, ssn);
+   error = ops-add_node(sc, node, 1);
+   if (error != 0)
+   return error;
+   return sc-sc_ampdu_rx_start(ni, rap, baparamset, batimeout, baseqctl);
+#undef MS
 }
 
 /*
@@ -5352,13 +5366,20 @@ iwn_ampdu_rx_start(struct ieee80211com *
  * Block Ack agreement (eg. uppon receipt of a DELBA frame).
  */
 static void
-iwn_ampdu_rx_stop(struct ieee80211com *ic, struct ieee80211_node *ni,
-uint8_t tid)
+iwn_ampdu_rx_stop(struct ieee80211_node *ni, struct ieee80211_rx_ampdu *rap)
 {
-   struct iwn_softc *sc = ic-ic_softc;
+   struct ieee80211com *ic = ni-ni_ic;
+   struct iwn_softc *sc = ic-ic_ifp-if_softc;
struct iwn_ops *ops = sc-ops;
struct iwn_node *wn = (void *)ni;
struct iwn_node_info node;
+   uint8_t tid;
+
+   /* XXX: tid as an argument */
+   for (tid = 0; tid  WME_NUM_TID; tid++) {
+   if (ni-ni_rx_ampdu[tid] == rap)
+   break;
+   }
 
memset(node, 0, 

svn commit: r221651 - head/sys/dev/iwn

2011-05-08 Thread Bernhard Schmidt
Author: bschmidt
Date: Sun May  8 12:06:12 2011
New Revision: 221651
URL: http://svn.freebsd.org/changeset/base/221651

Log:
  Add support for TX packet aggregation.

Modified:
  head/sys/dev/iwn/if_iwn.c
  head/sys/dev/iwn/if_iwnreg.h
  head/sys/dev/iwn/if_iwnvar.h

Modified: head/sys/dev/iwn/if_iwn.c
==
--- head/sys/dev/iwn/if_iwn.c   Sun May  8 11:58:23 2011(r221650)
+++ head/sys/dev/iwn/if_iwn.c   Sun May  8 12:06:12 2011(r221651)
@@ -172,10 +172,8 @@ static voidiwn_rx_phy(struct iwn_softc 
struct iwn_rx_data *);
 static voidiwn_rx_done(struct iwn_softc *, struct iwn_rx_desc *,
struct iwn_rx_data *);
-#if 0  /* HT */
 static voidiwn_rx_compressed_ba(struct iwn_softc *, struct iwn_rx_desc *,
struct iwn_rx_data *);
-#endif
 static voidiwn5000_rx_calib_results(struct iwn_softc *,
struct iwn_rx_desc *, struct iwn_rx_data *);
 static voidiwn_rx_statistics(struct iwn_softc *, struct iwn_rx_desc *,
@@ -186,6 +184,7 @@ static void iwn5000_tx_done(struct iwn_s
struct iwn_rx_data *);
 static voidiwn_tx_done(struct iwn_softc *, struct iwn_rx_desc *, int,
uint8_t);
+static voidiwn_ampdu_tx_done(struct iwn_softc *, int, int, int, void *);
 static voidiwn_cmd_done(struct iwn_softc *, struct iwn_rx_desc *);
 static voidiwn_notif_intr(struct iwn_softc *);
 static voidiwn_wakeup_intr(struct iwn_softc *);
@@ -255,20 +254,22 @@ static intiwn_ampdu_rx_start(struct iee
struct ieee80211_rx_ampdu *, int, int, int);
 static voidiwn_ampdu_rx_stop(struct ieee80211_node *,
struct ieee80211_rx_ampdu *);
-#if 0  /* HT */
+static int iwn_addba_request(struct ieee80211_node *,
+   struct ieee80211_tx_ampdu *, int, int, int);
+static int iwn_addba_response(struct ieee80211_node *,
+   struct ieee80211_tx_ampdu *, int, int, int);
 static int iwn_ampdu_tx_start(struct ieee80211com *,
struct ieee80211_node *, uint8_t);
-static voidiwn_ampdu_tx_stop(struct ieee80211com *,
-   struct ieee80211_node *, uint8_t);
+static voidiwn_ampdu_tx_stop(struct ieee80211_node *,
+   struct ieee80211_tx_ampdu *);
 static voidiwn4965_ampdu_tx_start(struct iwn_softc *,
-   struct ieee80211_node *, uint8_t, uint16_t);
-static voidiwn4965_ampdu_tx_stop(struct iwn_softc *,
+   struct ieee80211_node *, int, uint8_t, uint16_t);
+static voidiwn4965_ampdu_tx_stop(struct iwn_softc *, int,
uint8_t, uint16_t);
 static voidiwn5000_ampdu_tx_start(struct iwn_softc *,
-   struct ieee80211_node *, uint8_t, uint16_t);
-static voidiwn5000_ampdu_tx_stop(struct iwn_softc *,
+   struct ieee80211_node *, int, uint8_t, uint16_t);
+static voidiwn5000_ampdu_tx_stop(struct iwn_softc *, int,
uint8_t, uint16_t);
-#endif
 static int iwn5000_query_calibration(struct iwn_softc *);
 static int iwn5000_send_calibration(struct iwn_softc *);
 static int iwn5000_send_wimax_coex(struct iwn_softc *);
@@ -657,10 +658,12 @@ iwn_attach(device_t dev)
ic-ic_ampdu_rx_start = iwn_ampdu_rx_start;
sc-sc_ampdu_rx_stop = ic-ic_ampdu_rx_stop;
ic-ic_ampdu_rx_stop = iwn_ampdu_rx_stop;
-#if 0  /* HT */
-   ic-ic_ampdu_tx_start = iwn_ampdu_tx_start;
-   ic-ic_ampdu_tx_stop = iwn_ampdu_tx_stop;
-#endif
+   sc-sc_addba_request = ic-ic_addba_request;
+   ic-ic_addba_request = iwn_addba_request;
+   sc-sc_addba_response = ic-ic_addba_response;
+   ic-ic_addba_response = iwn_addba_response;
+   sc-sc_addba_stop = ic-ic_addba_stop;
+   ic-ic_addba_stop = iwn_ampdu_tx_stop;
ic-ic_newassoc = iwn_newassoc;
ic-ic_wme.wme_update = iwn_updateedca;
ic-ic_update_mcast = iwn_update_mcast;
@@ -717,11 +720,10 @@ iwn4965_attach(struct iwn_softc *sc, uin
ops-set_gains = iwn4965_set_gains;
ops-add_node = iwn4965_add_node;
ops-tx_done = iwn4965_tx_done;
-#if 0  /* HT */
ops-ampdu_tx_start = iwn4965_ampdu_tx_start;
ops-ampdu_tx_stop = iwn4965_ampdu_tx_stop;
-#endif
sc-ntxqs = IWN4965_NTXQUEUES;
+   sc-firstaggqueue = IWN4965_FIRSTAGGQUEUE;
sc-ndmachnls = IWN4965_NDMACHNLS;
sc-broadcast_id = IWN4965_ID_BROADCAST;
sc-rxonsz = IWN4965_RXONSZ;
@@ -756,11 +758,10 @@ iwn5000_attach(struct iwn_softc *sc, uin
ops-set_gains = iwn5000_set_gains;
ops-add_node = iwn5000_add_node;
ops-tx_done = iwn5000_tx_done;
-#if 0  /* HT */
ops-ampdu_tx_start = iwn5000_ampdu_tx_start;
ops-ampdu_tx_stop = iwn5000_ampdu_tx_stop;
-#endif
sc-ntxqs = IWN5000_NTXQUEUES;
+   sc-firstaggqueue = 

svn commit: r221652 - head/sys/geom/part

2011-05-08 Thread Andrey V. Elsukov
Author: ae
Date: Sun May  8 12:11:16 2011
New Revision: 221652
URL: http://svn.freebsd.org/changeset/base/221652

Log:
  Limit number of sectors that can be addressed.
  
  MFC after:1 week

Modified:
  head/sys/geom/part/g_part_bsd.c

Modified: head/sys/geom/part/g_part_bsd.c
==
--- head/sys/geom/part/g_part_bsd.c Sun May  8 12:06:12 2011
(r221651)
+++ head/sys/geom/part/g_part_bsd.c Sun May  8 12:11:16 2011
(r221652)
@@ -206,7 +206,7 @@ g_part_bsd_create(struct g_part_table *b
if (BBSIZE % pp-sectorsize)
return (ENOTBLK);
 
-   msize = MIN(pp-mediasize / pp-sectorsize, 0x);
+   msize = MIN(pp-mediasize / pp-sectorsize, UINT32_MAX);
secpercyl = basetable-gpt_sectors * basetable-gpt_heads;
ncyls = msize / secpercyl;
 
@@ -365,7 +365,7 @@ g_part_bsd_read(struct g_part_table *bas
 
pp = cp-provider;
table = (struct g_part_bsd_table *)basetable;
-   msize = pp-mediasize / pp-sectorsize;
+   msize = MIN(pp-mediasize / pp-sectorsize, UINT32_MAX);
 
table-bbarea = g_read_data(cp, 0, BBSIZE, error);
if (table-bbarea == NULL)
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r221653 - head/sys/dev/iwn

2011-05-08 Thread Bernhard Schmidt
Author: bschmidt
Date: Sun May  8 12:11:20 2011
New Revision: 221653
URL: http://svn.freebsd.org/changeset/base/221653

Log:
  Notify firmware about various HT parameters once associated.

Modified:
  head/sys/dev/iwn/if_iwn.c
  head/sys/dev/iwn/if_iwnreg.h

Modified: head/sys/dev/iwn/if_iwn.c
==
--- head/sys/dev/iwn/if_iwn.c   Sun May  8 12:11:16 2011(r221652)
+++ head/sys/dev/iwn/if_iwn.c   Sun May  8 12:11:20 2011(r221653)
@@ -5348,12 +5348,12 @@ iwn_auth(struct iwn_softc *sc, struct ie
 static int
 iwn_run(struct iwn_softc *sc, struct ieee80211vap *vap)
 {
-#defineMS(v,x) (((v)  x)  x##_S)
struct iwn_ops *ops = sc-ops;
struct ifnet *ifp = sc-sc_ifp;
struct ieee80211com *ic = ifp-if_l2com;
struct ieee80211_node *ni = vap-iv_bss;
struct iwn_node_info node;
+   uint32_t htflags = 0;
int error;
 
if (ic-ic_opmode == IEEE80211_M_MONITOR) {
@@ -5389,26 +5389,22 @@ iwn_run(struct iwn_softc *sc, struct iee
sc-rxon.cck_mask  = 0x0f;
sc-rxon.ofdm_mask = 0x15;
}
-#if 0  /* HT */
if (IEEE80211_IS_CHAN_HT(ni-ni_chan)) {
-   sc-rxon.flags = ~htole32(IWN_RXON_HT);
-   if (IEEE80211_IS_CHAN_HT40U(ni-ni_chan))
-   sc-rxon.flags |= htole32(IWN_RXON_HT40U);
-   else if (IEEE80211_IS_CHAN_HT40D(ni-ni_chan))
-   sc-rxon.flags |= htole32(IWN_RXON_HT40D);
-   else
-   sc-rxon.flags |= htole32(IWN_RXON_HT20);
-   sc-rxon.rxchain = htole16(
- IWN_RXCHAIN_VALID(3)
-   | IWN_RXCHAIN_MIMO_COUNT(3)
-   | IWN_RXCHAIN_IDLE_COUNT(1)
-   | IWN_RXCHAIN_MIMO_FORCE);
-
-   maxrxampdu = MS(ni-ni_htparam, IEEE80211_HTCAP_MAXRXAMPDU);
-   ampdudensity = MS(ni-ni_htparam, IEEE80211_HTCAP_MPDUDENSITY);
-   } else
-   maxrxampdu = ampdudensity = 0;
-#endif
+   htflags |= IWN_RXON_HT_PROTMODE(ic-ic_curhtprotmode);
+   if (IEEE80211_IS_CHAN_HT40(ni-ni_chan)) {
+   switch (ic-ic_curhtprotmode) {
+   case IEEE80211_HTINFO_OPMODE_HT20PR:
+   htflags |= IWN_RXON_HT_MODEPURE40;
+   break;
+   default:
+   htflags |= IWN_RXON_HT_MODEMIXED;
+   break;
+   }
+   }
+   if (IEEE80211_IS_CHAN_HT40D(ni-ni_chan))
+   htflags |= IWN_RXON_HT_HT40MINUS;
+   }
+   sc-rxon.flags |= htole32(htflags);
sc-rxon.filter |= htole32(IWN_FILTER_BSS);
DPRINTF(sc, IWN_DEBUG_STATE, rxon chan %d flags %x\n,
sc-rxon.chan, sc-rxon.flags);
@@ -5435,10 +5431,20 @@ iwn_run(struct iwn_softc *sc, struct iee
memset(node, 0, sizeof node);
IEEE80211_ADDR_COPY(node.macaddr, ni-ni_macaddr);
node.id = IWN_ID_BSS;
-#ifdef notyet
-   node.htflags = htole32(IWN_AMDPU_SIZE_FACTOR(3) |
-   IWN_AMDPU_DENSITY(5));  /* 2us */
-#endif
+   if (IEEE80211_IS_CHAN_HT(ni-ni_chan)) {
+   switch (ni-ni_htcap  IEEE80211_HTCAP_SMPS) {
+   case IEEE80211_HTCAP_SMPS_ENA:
+   node.htflags |= htole32(IWN_SMPS_MIMO_DIS);
+   break;
+   case IEEE80211_HTCAP_SMPS_DYNAMIC:
+   node.htflags |= htole32(IWN_SMPS_MIMO_PROT);
+   break;
+   }
+   node.htflags |= htole32(IWN_AMDPU_SIZE_FACTOR(3) |
+   IWN_AMDPU_DENSITY(5));  /* 4us */
+   if (IEEE80211_IS_CHAN_HT40(ni-ni_chan))
+   node.htflags |= htole32(IWN_NODE_HT40);
+   }
DPRINTF(sc, IWN_DEBUG_STATE, %s: adding BSS node\n, __func__);
error = ops-add_node(sc, node, 1);
if (error != 0) {
@@ -5470,7 +5476,6 @@ iwn_run(struct iwn_softc *sc, struct iee
/* Link LED always on while associated. */
iwn_set_led(sc, IWN_LED_LINK, 0, 1);
return 0;
-#undef MS
 }
 
 /*

Modified: head/sys/dev/iwn/if_iwnreg.h
==
--- head/sys/dev/iwn/if_iwnreg.hSun May  8 12:11:16 2011
(r221652)
+++ head/sys/dev/iwn/if_iwnreg.hSun May  8 12:11:20 2011
(r221653)
@@ -492,6 +492,10 @@ struct iwn_rxon {
 #define IWN_RXON_ANTENNA_A (1   8)
 #define IWN_RXON_ANTENNA_B (1   9)
 #define IWN_RXON_TSF   (1  15)
+#define IWN_RXON_HT_HT40MINUS  (1  22)
+#define IWN_RXON_HT_PROTMODE(x)(x  23)
+#define IWN_RXON_HT_MODEPURE40 (1  25)
+#define IWN_RXON_HT_MODEMIXED  (2  25)
 #define IWN_RXON_CTS_TO_SELF   (1  30)
 
uint32_tfilter;
@@ -591,7 +595,10 @@ 

svn commit: r221654 - head/sys/geom/part

2011-05-08 Thread Andrey V. Elsukov
Author: ae
Date: Sun May  8 12:16:39 2011
New Revision: 221654
URL: http://svn.freebsd.org/changeset/base/221654

Log:
  Limit number of sectors that can be addressed.
  Reject table if blkcount from metadata is greater than provider.

Modified:
  head/sys/geom/part/g_part_apm.c

Modified: head/sys/geom/part/g_part_apm.c
==
--- head/sys/geom/part/g_part_apm.c Sun May  8 12:11:20 2011
(r221653)
+++ head/sys/geom/part/g_part_apm.c Sun May  8 12:16:39 2011
(r221654)
@@ -255,7 +255,7 @@ g_part_apm_create(struct g_part_table *b
return (ENOSPC);
 
/* APM uses 32-bit LBAs. */
-   last = MIN(pp-mediasize / pp-sectorsize, 0x) - 1;
+   last = MIN(pp-mediasize / pp-sectorsize, UINT32_MAX) - 1;
 
basetable-gpt_first = 2 + basetable-gpt_entries;
basetable-gpt_last = last;
@@ -398,6 +398,8 @@ g_part_apm_probe(struct g_part_table *ba
g_free(buf);
if (table-ddr.ddr_blksize != pp-sectorsize)
return (ENXIO);
+   if (table-ddr.ddr_blkcount  pp-mediasize / pp-sectorsize)
+   return (ENXIO);
} else {
/*
 * Check for Tivo drives, which have no DDR and a different
@@ -412,7 +414,8 @@ g_part_apm_probe(struct g_part_table *ba
}
table-ddr.ddr_sig = APM_DDR_SIG;   /* XXX */
table-ddr.ddr_blksize = pp-sectorsize;/* XXX */
-   table-ddr.ddr_blkcount = pp-mediasize / pp-sectorsize;/* XXX 
*/
+   table-ddr.ddr_blkcount =
+   MIN(pp-mediasize / pp-sectorsize, UINT32_MAX);
table-tivo_series1 = 1;
g_free(buf);
}
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r221655 - head/usr.sbin/jail

2011-05-08 Thread Benedict Reuschling
Author: bcr (doc committer)
Date: Sun May  8 12:16:39 2011
New Revision: 221655
URL: http://svn.freebsd.org/changeset/base/221655

Log:
  Jails have a problem in that if the jail directory is world-readable,
  an attacker with root access to the jail can create a setuid binary for
  their own use in the host environment (if they also have this access),
  thus breaking root in the host.
  
  This exploit is impossible if the jail's files are not world-readable.
  Add instructions to the man page on how to create a jail with the
  correct permissions set.
  
  PR:   docs/156853
  Submitted by: Chris Rees (utisoft at gmail dot com)
  Reviewed by:  cperciva (security parts)
  MFC after:9 days

Modified:
  head/usr.sbin/jail/jail.8

Modified: head/usr.sbin/jail/jail.8
==
--- head/usr.sbin/jail/jail.8   Sun May  8 12:16:39 2011(r221654)
+++ head/usr.sbin/jail/jail.8   Sun May  8 12:16:39 2011(r221655)
@@ -34,7 +34,7 @@
 .\
 .\ $FreeBSD$
 .\
-.Dd January 17, 2010
+.Dd May 8, 2011
 .Dt JAIL 8
 .Os
 .Sh NAME
@@ -431,7 +431,7 @@ command script can be used:
 .Bd -literal
 D=/here/is/the/jail
 cd /usr/src
-mkdir -p $D
+mkdir -p -m 0700 $D
 make world DESTDIR=$D
 make distribution DESTDIR=$D
 mount -t devfs devfs $D/dev
@@ -448,6 +448,10 @@ in the per-jail devfs.
 A simple devfs ruleset for jails is available as ruleset #4 in
 .Pa /etc/defaults/devfs.rules .
 .Pp
+Non-superusers in the host system should not be able to access the 
+jail's files; otherwise an attacker with root access to the jail
+could obtain elevated privileges on the host.
+.Pp
 In many cases this example would put far more in the jail than needed.
 In the other extreme case a jail might contain only one file:
 the executable to be run in the jail.
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r221656 - head/sys/geom/part

2011-05-08 Thread Andrey V. Elsukov
Author: ae
Date: Sun May  8 12:20:30 2011
New Revision: 221656
URL: http://svn.freebsd.org/changeset/base/221656

Log:
  Limit number of sectors that can be addressed.
  
  MFC after:1 week

Modified:
  head/sys/geom/part/g_part_ebr.c

Modified: head/sys/geom/part/g_part_ebr.c
==
--- head/sys/geom/part/g_part_ebr.c Sun May  8 12:16:39 2011
(r221655)
+++ head/sys/geom/part/g_part_ebr.c Sun May  8 12:20:30 2011
(r221656)
@@ -288,7 +288,7 @@ g_part_ebr_create(struct g_part_table *b
if (strcmp(psn, MBR))
return (ENXIO);
 
-   msize = MIN(pp-mediasize / pp-sectorsize, 0x);
+   msize = MIN(pp-mediasize / pp-sectorsize, UINT32_MAX);
msize -= msize % basetable-gpt_sectors;
basetable-gpt_first = 0;
basetable-gpt_last = msize - 1;
@@ -464,7 +464,7 @@ g_part_ebr_read(struct g_part_table *bas
 
pp = cp-provider;
table = (struct g_part_ebr_table *)basetable;
-   msize = pp-mediasize / pp-sectorsize;
+   msize = MIN(pp-mediasize / pp-sectorsize, UINT32_MAX);
 
lba = 0;
while (1) {
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r221657 - head/sys/dev/iwn

2011-05-08 Thread Bernhard Schmidt
Author: bschmidt
Date: Sun May  8 12:23:01 2011
New Revision: 221657
URL: http://svn.freebsd.org/changeset/base/221657

Log:
  Enable 11n (sans HT40) support.

Modified:
  head/sys/dev/iwn/if_iwn.c

Modified: head/sys/dev/iwn/if_iwn.c
==
--- head/sys/dev/iwn/if_iwn.c   Sun May  8 12:20:30 2011(r221656)
+++ head/sys/dev/iwn/if_iwn.c   Sun May  8 12:23:01 2011(r221657)
@@ -599,45 +599,30 @@ iwn_attach(device_t dev)
macaddr, :);
}
 
-#if 0  /* HT */
-   /* XXX disable until HT channel setup works */
-   ic-ic_htcaps =
- IEEE80211_HTCAP_SMPS_ENA  /* SM PS mode enabled */
-   | IEEE80211_HTCAP_CHWIDTH40 /* 40MHz channel width */
-   | IEEE80211_HTCAP_SHORTGI20 /* short GI in 20MHz */
-   | IEEE80211_HTCAP_SHORTGI40 /* short GI in 40MHz */
-   | IEEE80211_HTCAP_RXSTBC_2STREAM/* 1-2 spatial streams */
-   | IEEE80211_HTCAP_MAXAMSDU_3839 /* max A-MSDU length */
-   /* s/w capabilities */
-   | IEEE80211_HTC_HT  /* HT operation */
-   | IEEE80211_HTC_AMPDU   /* tx A-MPDU */
-   | IEEE80211_HTC_AMSDU   /* tx A-MSDU */
-   ;
-
-   /* Set HT capabilities. */
-   ic-ic_htcaps =
+   if (sc-sc_flags  IWN_FLAG_HAS_11N) {
+   ic-ic_rxstream = sc-nrxchains;
+   ic-ic_txstream = sc-ntxchains;
+   ic-ic_htcaps =
+ IEEE80211_HTCAP_SMPS_OFF  /* SMPS mode disabled */
+   | IEEE80211_HTCAP_SHORTGI20 /* short GI in 20MHz */
+#ifdef notyet
+   | IEEE80211_HTCAP_CHWIDTH40 /* 40MHz channel width*/
+   | IEEE80211_HTCAP_SHORTGI40 /* short GI in 40MHz */
+   | IEEE80211_HTCAP_GREENFIELD
 #if IWN_RBUF_SIZE == 8192
-   IEEE80211_HTCAP_AMSDU7935 |
+   | IEEE80211_HTCAP_MAXAMSDU_7935 /* max A-MSDU length */
+#else
+   | IEEE80211_HTCAP_MAXAMSDU_3839 /* max A-MSDU length */
 #endif
-   IEEE80211_HTCAP_CBW20_40 |
-   IEEE80211_HTCAP_SGI20 |
-   IEEE80211_HTCAP_SGI40;
-   if (sc-hw_type != IWN_HW_REV_TYPE_4965)
-   ic-ic_htcaps |= IEEE80211_HTCAP_GF;
-   if (sc-hw_type == IWN_HW_REV_TYPE_6050)
-   ic-ic_htcaps |= IEEE80211_HTCAP_SMPS_DYN;
-   else
-   ic-ic_htcaps |= IEEE80211_HTCAP_SMPS_DIS;
 #endif
-
-#if 0  /* HT */
-   /* Set supported HT rates. */
-   ic-ic_sup_mcs[0] = 0xff;
-   if (sc-nrxchains  1)
-   ic-ic_sup_mcs[1] = 0xff;
-   if (sc-nrxchains  2)
-   ic-ic_sup_mcs[2] = 0xff;
+   /* s/w capabilities */
+   | IEEE80211_HTC_HT  /* HT operation */
+   | IEEE80211_HTC_AMPDU   /* tx A-MPDU */
+#ifdef notyet
+   | IEEE80211_HTC_AMSDU   /* tx A-MSDU */
 #endif
+   ;
+   }
 
if_initname(ifp, device_get_name(dev), device_get_unit(dev));
ifp-if_softc = sc;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r221658 - head/sys/geom/part

2011-05-08 Thread Andrey V. Elsukov
Author: ae
Date: Sun May  8 12:28:13 2011
New Revision: 221658
URL: http://svn.freebsd.org/changeset/base/221658

Log:
  Limit number of sectors that can be addressed.
  
  MFC after:1 week

Modified:
  head/sys/geom/part/g_part_vtoc8.c

Modified: head/sys/geom/part/g_part_vtoc8.c
==
--- head/sys/geom/part/g_part_vtoc8.c   Sun May  8 12:23:01 2011
(r221657)
+++ head/sys/geom/part/g_part_vtoc8.c   Sun May  8 12:28:13 2011
(r221658)
@@ -198,9 +198,7 @@ g_part_vtoc8_create(struct g_part_table 
 
table = (struct g_part_vtoc8_table *)basetable;
 
-   msize = pp-mediasize / pp-sectorsize;
-   if (msize  0xu)
-   msize = 0xu;
+   msize = MIN(pp-mediasize / pp-sectorsize, UINT32_MAX);
table-secpercyl = basetable-gpt_sectors * basetable-gpt_heads;
pcyls = msize / table-secpercyl;
acyls = 2;
@@ -392,8 +390,7 @@ g_part_vtoc8_read(struct g_part_table *b
bcopy(buf, table-vtoc, sizeof(table-vtoc));
g_free(buf);
 
-   msize = pp-mediasize / pp-sectorsize;
-
+   msize = MIN(pp-mediasize / pp-sectorsize, UINT32_MAX);
sectors = be16dec(table-vtoc.nsecs);
if (sectors  1)
goto invalid_label;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r221659 - in head/sbin: dumpfs growfs tunefs

2011-05-08 Thread Gavin Atkinson
Author: gavin
Date: Sun May  8 12:34:31 2011
New Revision: 221659
URL: http://svn.freebsd.org/changeset/base/221659

Log:
  We now have multiple filesystems (UFS, ZFS, ...), so for tools that only
  operate on one type of filesystem, mention this.
  While here, capitalise the use of UFS in growfs.8 to match other uses of
  the term in other man pages.
  
  MFC after:1 week

Modified:
  head/sbin/dumpfs/dumpfs.8
  head/sbin/growfs/growfs.8
  head/sbin/tunefs/tunefs.8

Modified: head/sbin/dumpfs/dumpfs.8
==
--- head/sbin/dumpfs/dumpfs.8   Sun May  8 12:28:13 2011(r221658)
+++ head/sbin/dumpfs/dumpfs.8   Sun May  8 12:34:31 2011(r221659)
@@ -28,12 +28,12 @@
 .\ @(#)dumpfs.8   8.1 (Berkeley) 6/5/93
 .\ $FreeBSD$
 .\
-.Dd January 28, 2009
+.Dd May 8, 2011
 .Dt DUMPFS 8
 .Os
 .Sh NAME
 .Nm dumpfs
-.Nd dump file system information
+.Nd dump UFS file system information
 .Sh SYNOPSIS
 .Nm
 .Op Fl f
@@ -42,7 +42,7 @@
 .Sh DESCRIPTION
 The
 .Nm
-utility prints out the super block and cylinder group information
+utility prints out the UFS super block and cylinder group information
 for the file system or special device specified, unless the
 .Fl f
 or

Modified: head/sbin/growfs/growfs.8
==
--- head/sbin/growfs/growfs.8   Sun May  8 12:28:13 2011(r221658)
+++ head/sbin/growfs/growfs.8   Sun May  8 12:34:31 2011(r221659)
@@ -37,12 +37,12 @@
 .\ $TSHeader: src/sbin/growfs/growfs.8,v 1.3 2000/12/12 19:31:00 tomsoft Exp $
 .\ $FreeBSD$
 .\
-.Dd September 8, 2000
+.Dd May 8, 2011
 .Dt GROWFS 8
 .Os
 .Sh NAME
 .Nm growfs
-.Nd grow size of an existing ufs file system
+.Nd grow size of an existing UFS file system
 .Sh SYNOPSIS
 .Nm
 .Op Fl Ny

Modified: head/sbin/tunefs/tunefs.8
==
--- head/sbin/tunefs/tunefs.8   Sun May  8 12:28:13 2011(r221658)
+++ head/sbin/tunefs/tunefs.8   Sun May  8 12:34:31 2011(r221659)
@@ -28,12 +28,12 @@
 .\ @(#)tunefs.8   8.2 (Berkeley) 12/11/93
 .\ $FreeBSD$
 .\
-.Dd December 9, 2010
+.Dd May 8, 2011
 .Dt TUNEFS 8
 .Os
 .Sh NAME
 .Nm tunefs
-.Nd tune up an existing file system
+.Nd tune up an existing UFS file system
 .Sh SYNOPSIS
 .Nm
 .Op Fl A
@@ -56,7 +56,7 @@
 .Sh DESCRIPTION
 The
 .Nm
-utility is designed to change the dynamic parameters of a file system
+utility is designed to change the dynamic parameters of a UFS file system
 which affect the layout policies.
 The
 .Nm
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r221550 - head/sys/powerpc/conf

2011-05-08 Thread Andreas Tobler

On 08.05.11 00:17, Attilio Rao wrote:

2011/5/6 Attilio Raoatti...@freebsd.org:

2011/5/6 Nathan Whitehornnwhiteh...@freebsd.org:

Author: nwhitehorn
Date: Fri May  6 20:43:02 2011
New Revision: 221550
URL: http://svn.freebsd.org/changeset/base/221550

Log:
  SMP has worked perfectly for a very long time on 32-bit PowerPC on both
  UP and SMP hardware. Enable it in GENERIC.



While working on largeSMP, I think there is a breakage in atomic.h.
More specifically, atomic_store_rel_long() (and related functions) are
not going to properly work because powerpc defines them as:

atomic_store_rel_long -  atomic_store_rel_32(volatile u_int *p, u_int v)

while this should really follow the long arguments.

This happens because powerpc doesn't follow the other architectures
semantic on defining the similar atomic operations.
Other arches define an hardcode version of _type version of the
function and than make a macro the _32 (or whatever) version.
In other words this is what they do:

void
atomic_store_rel_32()
{
...
}

#define atomic_store_rel_int atomic_store_rel_32

which si clearly dangerous for cases as reported above. Maybe that
could be fixed by passing sized types, rather than simply int or long
in numbered version, but I'd really prefer to follow the semantic by
other architectures and then have:

void
atomic_store_rel_int()
{
...
}

#define atomic_store_rel_32 atomic_store_rel_int

I fixed the ATOMIC_STORE_LOAD case in my code, because I needed it,
but the final cleanup is much bigger.
I can make a patch tomorrow if you can test it.



Can you please test and review this patch?:
http://www.freebsd.org/~attilio/largeSMP/atomic-powerpc.diff

Unfortunately I'm having issues with the toolchains in atm, so I can't
really neither test compile it.


I built kernel and world on both, on a 32-bit system and on a 64-bit 
system with 32-bit compat support.


The 32-bit world failed due to type punning issues from umtx.h:121ff

Attached my try to workaround these issues. With my try I can build 
both, kernel and world. Right now I have a world running with it (32-bit).
I do not know if my try is correct. Even less after reading the comments 
from Bruce.
But I think if it is on a somehow correct way, then we need something 
similar for the other _long functions on 32-bit where we go from the 
u_long to u_int. (e.g, atomic_add_long etc.)


I'm ready for more testing.

Gruss,
Andreas
--- atomic.h.attilio2011-05-08 11:00:42.0 +0200
+++ atomic.h.andreas2011-05-08 14:01:00.0 +0200
@@ -651,16 +651,27 @@
 #defineatomic_cmpset_rel_ptr(dst, old, new)
\
atomic_cmpset_rel_long((volatile u_long *)(dst), (u_long)(old), \
(u_long)(new))
-#else
-#defineatomic_cmpset_long(dst, old, new)   
\
-   atomic_cmpset_int((volatile u_int *)(dst), (u_int)(old),\
-   (u_int)(new))
-#defineatomic_cmpset_acq_long(dst, old, new)   
\
-   atomic_cmpset_acq_int((volatile u_int *)(dst), (u_int)(old),\
-   (u_int)(new))
-#defineatomic_cmpset_rel_long(dst, old, new)   
\
-   atomic_cmpset_rel_int((volatile u_int *)(dst), (u_int)(old),\
-   (u_int)(new))
+#else  /* __powerpc64__  */
+static __inline int
+atomic_cmpset_long(volatile u_long *dst, u_long old, u_long new)
+{
+   return (atomic_cmpset_int((volatile u_int *)dst, (u_int)old, 
+ (u_int)new));
+}
+
+static __inline int
+atomic_cmpset_acq_long(volatile u_long *dst, u_long old, u_long new)
+{
+   return (atomic_cmpset_acq_int((volatile u_int *)dst, (u_int)old, 
+ (u_int)new));
+}
+
+static __inline int
+atomic_cmpset_rel_long(volatile u_long *dst, u_long old, u_long new)
+{
+   return (atomic_cmpset_rel_int((volatile u_int *)dst, (u_int)old, 
+ (u_int)new));
+}
 
 #defineatomic_cmpset_ptr(dst, old, new)
\
atomic_cmpset_int((volatile u_int *)(dst), (u_int)(old),\
@@ -671,7 +682,7 @@
 #defineatomic_cmpset_rel_ptr(dst, old, new)
\
atomic_cmpset_rel_int((volatile u_int *)(dst), (u_int)(old),\
(u_int)(new))
-#endif
+#endif  /* __powerpc64__  */
 
 static __inline u_int
 atomic_fetchadd_int(volatile u_int *p, u_int v)
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org

Re: svn commit: r221645 - head/sys/geom/part

2011-05-08 Thread Bruce Evans

On Sun, 8 May 2011, Kostik Belousov wrote:


On Sun, May 08, 2011 at 11:20:27AM +, Andrey V. Elsukov wrote:

Log:
  Limit number of sectors that can be addressed.

  MFC after:1 week

Modified:
  head/sys/geom/part/g_part_pc98.c

Modified: head/sys/geom/part/g_part_pc98.c
==
--- head/sys/geom/part/g_part_pc98.cSun May  8 11:16:17 2011
(r221644)
+++ head/sys/geom/part/g_part_pc98.cSun May  8 11:20:27 2011
(r221645)
@@ -261,7 +261,7 @@ g_part_pc98_create(struct g_part_table *

cyl = basetable-gpt_heads * basetable-gpt_sectors;

-   msize = MIN(pp-mediasize / SECSIZE, 0x);
+   msize = MIN(pp-mediasize / SECSIZE, UINT_MAX);

Shouldn't this be UINT32_MAX (consistently) ?


It was that before.  This was correct, since msize has type uint32_t.
Hard-coding the 0x for the limit is no different than hard-coding
32 for the type name or limit.

Use of MIN() in the kernel is a style bug.  MIN() in the kernel was
removed in 4.4BSD, but came back to support contrib'ed code and is now
used in non-contribed- code :-(.  Here min() could be used, but is
fragile.  There is no min32() or what there should be -- a type-generic
safe macro min().  Use of the unsafe macro MIN() gives different
fragility than use of the non-type-generic but safe (non-macro) min().
This style bug is not present in the top-level geom directory, but is
common in subdirectories (66 instances).

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


svn commit: r221660 - head/bin/sh

2011-05-08 Thread Jilles Tjoelker
Author: jilles
Date: Sun May  8 14:03:44 2011
New Revision: 221660
URL: http://svn.freebsd.org/changeset/base/221660

Log:
  sh(1): Update BUGS section for UTF-8 support.

Modified:
  head/bin/sh/sh.1

Modified: head/bin/sh/sh.1
==
--- head/bin/sh/sh.1Sun May  8 12:34:31 2011(r221659)
+++ head/bin/sh/sh.1Sun May  8 14:03:44 2011(r221660)
@@ -32,7 +32,7 @@
 .\from: @(#)sh.1  8.6 (Berkeley) 5/4/95
 .\ $FreeBSD$
 .\
-.Dd May 5, 2011
+.Dd May 8, 2011
 .Dt SH 1
 .Os
 .Sh NAME
@@ -2591,4 +2591,9 @@ was originally written by
 .Sh BUGS
 The
 .Nm
-utility does not recognize multibyte characters.
+utility does not recognize multibyte characters other than UTF-8.
+Splitting using
+.Va IFS
+and the line editing library
+.Xr editline 3
+do not recognize multibyte characters.
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r221665 - head/usr.sbin/jail

2011-05-08 Thread Benedict Reuschling
Author: bcr (doc committer)
Date: Sun May  8 14:57:01 2011
New Revision: 221665
URL: http://svn.freebsd.org/changeset/base/221665

Log:
  Revert r221655:
  
  Various people voiced their concerns about these changes.
  Until this is resolved, we should use the old version.

Modified:
  head/usr.sbin/jail/jail.8

Modified: head/usr.sbin/jail/jail.8
==
--- head/usr.sbin/jail/jail.8   Sun May  8 14:56:02 2011(r221664)
+++ head/usr.sbin/jail/jail.8   Sun May  8 14:57:01 2011(r221665)
@@ -34,7 +34,7 @@
 .\
 .\ $FreeBSD$
 .\
-.Dd May 8, 2011
+.Dd January 17, 2010
 .Dt JAIL 8
 .Os
 .Sh NAME
@@ -431,7 +431,7 @@ command script can be used:
 .Bd -literal
 D=/here/is/the/jail
 cd /usr/src
-mkdir -p -m 0700 $D
+mkdir -p $D
 make world DESTDIR=$D
 make distribution DESTDIR=$D
 mount -t devfs devfs $D/dev
@@ -448,10 +448,6 @@ in the per-jail devfs.
 A simple devfs ruleset for jails is available as ruleset #4 in
 .Pa /etc/defaults/devfs.rules .
 .Pp
-Non-superusers in the host system should not be able to access the 
-jail's files; otherwise an attacker with root access to the jail
-could obtain elevated privileges on the host.
-.Pp
 In many cases this example would put far more in the jail than needed.
 In the other extreme case a jail might contain only one file:
 the executable to be run in the jail.
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r221666 - head/sys/dev/ath/ath_hal/ar5416

2011-05-08 Thread Adrian Chadd
Author: adrian
Date: Sun May  8 15:25:22 2011
New Revision: 221666
URL: http://svn.freebsd.org/changeset/base/221666

Log:
  * Add AR_SREV_KITE macro for later use
  * Modify AR_SREV_MERLIN_20() to match the Atheros/Linux ath9k behaviour -
its supposed to match Merlin 2.0 and later Merlin chips.
AR_SREV_MERLIN_20_OR_LATER() matches AR9280 2.0 and later chips
(AR9285, AR9287, etc.)

Modified:
  head/sys/dev/ath/ath_hal/ar5416/ar5416reg.h

Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416reg.h
==
--- head/sys/dev/ath/ath_hal/ar5416/ar5416reg.h Sun May  8 14:57:01 2011
(r221665)
+++ head/sys/dev/ath/ath_hal/ar5416/ar5416reg.h Sun May  8 15:25:22 2011
(r221666)
@@ -701,7 +701,7 @@
 
 #defineAR_SREV_MERLIN_20(_ah) \
(AR_SREV_MERLIN(_ah)  \
-AH_PRIVATE((_ah))-ah_macRev == AR_XSREV_REVISION_MERLIN_20)
+AH_PRIVATE((_ah))-ah_macRev = AR_XSREV_REVISION_MERLIN_20)
 
 #defineAR_SREV_MERLIN_20_OR_LATER(_ah) \
((AH_PRIVATE((_ah))-ah_macVersion  AR_XSREV_VERSION_MERLIN) ||
\
@@ -741,5 +741,6 @@
 /* Not yet implemented chips */
 #defineAR_SREV_9271(_ah)   0
 #defineAR_SREV_9287_11_OR_LATER(_ah)   0
+#defineAR_SREV_KIWI_10_OR_LATER(_ah)   0
 
 #endif /* _DEV_ATH_AR5416REG_H */
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r221667 - in head/sys/dev/ath/ath_hal: . ar9002

2011-05-08 Thread Adrian Chadd
Author: adrian
Date: Sun May  8 15:55:52 2011
New Revision: 221667
URL: http://svn.freebsd.org/changeset/base/221667

Log:
  Fix the 5ghz fast clock logic.
  
  The macro which I incorrectly copied into ah_internal.h assumed
  that it'd be called with an AR_SREV_MERLIN_20() check to ensure
  it was only enabled for Merlin (AR9280) silicon revision 2.0 or
  later.
  
  Trouble is, the 5GHz fast clock EEPROM flag is only valid for
  EEPROM revision 16 or greater; it's assumed to be enabled
  by default for Merlin rev = 2.0. This meant it'd be incorrectly
  set for AR5416 and AR9160 in 5GHz mode.
  
  This would have affected non-default clock timings such as SIFS,
  ACK and slot time. The incorrect slot time was very likely wrong
  for 5ghz mode.

Modified:
  head/sys/dev/ath/ath_hal/ah_internal.h
  head/sys/dev/ath/ath_hal/ar9002/ar9280_attach.c

Modified: head/sys/dev/ath/ath_hal/ah_internal.h
==
--- head/sys/dev/ath/ath_hal/ah_internal.h  Sun May  8 15:25:22 2011
(r221666)
+++ head/sys/dev/ath/ath_hal/ah_internal.h  Sun May  8 15:55:52 2011
(r221667)
@@ -205,7 +205,8 @@ typedef struct {
halMbssidAggrSupport: 1,
halBssidMatchSupport: 1,
hal4kbSplitTransSupport : 1,
-   halHasRxSelfLinkedTail  : 1;
+   halHasRxSelfLinkedTail  : 1,
+   halSupportsFastClock5GHz: 1;/* Hardware 
supports 5ghz fast clock; check eeprom/channel before using */
uint32_thalWirelessModes;
uint16_thalTotalQueues;
uint16_thalKeyCacheSize;
@@ -807,10 +808,21 @@ externHAL_BOOL ath_ee_FillVpdTable(uint
 extern int16_t ath_ee_interpolate(uint16_t target, uint16_t srcLeft,
uint16_t srcRight, int16_t targetLeft, int16_t targetRight);
 
-/* Whether 5ghz fast clock is needed for Merlin and later */
+/* Whether 5ghz fast clock is needed */
+/*
+ * The chipset (Merlin, AR9300/later) should set the capability flag below;
+ * this flag simply says that the hardware can do it, not that the EEPROM
+ * says it can.
+ *
+ * Merlin 2.0/2.1 chips with an EEPROM version  16 do 5ghz fast clock
+ *   if the relevant eeprom flag is set.
+ * Merlin 2.0/2.1 chips with an EEPROM version = 16 do 5ghz fast clock
+ *   by default.
+ */
 #defineIS_5GHZ_FAST_CLOCK_EN(_ah, _c) \
(IEEE80211_IS_CHAN_5GHZ(_c)  \
-   ath_hal_eepromGetFlag(ah, AR_EEP_FSTCLK_5G))
+AH_PRIVATE((_ah))-ah_caps.halSupportsFastClock5GHz  \
+   ath_hal_eepromGetFlag((_ah), AR_EEP_FSTCLK_5G))
 
 
 #endif /* _ATH_AH_INTERAL_H_ */

Modified: head/sys/dev/ath/ath_hal/ar9002/ar9280_attach.c
==
--- head/sys/dev/ath/ath_hal/ar9002/ar9280_attach.c Sun May  8 15:25:22 
2011(r221666)
+++ head/sys/dev/ath/ath_hal/ar9002/ar9280_attach.c Sun May  8 15:55:52 
2011(r221667)
@@ -787,8 +787,14 @@ ar9280FillCapabilityInfo(struct ath_hal 
pCap-halMbssidAggrSupport = AH_TRUE;
pCap-hal4AddrAggrSupport = AH_TRUE;
 
-   if (AR_SREV_MERLIN_20_OR_LATER(ah))
+   if (AR_SREV_MERLIN_20(ah)) {
pCap-halPSPollBroken = AH_FALSE;
+   /*
+* This just enables the support; it doesn't
+* state 5ghz fast clock will always be used.
+*/
+   pCap-halSupportsFastClock5GHz = AH_TRUE;
+   }
pCap-halRxStbcSupport = 1;
pCap-halTxStbcSupport = 1;
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r221668 - head/bin/sh

2011-05-08 Thread Jilles Tjoelker
Author: jilles
Date: Sun May  8 16:15:50 2011
New Revision: 221668
URL: http://svn.freebsd.org/changeset/base/221668

Log:
  sh: Optimize variable code by storing the length of the name.
  
  Obtained from:NetBSD

Modified:
  head/bin/sh/var.c
  head/bin/sh/var.h

Modified: head/bin/sh/var.c
==
--- head/bin/sh/var.c   Sun May  8 15:55:52 2011(r221667)
+++ head/bin/sh/var.c   Sun May  8 16:15:50 2011(r221668)
@@ -136,8 +136,8 @@ static const int locale_categories[7] = 
LC_COLLATE, LC_CTYPE, LC_MONETARY, LC_NUMERIC, LC_TIME, LC_MESSAGES, 0
 };
 
-static struct var **hashvar(const char *);
 static int varequal(const char *, const char *);
+static struct var *find_var(const char *, struct var ***, int *);
 static int localevar(const char *);
 
 /*
@@ -174,20 +174,18 @@ initvar(void)
struct var **vpp;
 
for (ip = varinit ; (vp = ip-var) != NULL ; ip++) {
-   if ((vp-flags  VEXPORT) == 0) {
-   vpp = hashvar(ip-text);
-   vp-next = *vpp;
-   *vpp = vp;
-   vp-text = __DECONST(char *, ip-text);
-   vp-flags = ip-flags | VSTRFIXED | VTEXTFIXED;
-   vp-func = ip-func;
-   }
+   if (find_var(ip-text, vpp, vp-name_len) != NULL)
+   continue;
+   vp-next = *vpp;
+   *vpp = vp;
+   vp-text = __DECONST(char *, ip-text);
+   vp-flags = ip-flags | VSTRFIXED | VTEXTFIXED;
+   vp-func = ip-func;
}
/*
 * PS1 depends on uid
 */
-   if ((vps1.flags  VEXPORT) == 0) {
-   vpp = hashvar(PS1=);
+   if (find_var(PS1, vpp, vps1.name_len) == NULL) {
vps1.next = *vpp;
*vpp = vps1;
vps1.text = __DECONST(char *, geteuid() ? PS1=$  : PS1=# );
@@ -323,50 +321,46 @@ void
 setvareq(char *s, int flags)
 {
struct var *vp, **vpp;
-   int len;
+   int nlen;
 
if (aflag)
flags |= VEXPORT;
-   vpp = hashvar(s);
-   for (vp = *vpp ; vp ; vp = vp-next) {
-   if (varequal(s, vp-text)) {
-   if (vp-flags  VREADONLY) {
-   len = strchr(s, '=') - s;
-   error(%.*s: is read only, len, s);
-   }
-   if (flags  VNOSET)
-   return;
-   INTOFF;
+   vp = find_var(s, vpp, nlen);
+   if (vp != NULL) {
+   if (vp-flags  VREADONLY)
+   error(%.*s: is read only, vp-name_len, s);
+   if (flags  VNOSET)
+   return;
+   INTOFF;
 
-   if (vp-func  (flags  VNOFUNC) == 0)
-   (*vp-func)(strchr(s, '=') + 1);
+   if (vp-func  (flags  VNOFUNC) == 0)
+   (*vp-func)(s + vp-name_len + 1);
 
-   if ((vp-flags  (VTEXTFIXED|VSTACK)) == 0)
-   ckfree(vp-text);
+   if ((vp-flags  (VTEXTFIXED|VSTACK)) == 0)
+   ckfree(vp-text);
 
-   vp-flags = ~(VTEXTFIXED|VSTACK|VUNSET);
-   vp-flags |= flags;
-   vp-text = s;
-
-   /*
-* We could roll this to a function, to handle it as
-* a regular variable function callback, but why bother?
-*
-* Note: this assumes iflag is not set to 1 initially.
-* As part of init(), this is called before arguments
-* are looked at.
-*/
-   if ((vp == vmpath || (vp == vmail  ! mpathset())) 
-   iflag == 1)
-   chkmail(1);
-   if ((vp-flags  VEXPORT)  localevar(s)) {
-   change_env(s, 1);
-   (void) setlocale(LC_ALL, );
-   updatecharset();
-   }
-   INTON;
-   return;
+   vp-flags = ~(VTEXTFIXED|VSTACK|VUNSET);
+   vp-flags |= flags;
+   vp-text = s;
+
+   /*
+* We could roll this to a function, to handle it as
+* a regular variable function callback, but why bother?
+*
+* Note: this assumes iflag is not set to 1 initially.
+* As part of init(), this is called before arguments
+* are looked at.
+*/
+   if ((vp == vmpath || (vp == vmail  ! mpathset())) 
+   iflag == 1)
+   

svn commit: r221669 - in head: bin/sh tools/regression/bin/sh/parser

2011-05-08 Thread Jilles Tjoelker
Author: jilles
Date: Sun May  8 17:40:10 2011
New Revision: 221669
URL: http://svn.freebsd.org/changeset/base/221669

Log:
  sh: Add \u/\U support (in $'...') for UTF-8.
  
  Because we have no iconv in base, support for other charsets is not
  possible.
  
  Note that \u/\U are processed using the locale that was active when the
  shell started. This is necessary to avoid behaviour that depends on the
  parse/execute split (for example when placing braces around an entire
  script). Therefore, UTF-8 encoding is implemented manually.

Added:
  head/tools/regression/bin/sh/parser/dollar-quote10.0   (contents, props 
changed)
  head/tools/regression/bin/sh/parser/dollar-quote11.0   (contents, props 
changed)
Modified:
  head/bin/sh/main.c
  head/bin/sh/parser.c
  head/bin/sh/sh.1
  head/bin/sh/var.c
  head/bin/sh/var.h

Modified: head/bin/sh/main.c
==
--- head/bin/sh/main.c  Sun May  8 16:15:50 2011(r221668)
+++ head/bin/sh/main.c  Sun May  8 17:40:10 2011(r221669)
@@ -76,7 +76,7 @@ __FBSDID($FreeBSD$);
 int rootpid;
 int rootshell;
 struct jmploc main_handler;
-int localeisutf8;
+int localeisutf8, initial_localeisutf8;
 
 static void read_profile(const char *);
 static char *find_dot_file(char *);
@@ -97,7 +97,7 @@ main(int argc, char *argv[])
char *shinit;
 
(void) setlocale(LC_ALL, );
-   updatecharset();
+   initcharset();
state = 0;
if (setjmp(main_handler.loc)) {
switch (exception) {

Modified: head/bin/sh/parser.c
==
--- head/bin/sh/parser.cSun May  8 16:15:50 2011(r221668)
+++ head/bin/sh/parser.cSun May  8 17:40:10 2011(r221669)
@@ -1219,6 +1219,29 @@ readcstyleesc(char *out)
  if (v == 0 || (v = 0xd800  v = 0xdfff))
  synerror(Bad escape sequence);
  /* We really need iconv here. */
+ if (initial_localeisutf8  v  127) {
+ CHECKSTRSPACE(4, out);
+ /*
+  * We cannot use wctomb() as the locale may have
+  * changed.
+  */
+ if (v = 0x7ff) {
+ USTPUTC(0xc0 | v  6, out);
+ USTPUTC(0x80 | (v  0x3f), out);
+ return out;
+ } else if (v = 0x) {
+ USTPUTC(0xe0 | v  12, out);
+ USTPUTC(0x80 | ((v  6)  0x3f), out);
+ USTPUTC(0x80 | (v  0x3f), out);
+ return out;
+ } else if (v = 0x10) {
+ USTPUTC(0xf0 | v  18, out);
+ USTPUTC(0x80 | ((v  12)  0x3f), out);
+ USTPUTC(0x80 | ((v  6)  0x3f), out);
+ USTPUTC(0x80 | (v  0x3f), out);
+ return out;
+ }
+ }
  if (v  127)
  v = '?';
  break;

Modified: head/bin/sh/sh.1
==
--- head/bin/sh/sh.1Sun May  8 16:15:50 2011(r221668)
+++ head/bin/sh/sh.1Sun May  8 17:40:10 2011(r221669)
@@ -463,8 +463,8 @@ The Unicode code point
 (eight hexadecimal digits)
 .El
 .Pp
-The sequences for Unicode code points currently only provide useful results
-for values below 128.
+The sequences for Unicode code points are currently only useful with
+UTF-8 locales.
 They reject code point 0 and UTF-16 surrogates.
 .Pp
 If an escape sequence would produce a byte with value 0,

Modified: head/bin/sh/var.c
==
--- head/bin/sh/var.c   Sun May  8 16:15:50 2011(r221668)
+++ head/bin/sh/var.c   Sun May  8 17:40:10 2011(r221669)
@@ -517,6 +517,13 @@ updatecharset(void)
localeisutf8 = !strcmp(charset, UTF-8);
 }
 
+void
+initcharset(void)
+{
+   updatecharset();
+   initial_localeisutf8 = localeisutf8;
+}
+
 /*
  * Generate a list of exported variables.  This routine is used to construct
  * the third argument to execve when executing a program.

Modified: head/bin/sh/var.h
==
--- head/bin/sh/var.h   Sun May  8 16:15:50 2011(r221668)
+++ head/bin/sh/var.h   Sun May  8 17:40:10 2011(r221669)
@@ -83,6 +83,8 @@ extern struct var vterm;
 #endif
 
 extern int localeisutf8;
+/* The parser uses the locale that was in effect at startup. */
+extern int initial_localeisutf8;
 
 /*
  * The following macros access the values of the 

Re: svn commit: r221550 - head/sys/powerpc/conf

2011-05-08 Thread Attilio Rao
2011/5/8 Andreas Tobler andre...@freebsd.org:
 On 08.05.11 00:17, Attilio Rao wrote:

 2011/5/6 Attilio Raoatti...@freebsd.org:

 2011/5/6 Nathan Whitehornnwhiteh...@freebsd.org:

 Author: nwhitehorn
 Date: Fri May  6 20:43:02 2011
 New Revision: 221550
 URL: http://svn.freebsd.org/changeset/base/221550

 Log:
  SMP has worked perfectly for a very long time on 32-bit PowerPC on both
  UP and SMP hardware. Enable it in GENERIC.


 While working on largeSMP, I think there is a breakage in atomic.h.
 More specifically, atomic_store_rel_long() (and related functions) are
 not going to properly work because powerpc defines them as:

 atomic_store_rel_long -  atomic_store_rel_32(volatile u_int *p, u_int v)

 while this should really follow the long arguments.

 This happens because powerpc doesn't follow the other architectures
 semantic on defining the similar atomic operations.
 Other arches define an hardcode version of _type version of the
 function and than make a macro the _32 (or whatever) version.
 In other words this is what they do:

 void
 atomic_store_rel_32()
 {
 ...
 }

 #define atomic_store_rel_int atomic_store_rel_32

 which si clearly dangerous for cases as reported above. Maybe that
 could be fixed by passing sized types, rather than simply int or long
 in numbered version, but I'd really prefer to follow the semantic by
 other architectures and then have:

 void
 atomic_store_rel_int()
 {
 ...
 }

 #define atomic_store_rel_32 atomic_store_rel_int

 I fixed the ATOMIC_STORE_LOAD case in my code, because I needed it,
 but the final cleanup is much bigger.
 I can make a patch tomorrow if you can test it.


 Can you please test and review this patch?:
 http://www.freebsd.org/~attilio/largeSMP/atomic-powerpc.diff

 Unfortunately I'm having issues with the toolchains in atm, so I can't
 really neither test compile it.

 I built kernel and world on both, on a 32-bit system and on a 64-bit system
 with 32-bit compat support.

 The 32-bit world failed due to type punning issues from umtx.h:121ff

 Attached my try to workaround these issues. With my try I can build both,
 kernel and world. Right now I have a world running with it (32-bit).
 I do not know if my try is correct. Even less after reading the comments
 from Bruce.
 But I think if it is on a somehow correct way, then we need something
 similar for the other _long functions on 32-bit where we go from the u_long
 to u_int. (e.g, atomic_add_long etc.)

 I'm ready for more testing.

So based on your and Bruce's feedbacks I've reworked the patch a bit:
http://www.freebsd.org/~attilio/largeSMP/atomic-powerpc2.diff

This should make type-pun correctly and avoid auto-casting on _ptr functions.

I'm sorry I couldn't even test-compile it, but I'm confident you can
fix edge cases alone.
Let me know.

Thanks,
Attilio


-- 
Peace can only be achieved by understanding - A. Einstein
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org