Re: svn commit: r244585 - in head: . sys/geom/label

2013-01-05 Thread Jaakko Heinonen
On 2013-01-04, John Baldwin wrote:
> > New Revision: 244585
> > Log:
> >   Mangle label names containing spaces, non-printable characters '%' or
> >   '"'.  Mangling is only done for label names read from file system
> >   metadata. Encoding resembles URL encoding. For example, the space
> >   character becomes %20.
> 
> Ouch, mangling spaces seems unfortunate.  I guess fixing the devctl protocol 
> is too hard, and/or we can't just encode it at the protocol layer but leave 
> the actual device names untouched?

I initially proposed changing the devctl protocol but in a private
discussion people preferred to not change the protocol. However, I think
that allowing the space character only might be possible without
changing the protocol as devd(8) can already handle strings enclosed in
double quotes. usb(4) already uses such devctl variables.

> OS X preserves spaces in volume names and those can be quite common on
> ISO images, so mangling them really does seem to be a shame if we can
> avoid it.

How important do you think this is? I understand that it's annoyance for
people upgrading their systems but labels with spaces can still be used.

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


svn commit: r245057 - head/usr.bin/grep

2013-01-05 Thread Gabor Kovesdan
Author: gabor
Date: Sat Jan  5 14:52:31 2013
New Revision: 245057
URL: http://svnweb.freebsd.org/changeset/base/245057

Log:
  - Fix handling of the case when multiple patterns are specified in a single
command line argument, separated by newlines
  
  PR:   bin/173673
  Submitted by: ache
  MFC after:1 week

Modified:
  head/usr.bin/grep/grep.c

Modified: head/usr.bin/grep/grep.c
==
--- head/usr.bin/grep/grep.cSat Jan  5 11:13:48 2013(r245056)
+++ head/usr.bin/grep/grep.cSat Jan  5 14:52:31 2013(r245057)
@@ -479,7 +479,13 @@ main(int argc, char *argv[])
grepbehave = GREP_EXTENDED;
break;
case 'e':
-   add_pattern(optarg, strlen(optarg));
+   {
+   char *token;
+   char *string = strdup(optarg);
+
+   while ((token = strsep(&string, "\n")) != NULL)
+   add_pattern(token, strlen(token));
+   }
needpattern = 0;
break;
case 'F':
@@ -668,7 +674,11 @@ main(int argc, char *argv[])
 
/* Process patterns from command line */
if (aargc != 0 && needpattern) {
-   add_pattern(*aargv, strlen(*aargv));
+   char *token;
+   char *string = strdup(*aargv);
+
+   while ((token = strsep(&string, "\n")) != NULL)
+   add_pattern(token, strlen(token));
--aargc;
++aargv;
}
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r245064 - head/sys/arm/ti/cpsw

2013-01-05 Thread Tim Kientzle
Author: kientzle
Date: Sat Jan  5 17:59:44 2013
New Revision: 245064
URL: http://svnweb.freebsd.org/changeset/base/245064

Log:
  While trying to track down the root cause for
  TX stalls in this driver, I've also had some
  time to evaluate the effectiveness of different
  watchdog strategies.
  
  This is the latest attempt, which consolidates
  all of the watchdog logic in one place and
  consistently detects TX stalls and resets within
  a couple of seconds.

Modified:
  head/sys/arm/ti/cpsw/if_cpsw.c
  head/sys/arm/ti/cpsw/if_cpswvar.h

Modified: head/sys/arm/ti/cpsw/if_cpsw.c
==
--- head/sys/arm/ti/cpsw/if_cpsw.c  Sat Jan  5 17:41:21 2013
(r245063)
+++ head/sys/arm/ti/cpsw/if_cpsw.c  Sat Jan  5 17:59:44 2013
(r245064)
@@ -98,7 +98,7 @@ static int cpsw_ioctl(struct ifnet *ifp,
 static int cpsw_init_slot_lists(struct cpsw_softc *sc);
 static void cpsw_free_slot(struct cpsw_softc *sc, struct cpsw_slot *slot);
 static void cpsw_fill_rx_queue_locked(struct cpsw_softc *sc);
-static void cpsw_watchdog(struct cpsw_softc *sc);
+static void cpsw_tx_watchdog(struct cpsw_softc *sc);
 
 static void cpsw_intr_rx_thresh(void *arg);
 static void cpsw_intr_rx(void *arg);
@@ -737,13 +737,7 @@ cpsw_start_locked(struct ifnet *ifp)
cpsw_cpdma_write_txbd_next(prev_slot->index,
   cpsw_cpdma_txbd_paddr(first_new_slot->index));
}
-   /* If tx_retires hasn't changed, then we may have
-  lost a TX interrupt, so let the timer tick. */
sc->tx_enqueues += enqueued;
-   if (sc->tx_retires_at_wd_reset != sc->tx_retires) {
-   sc->tx_retires_at_wd_reset = sc->tx_retires;
-   sc->wd_timer = 5;
-   }
sc->tx_queued += enqueued;
if (sc->tx_queued > sc->tx_max_queued) {
sc->tx_max_queued = sc->tx_queued;
@@ -771,7 +765,6 @@ cpsw_stop_locked(struct cpsw_softc *sc)
 
/* Stop tick engine */
callout_stop(&sc->wd_callout);
-   sc->wd_timer = 0;
 
/* Wait for hardware to clear pending ops. */
CPSW_GLOBAL_UNLOCK(sc);
@@ -1185,7 +1178,6 @@ cpsw_intr_tx_locked(void *arg)
}
sc->tx_retires += retires;
sc->tx_queued -= retires;
-   sc->wd_timer = 0;
}
 }
 
@@ -1206,7 +1198,7 @@ cpsw_tick(void *msc)
struct cpsw_softc *sc = msc;
 
/* Check for TX timeout */
-   cpsw_watchdog(sc);
+   cpsw_tx_watchdog(sc);
 
mii_tick(sc->mii);
 
@@ -1222,21 +1214,28 @@ cpsw_tick(void *msc)
 }
 
 static void
-cpsw_watchdog(struct cpsw_softc *sc)
+cpsw_tx_watchdog(struct cpsw_softc *sc)
 {
-   struct ifnet *ifp;
+   struct ifnet *ifp = sc->ifp;
 
-   ifp = sc->ifp;
CPSW_GLOBAL_LOCK(sc);
-   if (sc->wd_timer == 0 || --sc->wd_timer) {
-   CPSW_GLOBAL_UNLOCK(sc);
-   return;
+   if (sc->tx_retires > sc->tx_retires_at_last_tick) {
+   sc->tx_wd_timer = 0;  /* Stuff got sent. */
+   } else if (sc->tx_queued == 0) {
+   sc->tx_wd_timer = 0; /* Nothing to send. */
+   } else {
+   /* There was something to send but we didn't. */
+   ++sc->tx_wd_timer;
+   if (sc->tx_wd_timer > 3) {
+   sc->tx_wd_timer = 0;
+   ifp->if_oerrors++;
+   if_printf(ifp, "watchdog timeout\n");
+   cpsw_stop_locked(sc);
+   cpsw_init_locked(sc);
+   CPSW_DEBUGF(("watchdog reset completed\n"));
+   }
}
-
-   ifp->if_oerrors++;
-   if_printf(ifp, "watchdog timeout\n");
-   cpsw_stop_locked(sc);
-   cpsw_init_locked(sc);
+   sc->tx_retires_at_last_tick = sc->tx_retires;
CPSW_GLOBAL_UNLOCK(sc);
 }
 
@@ -1381,7 +1380,7 @@ cpsw_init_locked(void *arg)
/* Activate network interface */
sc->rx_running = 1;
sc->tx_running = 1;
-   sc->wd_timer = 0;
+   sc->tx_wd_timer = 0;
callout_reset(&sc->wd_callout, hz, cpsw_tick, sc);
sc->ifp->if_drv_flags |= IFF_DRV_RUNNING;
sc->ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;

Modified: head/sys/arm/ti/cpsw/if_cpswvar.h
==
--- head/sys/arm/ti/cpsw/if_cpswvar.h   Sat Jan  5 17:41:21 2013
(r245063)
+++ head/sys/arm/ti/cpsw/if_cpswvar.h   Sat Jan  5 17:59:44 2013
(r245064)
@@ -63,7 +63,7 @@ struct cpsw_softc {
int cpsw_media_status;
 
struct callout  wd_callout;
-   int wd_timer;
+   int tx_wd_timer;
 
bus_dma_tag_t   mbuf_dtag;
 
@@ -82,7 +82,7 @@ struct cpsw_softc {
/* Statistics */
uint32_ttx_enqueues; /* total TX bufs added to queue */
uint32_ttx_retires; /* total TX bufs removed from queue */

svn commit: r245065 - head/sys/dev/pci

2013-01-05 Thread Neel Natu
Author: neel
Date: Sat Jan  5 18:48:23 2013
New Revision: 245065
URL: http://svnweb.freebsd.org/changeset/base/245065

Log:
  Add quirk to indicate that the bhyve hostbridge is capable of supporting
  MSI and MSI-X even though it does not advertise the PCI-E capability
  itself.
  
  Obtained from:NetApp

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

Modified: head/sys/dev/pci/pci.c
==
--- head/sys/dev/pci/pci.c  Sat Jan  5 17:59:44 2013(r245064)
+++ head/sys/dev/pci/pci.c  Sat Jan  5 18:48:23 2013(r245065)
@@ -244,6 +244,7 @@ static const struct pci_quirk pci_quirks
 * but support MSI just fine.  QEMU uses the Intel 82440.
 */
{ 0x12378086, PCI_QUIRK_ENABLE_MSI_VM,  0,  0 },
+   { 0x12751275, PCI_QUIRK_ENABLE_MSI_VM,  0,  0 },/* bhyve */
 
/*
 * HPET MMIO base address may appear in Bar1 for AMD SB600 SMBus
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r245066 - head/sys/kern

2013-01-05 Thread Neel Natu
Author: neel
Date: Sat Jan  5 19:18:50 2013
New Revision: 245066
URL: http://svnweb.freebsd.org/changeset/base/245066

Log:
  Teach the kernel to recognize that it is executing inside a bhyve virtual
  machine.
  
  Obtained from:NetApp

Modified:
  head/sys/kern/subr_param.c

Modified: head/sys/kern/subr_param.c
==
--- head/sys/kern/subr_param.c  Sat Jan  5 18:48:23 2013(r245065)
+++ head/sys/kern/subr_param.c  Sat Jan  5 19:18:50 2013(r245066)
@@ -160,6 +160,7 @@ static const char *const vm_bnames[] = {
"Plex86",   /* Plex86 */
"Bochs",/* Bochs */
"Xen",  /* Xen */
+   "BHYVE",/* bhyve */
NULL
 };
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r245068 - head/sys/arm/conf

2013-01-05 Thread Tim Kientzle
Author: kientzle
Date: Sat Jan  5 20:30:10 2013
New Revision: 245068
URL: http://svnweb.freebsd.org/changeset/base/245068

Log:
  Prefer the new NFS modules

Modified:
  head/sys/arm/conf/BEAGLEBONE

Modified: head/sys/arm/conf/BEAGLEBONE
==
--- head/sys/arm/conf/BEAGLEBONESat Jan  5 20:07:28 2013
(r245067)
+++ head/sys/arm/conf/BEAGLEBONESat Jan  5 20:30:10 2013
(r245068)
@@ -62,11 +62,11 @@ options WITNESS_SKIPSPIN#Don't run wit
 
 # NFS support
 #options   NFSCL
-#options   NFSSERVER   #Network Filesystem Server
-#options   NFSCLIENT   #Network Filesystem Client
+#options   NFSD
+#options   NFSLOCKD
 
 # Uncomment this for NFS root
-#options   NFS_ROOT#NFS usable as /, requires NFSCLIENT
+#options   NFS_ROOT#NFS usable as /, requires NFSCL
 #options   BOOTP_NFSROOT
 #options   BOOTP_COMPAT
 #options   BOOTP
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r244585 - in head: . sys/geom/label

2013-01-05 Thread Pawel Jakub Dawidek
On Fri, Jan 04, 2013 at 12:24:03PM -0500, Nathan Whitehorn wrote:
> On 01/04/13 12:18, John Baldwin wrote:
> > On Saturday, December 22, 2012 08:43:12 AM Jaakko Heinonen wrote:
> >> Author: jh
> >> Date: Sat Dec 22 13:43:12 2012
> >> New Revision: 244585
> >> URL: http://svnweb.freebsd.org/changeset/base/244585
> >>
> >> Log:
> >>   Mangle label names containing spaces, non-printable characters '%' or
> >>   '"'.  Mangling is only done for label names read from file system
> >>   metadata. Encoding resembles URL encoding. For example, the space
> >>   character becomes %20.
> >>
> >>   Help by: kib
> >>   Discussed with:  imp, kib, pjd
> > Ouch, mangling spaces seems unfortunate.  I guess fixing the devctl 
> > protocol 
> > is too hard, and/or we can't just encode it at the protocol layer but leave 
> > the actual device names untouched?  OS X preserves spaces in volume names 
> > and 
> > those can be quite common on ISO images, so mangling them really does seem 
> > to 
> > be a shame if we can avoid it.
> >
> 
> On a related note, it would be *really* helpful if gpart labels were
> actually managed by gpart. This kind of thing makes predicting the path
> of a newly-labeled GPT partition extremely hard and, combined with race
> conditions and synchronization issues in glabel updating in response to
> changes in gpart, is why the installer doesn't use labels in fstab.

I fully agree that gpart should manage GEOM providers based on labels on
its own, especially that it doesn't update label by writing to
underlying provider, so GEOM tasting cannot tell glabel about changes.

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


pgpbkmllYpcbU.pgp
Description: PGP signature


svn commit: r245070 - head/sys/arm/ti/cpsw

2013-01-05 Thread Tim Kientzle
Author: kientzle
Date: Sat Jan  5 20:37:40 2013
New Revision: 245070
URL: http://svnweb.freebsd.org/changeset/base/245070

Log:
  Shuffle the TX underrun to work the same way as the RX underrun,
  as suggested by YongHyeon PYUN.

Modified:
  head/sys/arm/ti/cpsw/if_cpsw.c

Modified: head/sys/arm/ti/cpsw/if_cpsw.c
==
--- head/sys/arm/ti/cpsw/if_cpsw.c  Sat Jan  5 20:37:14 2013
(r245069)
+++ head/sys/arm/ti/cpsw/if_cpsw.c  Sat Jan  5 20:37:40 2013
(r245070)
@@ -716,26 +716,22 @@ cpsw_start_locked(struct ifnet *ifp)
if (STAILQ_EMPTY(&newslots))
return;
 
-   /* Attach new segments to the hardware TX queue. */
+   /* Attach the list of new buffers to the hardware TX queue. */
prev_slot = STAILQ_LAST(&sc->tx_active, cpsw_slot, next);
first_new_slot = STAILQ_FIRST(&newslots);
STAILQ_CONCAT(&sc->tx_active, &newslots);
if (prev_slot == NULL) {
/* Start the TX queue fresh. */
cpsw_write_4(CPSW_CPDMA_TX_HDP(0),
-cpsw_cpdma_txbd_paddr(first_new_slot->index));
+   cpsw_cpdma_txbd_paddr(first_new_slot->index));
} else {
-   /* Add packets to current queue. */
-   /* Race: The hardware might have sent the last packet
-* on the queue and stopped the transmitter just
-* before we got here.  In that case, this is a no-op,
-* but it also means there's a TX interrupt waiting
-* to be processed as soon as we release the lock here.
-* That TX interrupt can detect and recover from this
-* situation; see cpsw_intr_tx_locked.
-*/
+   /* Add buffers to end of current queue. */
cpsw_cpdma_write_txbd_next(prev_slot->index,
   cpsw_cpdma_txbd_paddr(first_new_slot->index));
+   /* If underrun, restart queue. */
+   if (cpsw_cpdma_read_txbd_flags(prev_slot->index) & CPDMA_BD_EOQ)
+   cpsw_write_4(CPSW_CPDMA_TX_HDP(0),
+   cpsw_cpdma_txbd_paddr(first_new_slot->index));
}
sc->tx_enqueues += enqueued;
sc->tx_queued += enqueued;
@@ -1091,14 +1087,10 @@ cpsw_fill_rx_queue_locked(struct cpsw_so
cpsw_write_4(CPSW_CPDMA_RX_HDP(0),
cpsw_cpdma_rxbd_paddr(next_slot->index));
} else {
-   /* Extend an existing RX queue. */
+   /* Add buffers to end of current queue. */
cpsw_cpdma_write_rxbd_next(prev_slot->index,
cpsw_cpdma_rxbd_paddr(next_slot->index));
-   /* XXX Order matters: Previous write must complete
-  before next read begins in order to avoid an
-  end-of-queue race.  I think bus_write and bus_read have
-  sufficient barriers built-in to ensure this. XXX */
-   /* If old RX queue was stopped, restart it. */
+   /* If underrun, restart queue. */
if (cpsw_cpdma_read_rxbd_flags(prev_slot->index) & 
CPDMA_BD_EOQ) {
cpsw_write_4(CPSW_CPDMA_RX_HDP(0),
cpsw_cpdma_rxbd_paddr(next_slot->index));
@@ -1170,12 +1162,6 @@ cpsw_intr_tx_locked(void *arg)
/* Tell hardware the last item we dequeued. */
cpsw_write_4(CPSW_CPDMA_TX_CP(0),
 cpsw_cpdma_txbd_paddr(last_slot->index));
-   /* If transmitter stopped and there's more, restart it. */
-   /* This resolves the race described in tx_start above. */
-   if ((last_flags & CPDMA_BD_EOQ) && (slot != NULL)) {
-   cpsw_write_4(CPSW_CPDMA_TX_HDP(0),
-cpsw_cpdma_txbd_paddr(slot->index));
-   }
sc->tx_retires += retires;
sc->tx_queued -= retires;
}
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r245071 - in head/sys/arm: broadcom/bcm2835 versatile

2013-01-05 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Sat Jan  5 21:05:16 2013
New Revision: 245071
URL: http://svnweb.freebsd.org/changeset/base/245071

Log:
  Fix background color calculation
  
  Spotted by: ray@

Modified:
  head/sys/arm/broadcom/bcm2835/bcm2835_fb.c
  head/sys/arm/versatile/versatile_clcd.c

Modified: head/sys/arm/broadcom/bcm2835/bcm2835_fb.c
==
--- head/sys/arm/broadcom/bcm2835/bcm2835_fb.c  Sat Jan  5 20:37:40 2013
(r245070)
+++ head/sys/arm/broadcom/bcm2835/bcm2835_fb.c  Sat Jan  5 21:05:16 2013
(r245071)
@@ -891,7 +891,7 @@ bcmfb_putc(video_adapter_t *adp, vm_offs
+ (sc->depth/8) * (col + sc->xmargin);
 
fg = a & 0xf ;
-   bg = (a >> 8) & 0xf;
+   bg = (a >> 4) & 0xf;
 
for (i = 0; i < BCMFB_FONT_HEIGHT; i++) {
for (j = 0, k = 7; j < 8; j++, k--) {

Modified: head/sys/arm/versatile/versatile_clcd.c
==
--- head/sys/arm/versatile/versatile_clcd.c Sat Jan  5 20:37:40 2013
(r245070)
+++ head/sys/arm/versatile/versatile_clcd.c Sat Jan  5 21:05:16 2013
(r245071)
@@ -892,7 +892,7 @@ versatilefb_putc(video_adapter_t *adp, v
+ (sc->depth/8) * (col + sc->xmargin);
 
fg = a & 0xf ;
-   bg = (a >> 8) & 0xf;
+   bg = (a >> 4) & 0xf;
 
for (i = 0; i < VERSATILE_FONT_HEIGHT; i++) {
for (j = 0, k = 7; j < 8; j++, k--) {
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r245072 - head/sbin/geom/class/journal

2013-01-05 Thread Konstantin Belousov
Author: kib
Date: Sat Jan  5 21:42:14 2013
New Revision: 245072
URL: http://svnweb.freebsd.org/changeset/base/245072

Log:
  Do not round up the size of the UFS filesystem to the fragment size
  when comparing its size with the size of the media, to determine if
  the last disk block is unused.
  
  Submitted by: Andreas Longwitz 
  Reviewed by:  pjd
  MFC after:2 weeks

Modified:
  head/sbin/geom/class/journal/geom_journal_ufs.c

Modified: head/sbin/geom/class/journal/geom_journal_ufs.c
==
--- head/sbin/geom/class/journal/geom_journal_ufs.c Sat Jan  5 21:05:16 
2013(r245071)
+++ head/sbin/geom/class/journal/geom_journal_ufs.c Sat Jan  5 21:42:14 
2013(r245072)
@@ -70,9 +70,9 @@ g_journal_ufs_using_last_sector(const ch
fs = read_superblock(prov);
if (fs == NULL)
return (0);
-   /* Provider size in 512 bytes blocks. */
-   psize = g_get_mediasize(prov) / DEV_BSIZE;
-   /* File system size in 512 bytes blocks. */
-   fssize = fsbtodb(fs, dbtofsb(fs, psize));
-   return (psize == fssize);
+   /* Provider size in 512 bytes blocks. */
+   psize = g_get_mediasize(prov) / DEV_BSIZE;
+   /* File system size in 512 bytes blocks. */
+   fssize = fsbtodb(fs, fs->fs_size);
+   return (psize <= fssize);
 }
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r245074 - head/sbin/geom/class/journal

2013-01-05 Thread Konstantin Belousov
Author: kib
Date: Sat Jan  5 21:52:38 2013
New Revision: 245074
URL: http://svnweb.freebsd.org/changeset/base/245074

Log:
  Use tabs for indentation.
  
  MFC after:2 weeks

Modified:
  head/sbin/geom/class/journal/geom_journal_ufs.c

Modified: head/sbin/geom/class/journal/geom_journal_ufs.c
==
--- head/sbin/geom/class/journal/geom_journal_ufs.c Sat Jan  5 21:52:01 
2013(r245073)
+++ head/sbin/geom/class/journal/geom_journal_ufs.c Sat Jan  5 21:52:38 
2013(r245074)
@@ -70,9 +70,9 @@ g_journal_ufs_using_last_sector(const ch
fs = read_superblock(prov);
if (fs == NULL)
return (0);
-   /* Provider size in 512 bytes blocks. */
-   psize = g_get_mediasize(prov) / DEV_BSIZE;
-   /* File system size in 512 bytes blocks. */
-   fssize = fsbtodb(fs, fs->fs_size);
-   return (psize <= fssize);
+   /* Provider size in 512 bytes blocks. */
+   psize = g_get_mediasize(prov) / DEV_BSIZE;
+   /* File system size in 512 bytes blocks. */
+   fssize = fsbtodb(fs, fs->fs_size);
+   return (psize <= fssize);
 }
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r245075 - head/usr.bin/grep/regex

2013-01-05 Thread Mark Johnston
Author: markj
Date: Sat Jan  5 22:04:40 2013
New Revision: 245075
URL: http://svnweb.freebsd.org/changeset/base/245075

Log:
  Fix a segfault when bsdgrep -i is given an empty pattern string.
  
  PR:   bin/172865
  Reviewed by:  gabor
  Approved by:  emaste (co-mentor)
  MFC after:1 week

Modified:
  head/usr.bin/grep/regex/tre-fastmatch.c

Modified: head/usr.bin/grep/regex/tre-fastmatch.c
==
--- head/usr.bin/grep/regex/tre-fastmatch.c Sat Jan  5 21:52:38 2013
(r245074)
+++ head/usr.bin/grep/regex/tre-fastmatch.c Sat Jan  5 22:04:40 2013
(r245075)
@@ -468,7 +468,7 @@ static int  fastcmp(const fastmatch_t *fg
   fg->nosub = (cflags & REG_NOSUB);\
\
   /* Cannot handle REG_ICASE with MB string */ \
-  if (fg->icase && (TRE_MB_CUR_MAX > 1))   \
+  if (fg->icase && (TRE_MB_CUR_MAX > 1) && n > 0)  \
 {  \
   DPRINT(("Cannot use fast matcher for MBS with REG_ICASE\n"));\
   return REG_BADPAT;   \
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r245079 - in head/sys/arm: arm include

2013-01-05 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Sat Jan  5 23:08:10 2013
New Revision: 245079
URL: http://svnweb.freebsd.org/changeset/base/245079

Log:
  Add hw.board.serial and hw.board.revision for exporting board-specific info

Modified:
  head/sys/arm/arm/machdep.c
  head/sys/arm/include/machdep.h

Modified: head/sys/arm/arm/machdep.c
==
--- head/sys/arm/arm/machdep.c  Sat Jan  5 22:56:16 2013(r245078)
+++ head/sys/arm/arm/machdep.c  Sat Jan  5 23:08:10 2013(r245079)
@@ -72,6 +72,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -162,8 +163,6 @@ const struct pmap_devmap *pmap_devmap_bo
 
 uint32_t board_id;
 struct arm_lbabi_tag *atag_list;
-uint32_t revision;
-uint64_t serial;
 char linux_command_line[LBABI_MAX_COMMAND_LINE + 1];
 char atags[LBABI_MAX_COMMAND_LINE * 2];
 uint32_t memstart[LBABI_MAX_BANKS];
@@ -171,6 +170,31 @@ uint32_t memsize[LBABI_MAX_BANKS];
 uint32_t membanks;
 #endif
 
+static uint32_t board_revision;
+/* hex representation of uint64_t */
+static char board_serial[32];
+
+SYSCTL_NODE(_hw, OID_AUTO, board, CTLFLAG_RD, 0, "Board attributes");
+SYSCTL_UINT(_hw_board, OID_AUTO, revision, CTLFLAG_RD,
+&board_revision, 0, "Board revision");
+SYSCTL_STRING(_hw_board, OID_AUTO, serial, CTLFLAG_RD,
+board_serial, 0, "Board serial");
+
+void
+board_set_serial(uint64_t serial)
+{
+
+   snprintf(board_serial, sizeof(board_serial)-1, 
+   "%016jx", serial);
+}
+
+void
+board_set_revision(uint32_t revision)
+{
+
+   board_revision = revision;
+}
+
 void
 sendsig(catcher, ksi, mask)
sig_t catcher;
@@ -849,6 +873,8 @@ vm_offset_t
 linux_parse_boot_param(struct arm_boot_params *abp)
 {
struct arm_lbabi_tag *walker;
+   uint32_t revision;
+   uint64_t serial;
 
/*
 * Linux boot ABI: r0 = 0, r1 is the board type (!= 0) and r2
@@ -883,9 +909,11 @@ linux_parse_boot_param(struct arm_boot_p
case ATAG_SERIAL:
serial = walker->u.tag_sn.low |
((uint64_t)walker->u.tag_sn.high << 32);
+   board_set_serial(serial);
break;
case ATAG_REVISION:
revision = walker->u.tag_rev.rev;
+   board_set_revision(revision);
break;
case ATAG_CMDLINE:
/* XXX open question: Parse this for boothowto? */

Modified: head/sys/arm/include/machdep.h
==
--- head/sys/arm/include/machdep.h  Sat Jan  5 22:56:16 2013
(r245078)
+++ head/sys/arm/include/machdep.h  Sat Jan  5 23:08:10 2013
(r245079)
@@ -37,6 +37,10 @@ void initarm_gpio_init(void);
 void initarm_late_init(void);
 int platform_devmap_init(void);
 
+/* Board-specific attributes */
+void board_set_serial(uint64_t);
+void board_set_revision(uint32_t);
+
 /* Needs to be initialised by platform_devmap_init */
 extern const struct pmap_devmap *pmap_devmap_bootstrap_table;
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r245080 - head/sys/arm/broadcom/bcm2835

2013-01-05 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Sat Jan  5 23:08:58 2013
New Revision: 245080
URL: http://svnweb.freebsd.org/changeset/base/245080

Log:
  Export board serial and board revision obtained from FDT blob

Modified:
  head/sys/arm/broadcom/bcm2835/bcm2835_machdep.c

Modified: head/sys/arm/broadcom/bcm2835/bcm2835_machdep.c
==
--- head/sys/arm/broadcom/bcm2835/bcm2835_machdep.c Sat Jan  5 23:08:10 
2013(r245079)
+++ head/sys/arm/broadcom/bcm2835/bcm2835_machdep.c Sat Jan  5 23:08:58 
2013(r245080)
@@ -78,6 +78,25 @@ initarm_gpio_init(void)
 void
 initarm_late_init(void)
 {
+   phandle_t system;
+   pcell_t cells[2];
+   int len;
+
+   /*
+* It seems there is no way to let syscons framework know
+* that framebuffer resolution has changed. So just try
+* to fetch data from FDT and go with defaults if failed
+*/
+   system = OF_finddevice("/system");
+   if (system != 0) {
+   len = OF_getprop(system, "linux,serial", &cells, sizeof(cells));
+   if (len > 0)
+   board_set_serial(fdt64_to_cpu(*((uint64_t *)cells)));
+
+   len = OF_getprop(system, "linux,revision", &cells, 
sizeof(cells));
+   if (len > 0)
+   board_set_revision(fdt32_to_cpu(*((uint32_t *)cells)));
+   }
 }
 
 #define FDT_DEVMAP_MAX (2) // FIXME
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r245057 - head/usr.bin/grep

2013-01-05 Thread Andrey Chernov
Thanks. I think the fix below can be improved further, because strdup(3)
is unneeded here and can be omitted. We don't have either constant
argument nor want to preserve it.

On 05.01.2013 18:52, Gabor Kovesdan wrote:
>   case 'e':
> - add_pattern(optarg, strlen(optarg));
> + {
> + char *token;
> + char *string = strdup(optarg);
> +
> + while ((token = strsep(&string, "\n")) != NULL)
> + add_pattern(token, strlen(token));
> + }
>   needpattern = 0;
>   break;
>   case 'F':
> @@ -668,7 +674,11 @@ main(int argc, char *argv[])
>  
>   /* Process patterns from command line */
>   if (aargc != 0 && needpattern) {
> - add_pattern(*aargv, strlen(*aargv));
> + char *token;
> + char *string = strdup(*aargv);
> +
> + while ((token = strsep(&string, "\n")) != NULL)
> + add_pattern(token, strlen(token));
>   --aargc;
>   ++aargv;
>   }
> 

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


svn commit: r245083 - in head/sys/arm: arm include

2013-01-05 Thread Andrew Turner
Author: andrew
Date: Sun Jan  6 00:42:09 2013
New Revision: 245083
URL: http://svnweb.freebsd.org/changeset/base/245083

Log:
  Only work around errata when we are on a part where the erratum applies.
  
  Reviewed by:  gonzo

Modified:
  head/sys/arm/arm/pl310.c
  head/sys/arm/include/pl310.h

Modified: head/sys/arm/arm/pl310.c
==
--- head/sys/arm/arm/pl310.cSun Jan  6 00:38:25 2013(r245082)
+++ head/sys/arm/arm/pl310.cSun Jan  6 00:42:09 2013(r245083)
@@ -135,11 +135,12 @@ pl310_cache_sync(void)
return;
 
 #ifdef PL310_ERRATA_753970
-   /* Write uncached PL310 register */
-   pl310_write4(pl310_softc, 0x740, 0x);
-#else
-   pl310_write4(pl310_softc, PL310_CACHE_SYNC, 0x);
+   if (sc->sc_rtl_release == CACHE_ID_RELEASE_r3p0)
+   /* Write uncached PL310 register */
+   pl310_write4(pl310_softc, 0x740, 0x);
+   else
 #endif
+   pl310_write4(pl310_softc, PL310_CACHE_SYNC, 0x);
 }
 
 
@@ -152,13 +153,17 @@ pl310_wbinv_all(void)
 
PL310_LOCK(pl310_softc);
 #ifdef PL310_ERRATA_727915
-   platform_pl310_write_debug(pl310_softc, 3);
+   if (sc->sc_rtl_release == CACHE_ID_RELEASE_r2p0 ||
+   sc->sc_rtl_release == CACHE_ID_RELEASE_r3p0)
+   platform_pl310_write_debug(pl310_softc, 3);
 #endif
pl310_write4(pl310_softc, PL310_CLEAN_INV_WAY, g_l2cache_way_mask);
pl310_wait_background_op(PL310_CLEAN_INV_WAY, g_l2cache_way_mask);
pl310_cache_sync();
 #ifdef PL310_ERRATA_727915
-   platform_pl310_write_debug(pl310_softc, 0);
+   if (sc->sc_rtl_release == CACHE_ID_RELEASE_r2p0 ||
+   sc->sc_rtl_release == CACHE_ID_RELEASE_r3p0)
+   platform_pl310_write_debug(pl310_softc, 0);
 #endif
PL310_UNLOCK(pl310_softc);
 }
@@ -182,27 +187,32 @@ pl310_wbinv_range(vm_paddr_t start, vm_s
 
 
 #ifdef PL310_ERRATA_727915
-   platform_pl310_write_debug(pl310_softc, 3);
+   if (sc->sc_rtl_release == CACHE_ID_RELEASE_r2p0 ||
+   sc->sc_rtl_release == CACHE_ID_RELEASE_r3p0)
+   platform_pl310_write_debug(pl310_softc, 3);
 #endif
while (size > 0) {
 #ifdef PL310_ERRATA_588369
-   /* 
-* Errata 588369 says that clean + inv may keep the 
-* cache line if it was clean, the recommanded workaround
-* is to clean then invalidate the cache line, with
-* write-back and cache linefill disabled
-*/
-  
-   pl310_write4(pl310_softc, PL310_CLEAN_LINE_PA, start);
-   pl310_write4(pl310_softc, PL310_INV_LINE_PA, start);
-#else
-   pl310_write4(pl310_softc, PL310_CLEAN_INV_LINE_PA, start);
+   if (sc->sc_rtl_release <= CACHE_ID_RELEASE_r1p0) {
+   /* 
+* Errata 588369 says that clean + inv may keep the 
+* cache line if it was clean, the recommanded
+* workaround is to clean then invalidate the cache
+* line, with write-back and cache linefill disabled.
+*/
+   pl310_write4(pl310_softc, PL310_CLEAN_LINE_PA, start);
+   pl310_write4(pl310_softc, PL310_INV_LINE_PA, start);
+   } else
 #endif
+   pl310_write4(pl310_softc, PL310_CLEAN_INV_LINE_PA,
+   start);
start += g_l2cache_line_size;
size -= g_l2cache_line_size;
}
 #ifdef PL310_ERRATA_727915
-   platform_pl310_write_debug(pl310_softc, 0);
+   if (sc->sc_rtl_release == CACHE_ID_RELEASE_r2p0 ||
+   sc->sc_rtl_release == CACHE_ID_RELEASE_r3p0)
+   platform_pl310_write_debug(pl310_softc, 0);
 #endif
 
pl310_cache_sync();
@@ -307,6 +317,8 @@ pl310_attach(device_t dev)
pl310_filter, NULL, sc, &sc->sc_irq_h);
 
cache_id = pl310_read4(sc, PL310_CACHE_ID);
+   sc->sc_rtl_release = (cache_id >> CACHE_ID_RELEASE_SHIFT) &
+   CACHE_ID_RELEASE_MASK;
device_printf(dev, "Part number: 0x%x, release: 0x%x\n",
(cache_id >> CACHE_ID_PARTNUM_SHIFT) & CACHE_ID_PARTNUM_MASK,
(cache_id >> CACHE_ID_RELEASE_SHIFT) & CACHE_ID_RELEASE_MASK);

Modified: head/sys/arm/include/pl310.h
==
--- head/sys/arm/include/pl310.hSun Jan  6 00:38:25 2013
(r245082)
+++ head/sys/arm/include/pl310.hSun Jan  6 00:42:09 2013
(r245083)
@@ -131,6 +131,7 @@ struct pl310_softc {
void*   sc_irq_h;
int sc_enabled;
struct mtx  sc_mtx;
+   u_int   sc_rtl_revision;
 };
 
 /**
___
svn

svn commit: r245084 - head/lib/libc/arm/softfloat

2013-01-05 Thread Andrew Turner
Author: andrew
Date: Sun Jan  6 00:49:06 2013
New Revision: 245084
URL: http://svnweb.freebsd.org/changeset/base/245084

Log:
  Silence a clang warning by telling it we are only interested in left
  shifting the lower 32bits of the floating point value when we demangle it.

Modified:
  head/lib/libc/arm/softfloat/arm-gcc.h

Modified: head/lib/libc/arm/softfloat/arm-gcc.h
==
--- head/lib/libc/arm/softfloat/arm-gcc.h   Sun Jan  6 00:42:09 2013
(r245083)
+++ head/lib/libc/arm/softfloat/arm-gcc.h   Sun Jan  6 00:49:06 2013
(r245084)
@@ -95,7 +95,7 @@ what the endianness of the CPU.  VFP is 
 #define FLOAT64_DEMANGLE(a)(a)
 #define FLOAT64_MANGLE(a)  (a)
 #else
-#define FLOAT64_DEMANGLE(a)(((a) << 32) | ((a) >> 32))
+#define FLOAT64_DEMANGLE(a)a) & 0xul) << 32) | ((a) >> 32))
 #define FLOAT64_MANGLE(a)  FLOAT64_DEMANGLE(a)
 #endif
 #endif
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r245087 - head/sys/arm/arm

2013-01-05 Thread Andrew Turner
Author: andrew
Date: Sun Jan  6 01:17:36 2013
New Revision: 245087
URL: http://svnweb.freebsd.org/changeset/base/245087

Log:
  Fix the build:
  
   * Use pl310_softc when the softc is otherwise unavailable.
   * Use the correct spelling of sc_rtl_revision.

Modified:
  head/sys/arm/arm/pl310.c

Modified: head/sys/arm/arm/pl310.c
==
--- head/sys/arm/arm/pl310.cSun Jan  6 01:11:45 2013(r245086)
+++ head/sys/arm/arm/pl310.cSun Jan  6 01:17:36 2013(r245087)
@@ -135,7 +135,7 @@ pl310_cache_sync(void)
return;
 
 #ifdef PL310_ERRATA_753970
-   if (sc->sc_rtl_release == CACHE_ID_RELEASE_r3p0)
+   if (pl310_softc->sc_rtl_revision == CACHE_ID_RELEASE_r3p0)
/* Write uncached PL310 register */
pl310_write4(pl310_softc, 0x740, 0x);
else
@@ -153,16 +153,16 @@ pl310_wbinv_all(void)
 
PL310_LOCK(pl310_softc);
 #ifdef PL310_ERRATA_727915
-   if (sc->sc_rtl_release == CACHE_ID_RELEASE_r2p0 ||
-   sc->sc_rtl_release == CACHE_ID_RELEASE_r3p0)
+   if (pl310_softc->sc_rtl_revision == CACHE_ID_RELEASE_r2p0 ||
+   pl310_softc->sc_rtl_revision == CACHE_ID_RELEASE_r3p0)
platform_pl310_write_debug(pl310_softc, 3);
 #endif
pl310_write4(pl310_softc, PL310_CLEAN_INV_WAY, g_l2cache_way_mask);
pl310_wait_background_op(PL310_CLEAN_INV_WAY, g_l2cache_way_mask);
pl310_cache_sync();
 #ifdef PL310_ERRATA_727915
-   if (sc->sc_rtl_release == CACHE_ID_RELEASE_r2p0 ||
-   sc->sc_rtl_release == CACHE_ID_RELEASE_r3p0)
+   if (pl310_softc->sc_rtl_revision == CACHE_ID_RELEASE_r2p0 ||
+   pl310_softc->sc_rtl_revision == CACHE_ID_RELEASE_r3p0)
platform_pl310_write_debug(pl310_softc, 0);
 #endif
PL310_UNLOCK(pl310_softc);
@@ -187,13 +187,13 @@ pl310_wbinv_range(vm_paddr_t start, vm_s
 
 
 #ifdef PL310_ERRATA_727915
-   if (sc->sc_rtl_release == CACHE_ID_RELEASE_r2p0 ||
-   sc->sc_rtl_release == CACHE_ID_RELEASE_r3p0)
+   if (pl310_softc->sc_rtl_revision == CACHE_ID_RELEASE_r2p0 ||
+   pl310_softc->sc_rtl_revision == CACHE_ID_RELEASE_r3p0)
platform_pl310_write_debug(pl310_softc, 3);
 #endif
while (size > 0) {
 #ifdef PL310_ERRATA_588369
-   if (sc->sc_rtl_release <= CACHE_ID_RELEASE_r1p0) {
+   if (pl310_softc->sc_rtl_revision <= CACHE_ID_RELEASE_r1p0) {
/* 
 * Errata 588369 says that clean + inv may keep the 
 * cache line if it was clean, the recommanded
@@ -210,8 +210,8 @@ pl310_wbinv_range(vm_paddr_t start, vm_s
size -= g_l2cache_line_size;
}
 #ifdef PL310_ERRATA_727915
-   if (sc->sc_rtl_release == CACHE_ID_RELEASE_r2p0 ||
-   sc->sc_rtl_release == CACHE_ID_RELEASE_r3p0)
+   if (pl310_softc->sc_rtl_revision == CACHE_ID_RELEASE_r2p0 ||
+   pl310_softc->sc_rtl_revision == CACHE_ID_RELEASE_r3p0)
platform_pl310_write_debug(pl310_softc, 0);
 #endif
 
@@ -317,7 +317,7 @@ pl310_attach(device_t dev)
pl310_filter, NULL, sc, &sc->sc_irq_h);
 
cache_id = pl310_read4(sc, PL310_CACHE_ID);
-   sc->sc_rtl_release = (cache_id >> CACHE_ID_RELEASE_SHIFT) &
+   sc->sc_rtl_revision = (cache_id >> CACHE_ID_RELEASE_SHIFT) &
CACHE_ID_RELEASE_MASK;
device_printf(dev, "Part number: 0x%x, release: 0x%x\n",
(cache_id >> CACHE_ID_PARTNUM_SHIFT) & CACHE_ID_PARTNUM_MASK,
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r245091 - head/bin/ls

2013-01-05 Thread Andrew Turner
Author: andrew
Date: Sun Jan  6 02:50:38 2013
New Revision: 245091
URL: http://svnweb.freebsd.org/changeset/base/245091

Log:
  When WCHAR_MIN == 0 the check if a wchar_t value will always be true. In
  this case skip the test as gcc complains it is always true.

Modified:
  head/bin/ls/util.c

Modified: head/bin/ls/util.c
==
--- head/bin/ls/util.c  Sun Jan  6 01:46:01 2013(r245090)
+++ head/bin/ls/util.c  Sun Jan  6 02:50:38 2013(r245091)
@@ -184,7 +184,10 @@ prn_octal(const char *s)
for (i = 0; i < (int)clen; i++)
putchar((unsigned char)s[i]);
len += wcwidth(wc);
-   } else if (goodchar && f_octal_escape && wc >= 0 &&
+   } else if (goodchar && f_octal_escape &&
+#if WCHAR_MIN < 0
+wc >= 0 &&
+#endif
wc <= (wchar_t)UCHAR_MAX &&
(p = strchr(esc, (char)wc)) != NULL) {
putchar('\\');
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r245093 - head/usr.bin/ul

2013-01-05 Thread Andrew Turner
Author: andrew
Date: Sun Jan  6 03:08:27 2013
New Revision: 245093
URL: http://svnweb.freebsd.org/changeset/base/245093

Log:
  Fix a signed/unsigned comparison when wchar_t is unsigned by casting the
  wchar_t to a wint_t.

Modified:
  head/usr.bin/ul/ul.c

Modified: head/usr.bin/ul/ul.c
==
--- head/usr.bin/ul/ul.cSun Jan  6 02:52:23 2013(r245092)
+++ head/usr.bin/ul/ul.cSun Jan  6 03:08:27 2013(r245093)
@@ -280,7 +280,7 @@ filter(FILE *f)
obuf[col].c_width = w;
for (i = 1; i < w; i++)
obuf[col + i].c_width = -1;
-   } else if (obuf[col].c_char == c) {
+   } else if ((wint_t)obuf[col].c_char == c) {
for (i = 0; i < w; i++)
obuf[col + i].c_mode |= BOLD|mode;
} else {
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r245097 - head/sys/net80211

2013-01-05 Thread Adrian Chadd
Author: adrian
Date: Sun Jan  6 04:38:31 2013
New Revision: 245097
URL: http://svnweb.freebsd.org/changeset/base/245097

Log:
  Handle HWMP if_transmit() failure gracefully.
  
  If if_transmit() fails, the node ref may need freeing.
  
  This is based on the same logic used by the ageq, which the mesh code
  (re) uses for frames which need to be staged before transmitting.
  It also does the same thing - if M_ENCAP is set on the mbuf, it treats
  the recvif pointer as a node reference and derefs it.

Modified:
  head/sys/net80211/ieee80211_hwmp.c

Modified: head/sys/net80211/ieee80211_hwmp.c
==
--- head/sys/net80211/ieee80211_hwmp.c  Sun Jan  6 03:51:44 2013
(r245096)
+++ head/sys/net80211/ieee80211_hwmp.c  Sun Jan  6 04:38:31 2013
(r245097)
@@ -1227,6 +1227,8 @@ hwmp_recv_prep(struct ieee80211vap *vap,
struct mbuf *m, *next;
uint32_t metric = 0;
const uint8_t *addr;
+   int is_encap;
+   struct ieee80211_node *ni_encap;
 
if (ni == vap->iv_bss ||
ni->ni_mlstate != IEEE80211_NODE_MESH_ESTABLISHED)
@@ -1403,11 +1405,21 @@ hwmp_recv_prep(struct ieee80211vap *vap,
(struct ieee80211_node *)(uintptr_t)
ieee80211_mac_hash(ic, addr)); /* either dest or ext_dest */
for (; m != NULL; m = next) {
+   is_encap = !! (m->m_flags & M_ENCAP);
+   ni_encap = (struct ieee80211_node *) m->m_pkthdr.rcvif;
next = m->m_nextpkt;
m->m_nextpkt = NULL;
IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, ni,
"flush queued frame %p len %d", m, m->m_pkthdr.len);
-   ifp->if_transmit(ifp, m);
+
+   /*
+* If the mbuf has M_ENCAP set, ensure we free it.
+* Note that after if_transmit() is called, m is invalid.
+*/
+   if (ifp->if_transmit(ifp, m) != 0) {
+   if (is_encap)
+   ieee80211_free_node(ni_encap);
+   }
}
 #undef IS_PROXY
 #undef PROXIED_BY_US
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r245098 - head/sys/net80211

2013-01-05 Thread Adrian Chadd
Author: adrian
Date: Sun Jan  6 04:40:07 2013
New Revision: 245098
URL: http://svnweb.freebsd.org/changeset/base/245098

Log:
  Handle ps-poll data frame if_transmit() failure.
  
  If the data frame transmission failures, it may have a node reference
  that needs cleaning up.
  
  If the frame is marked as M_ENCAP then it should treat recvif as a node
  reference and clear it.
  
  Now - since the mbuf has been freed by calling if_transmit() (even on
  failure), the mbuf has to be treated as invalid.  Hence why the ifp is
  used.

Modified:
  head/sys/net80211/ieee80211_hostap.c

Modified: head/sys/net80211/ieee80211_hostap.c
==
--- head/sys/net80211/ieee80211_hostap.cSun Jan  6 04:38:31 2013
(r245097)
+++ head/sys/net80211/ieee80211_hostap.cSun Jan  6 04:40:07 2013
(r245098)
@@ -2324,5 +2324,19 @@ ieee80211_recv_pspoll(struct ieee80211_n
ifp = vap->iv_ic->ic_ifp;
else
ifp = vap->iv_ifp;
-   (void) ifp->if_transmit(ifp, m);
+
+   /*
+* Free any node ref which this mbuf may have.
+*
+* Much like psq_mfree(), we assume that M_ENCAP nodes have
+* node references.
+*/
+   if (ifp->if_transmit(ifp, m) != 0) {
+   /*
+* XXX m is invalid (freed) at this point, determine M_ENCAP
+* an alternate way.
+*/
+   if (ifp == vap->iv_ic->ic_ifp)
+   ieee80211_free_node(ni);
+   }
 }
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r245101 - head/gnu/usr.bin/binutils/ld

2013-01-05 Thread Andrew Turner
Author: andrew
Date: Sun Jan  6 07:14:04 2013
New Revision: 245101
URL: http://svnweb.freebsd.org/changeset/base/245101

Log:
  Set the correct relocation type for R_ARM_TARGET2 to R_ARM_GOT_PREL. The
  TARGET2 relocation is unused in the current ABI but this change is
  required for EABI support.

Modified:
  head/gnu/usr.bin/binutils/ld/armelf_fbsd.sh
  head/gnu/usr.bin/binutils/ld/armelfb_fbsd.sh

Modified: head/gnu/usr.bin/binutils/ld/armelf_fbsd.sh
==
--- head/gnu/usr.bin/binutils/ld/armelf_fbsd.sh Sun Jan  6 05:37:26 2013
(r245100)
+++ head/gnu/usr.bin/binutils/ld/armelf_fbsd.sh Sun Jan  6 07:14:04 2013
(r245101)
@@ -1,6 +1,7 @@
 # $FreeBSD$
 . ${srcdir}/emulparams/armelf.sh
 . ${srcdir}/emulparams/elf_fbsd.sh
+TARGET2_TYPE=got-rel
 MAXPAGESIZE=0x8000
 GENERATE_PIE_SCRIPT=yes
 

Modified: head/gnu/usr.bin/binutils/ld/armelfb_fbsd.sh
==
--- head/gnu/usr.bin/binutils/ld/armelfb_fbsd.shSun Jan  6 05:37:26 
2013(r245100)
+++ head/gnu/usr.bin/binutils/ld/armelfb_fbsd.shSun Jan  6 07:14:04 
2013(r245101)
@@ -5,6 +5,7 @@
 #OUTPUT_FORMAT="elf32-bigarm"
 . ${srcdir}/emulparams/armelf.sh
 . ${srcdir}/emulparams/elf_fbsd.sh
+TARGET2_TYPE=got-rel
 MAXPAGESIZE=0x8000
 GENERATE_PIE_SCRIPT=yes
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"