svn commit: r194569 - head/sys/dev/fxp

2009-06-21 Thread Pyun YongHyeon
Author: yongari
Date: Sun Jun 21 06:06:43 2009
New Revision: 194569
URL: http://svn.freebsd.org/changeset/base/194569

Log:
  Introduce Rx mbuf dma tag and use it in Rx path. Previously it used
  common mbuf dma tag for both Tx and Rx path but Rx buffer should
  have single DMA segment and maximum buffer size of the segment
  should be less than MCLBYTES.
  fxp(4) also have to check Tx completion status which was updated by
  DMA so we need BUS_DMASYNC_PREREAD and BUS_DMASYNC_POSTWRITE
  synchronization in Tx path. Fix all misuse of bus_dmamap_sync(9) in
  fxp(4). I guess this change shall fix occasional driver breakage in
  PAE environments.
  
  While I'm here add error messages of dma tag/buffer creation and
  correct messages.

Modified:
  head/sys/dev/fxp/if_fxp.c
  head/sys/dev/fxp/if_fxpvar.h

Modified: head/sys/dev/fxp/if_fxp.c
==
--- head/sys/dev/fxp/if_fxp.c   Sun Jun 21 02:49:21 2009(r194568)
+++ head/sys/dev/fxp/if_fxp.c   Sun Jun 21 06:06:43 2009(r194569)
@@ -642,9 +642,18 @@ fxp_attach(device_t dev)
BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL,
sc-maxsegsize * sc-maxtxseg + sizeof(struct ether_vlan_header),
sc-maxtxseg, sc-maxsegsize, 0,
-   busdma_lock_mutex, Giant, sc-fxp_mtag);
+   busdma_lock_mutex, Giant, sc-fxp_txmtag);
if (error) {
-   device_printf(dev, could not allocate dma tag\n);
+   device_printf(dev, could not create TX DMA tag\n);
+   goto fail;
+   }
+
+   error = bus_dma_tag_create(bus_get_dma_tag(dev), 2, 0,
+   BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL,
+   MCLBYTES, 1, MCLBYTES, 0,
+   busdma_lock_mutex, Giant, sc-fxp_rxmtag);
+   if (error) {
+   device_printf(dev, could not create RX DMA tag\n);
goto fail;
}
 
@@ -653,18 +662,20 @@ fxp_attach(device_t dev)
sizeof(struct fxp_stats), 1, sizeof(struct fxp_stats), 0,
busdma_lock_mutex, Giant, sc-fxp_stag);
if (error) {
-   device_printf(dev, could not allocate dma tag\n);
+   device_printf(dev, could not create stats DMA tag\n);
goto fail;
}
 
error = bus_dmamem_alloc(sc-fxp_stag, (void **)sc-fxp_stats,
BUS_DMA_NOWAIT | BUS_DMA_ZERO, sc-fxp_smap);
-   if (error)
+   if (error) {
+   device_printf(dev, could not allocate stats DMA memory\n);
goto fail;
+   }
error = bus_dmamap_load(sc-fxp_stag, sc-fxp_smap, sc-fxp_stats,
sizeof(struct fxp_stats), fxp_dma_map_addr, sc-stats_addr, 0);
if (error) {
-   device_printf(dev, could not map the stats buffer\n);
+   device_printf(dev, could not load the stats DMA buffer\n);
goto fail;
}
 
@@ -673,20 +684,22 @@ fxp_attach(device_t dev)
FXP_TXCB_SZ, 1, FXP_TXCB_SZ, 0,
busdma_lock_mutex, Giant, sc-cbl_tag);
if (error) {
-   device_printf(dev, could not allocate dma tag\n);
+   device_printf(dev, could not create TxCB DMA tag\n);
goto fail;
}
 
error = bus_dmamem_alloc(sc-cbl_tag, (void **)sc-fxp_desc.cbl_list,
BUS_DMA_NOWAIT | BUS_DMA_ZERO, sc-cbl_map);
-   if (error)
+   if (error) {
+   device_printf(dev, could not allocate TxCB DMA memory\n);
goto fail;
+   }
 
error = bus_dmamap_load(sc-cbl_tag, sc-cbl_map,
sc-fxp_desc.cbl_list, FXP_TXCB_SZ, fxp_dma_map_addr,
sc-fxp_desc.cbl_addr, 0);
if (error) {
-   device_printf(dev, could not map DMA memory\n);
+   device_printf(dev, could not load TxCB DMA buffer\n);
goto fail;
}
 
@@ -695,18 +708,23 @@ fxp_attach(device_t dev)
sizeof(struct fxp_cb_mcs), 1, sizeof(struct fxp_cb_mcs), 0,
busdma_lock_mutex, Giant, sc-mcs_tag);
if (error) {
-   device_printf(dev, could not allocate dma tag\n);
+   device_printf(dev,
+   could not create multicast setup DMA tag\n);
goto fail;
}
 
error = bus_dmamem_alloc(sc-mcs_tag, (void **)sc-mcsp,
-   BUS_DMA_NOWAIT, sc-mcs_map);
-   if (error)
+   BUS_DMA_NOWAIT | BUS_DMA_ZERO, sc-mcs_map);
+   if (error) {
+   device_printf(dev,
+   could not allocate multicast setup DMA memory\n);
goto fail;
+   }
error = bus_dmamap_load(sc-mcs_tag, sc-mcs_map, sc-mcsp,
sizeof(struct fxp_cb_mcs), fxp_dma_map_addr, sc-mcs_addr, 0);
if (error) {
-   device_printf(dev, can't map the multicast setup command\n);
+   device_printf(dev,
+   can't load the multicast setup DMA 

svn commit: r194570 - head/sys/dev/fxp

2009-06-21 Thread Pyun YongHyeon
Author: yongari
Date: Sun Jun 21 06:18:19 2009
New Revision: 194570
URL: http://svn.freebsd.org/changeset/base/194570

Log:
  Due to possible PCI bus lock-up issues fxp(4) didn't perform full
  hardware reset in attach phase. Selective reset does not clear
  configured parameters so I think full hardware reset is required.
  To prevent PCI bus lock-up, do selective reset first which will get
  off the controller from PCI bus and request software reset after
  selective reset. Software reset will unmask interrupts so disable
  it after the reset.

Modified:
  head/sys/dev/fxp/if_fxp.c

Modified: head/sys/dev/fxp/if_fxp.c
==
--- head/sys/dev/fxp/if_fxp.c   Sun Jun 21 06:06:43 2009(r194569)
+++ head/sys/dev/fxp/if_fxp.c   Sun Jun 21 06:18:19 2009(r194570)
@@ -466,10 +466,14 @@ fxp_attach(device_t dev)
}
 
/*
-* Reset to a stable state.
+* Put CU/RU idle state and prepare full reset.
 */
CSR_WRITE_4(sc, FXP_CSR_PORT, FXP_PORT_SELECTIVE_RESET);
DELAY(10);
+   /* Full reset and disable interrupts. */
+   CSR_WRITE_4(sc, FXP_CSR_PORT, FXP_PORT_SOFTWARE_RESET);
+   DELAY(10);
+   CSR_WRITE_1(sc, FXP_CSR_SCB_INTRCNTL, FXP_SCB_INTR_DISABLE);
 
/*
 * Find out how large of an SEEPROM we have.
___
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: r194571 - head/sys/dev/fxp

2009-06-21 Thread Pyun YongHyeon
Author: yongari
Date: Sun Jun 21 06:27:35 2009
New Revision: 194571
URL: http://svn.freebsd.org/changeset/base/194571

Log:
  Don't blindly enable Rx lock-up workaround. Newer chips do not need
  the Rx lock-up workaround.
  
  Obtained from:NetBSD

Modified:
  head/sys/dev/fxp/if_fxp.c
  head/sys/dev/fxp/if_fxpvar.h

Modified: head/sys/dev/fxp/if_fxp.c
==
--- head/sys/dev/fxp/if_fxp.c   Sun Jun 21 06:18:19 2009(r194570)
+++ head/sys/dev/fxp/if_fxp.c   Sun Jun 21 06:27:35 2009(r194571)
@@ -500,6 +500,13 @@ fxp_attach(device_t dev)
sc-flags |= FXP_FLAG_WOLCAP;
}
 
+   /* Receiver lock-up workaround detection. */
+   fxp_read_eeprom(sc, data, 3, 1);
+   if ((data  0x03) != 0x03) {
+   sc-flags |= FXP_FLAG_RXBUG;
+   device_printf(dev, Enabling Rx lock-up workaround\n);
+   }
+
/*
 * Determine whether we must use the 503 serial interface.
 */
@@ -2021,7 +2028,7 @@ fxp_tick(void *xsc)
if (sp-rx_good) {
ifp-if_ipackets += le32toh(sp-rx_good);
sc-rx_idle_secs = 0;
-   } else {
+   } else if (sc-flags  FXP_FLAG_RXBUG) {
/*
 * Receiver's been idle for another second.
 */

Modified: head/sys/dev/fxp/if_fxpvar.h
==
--- head/sys/dev/fxp/if_fxpvar.hSun Jun 21 06:18:19 2009
(r194570)
+++ head/sys/dev/fxp/if_fxpvar.hSun Jun 21 06:27:35 2009
(r194571)
@@ -204,6 +204,7 @@ struct fxp_softc {
 #define FXP_FLAG_82559_RXCSUM  0x1000  /* 82559 compatible RX checksum */
 #define FXP_FLAG_WOLCAP0x2000  /* WOL capability */
 #define FXP_FLAG_WOL   0x4000  /* WOL active */
+#define FXP_FLAG_RXBUG 0x8000  /* Rx lock-up bug */
 
 /* Macros to ease CSR access. */
 #defineCSR_READ_1(sc, reg) bus_read_1(sc-fxp_res[0], reg)
___
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: r194572 - head/sys/dev/fxp

2009-06-21 Thread Pyun YongHyeon
Author: yongari
Date: Sun Jun 21 06:46:32 2009
New Revision: 194572
URL: http://svn.freebsd.org/changeset/base/194572

Log:
  Always check fxp(4) is running, see if it can accept frames from
  upper stack in fxp_start_body().
  fxp(4) drops driver lock in Rx path so check the fxp(4) is still
  running after reacquiring driver lock in Rx path. Also don't
  invoke fxp_intr_body if fxp(4) is not running. With this change
  there is no need to set suspend bit in device attach phase.

Modified:
  head/sys/dev/fxp/if_fxp.c

Modified: head/sys/dev/fxp/if_fxp.c
==
--- head/sys/dev/fxp/if_fxp.c   Sun Jun 21 06:27:35 2009(r194571)
+++ head/sys/dev/fxp/if_fxp.c   Sun Jun 21 06:46:32 2009(r194572)
@@ -992,7 +992,6 @@ fxp_detach(device_t dev)
 #endif
 
FXP_LOCK(sc);
-   sc-suspended = 1;  /* Do same thing as we do for suspend */
/*
 * Stop DMA and drop transmit queue, but disable interrupts first.
 */
@@ -1319,6 +1318,10 @@ fxp_start_body(struct ifnet *ifp)
if (sc-need_mcsetup)
return;
 
+   if ((ifp-if_drv_flags  (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) !=
+   IFF_DRV_RUNNING)
+   return;
+
if (sc-tx_queued  FXP_NTXCB_HIWAT)
fxp_txeof(sc);
/*
@@ -1727,7 +1730,8 @@ fxp_intr(void *xsc)
 * First ACK all the interrupts in this pass.
 */
CSR_WRITE_1(sc, FXP_CSR_SCB_STATACK, statack);
-   fxp_intr_body(sc, ifp, statack, -1);
+   if ((ifp-if_drv_flags  IFF_DRV_RUNNING) != 0)
+   fxp_intr_body(sc, ifp, statack, -1);
}
FXP_UNLOCK(sc);
 }
@@ -1987,6 +1991,8 @@ fxp_intr_body(struct fxp_softc *sc, stru
(*ifp-if_input)(ifp, m);
FXP_LOCK(sc);
rx_npkts++;
+   if ((ifp-if_drv_flags  IFF_DRV_RUNNING) == 0)
+   return (rx_npkts);
} else {
/* Reuse RFA and loaded DMA map. */
ifp-if_iqdrops++;
@@ -2070,7 +2076,8 @@ fxp_tick(void *xsc)
 */
if (sc-rx_idle_secs  FXP_MAX_RX_IDLE) {
sc-rx_idle_secs = 0;
-   fxp_mc_setup(sc);
+   if ((ifp-if_drv_flags  IFF_DRV_RUNNING) != 0)
+   fxp_mc_setup(sc);
}
/*
 * If there is no pending command, start another stats
___
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: r194573 - head/sys/dev/fxp

2009-06-21 Thread Pyun YongHyeon
Author: yongari
Date: Sun Jun 21 07:17:49 2009
New Revision: 194573
URL: http://svn.freebsd.org/changeset/base/194573

Log:
  Overhaul fxp(4) multicast filter programming. fxp(4) hardwares do
  not allow multicast filter programming when controller is busy to
  send/receive frames. So it used to mark need_mcsetup bit and defer
  multicast filter programming until controller becomes idle state.
  To detect when the controller is idle fxp(4) relied on Tx
  completion interrupt with NOP command and fxp_start_body and
  fxp_intr_body had to see whether pending multicast filter
  programming was requested. This resulted in very complex logic and
  sometimes it did not work as expected.
  Since the controller should be in idle state before any multicast
  filter modifications I changed it to reinitialize the controller
  whenever multicast filter programming is required. This is the same
  way what OpenBSD and NetBSD does. Also I added IFF_DRV_RUNNING
  check in ioctl handler so controller would be reinitialized only if
  it is absolutely needed.
  With this change I guess we can remove fxp(4) DELAY hack in ifioctl
  for IPv6 case.

Modified:
  head/sys/dev/fxp/if_fxp.c
  head/sys/dev/fxp/if_fxpvar.h

Modified: head/sys/dev/fxp/if_fxp.c
==
--- head/sys/dev/fxp/if_fxp.c   Sun Jun 21 06:46:32 2009(r194572)
+++ head/sys/dev/fxp/if_fxp.c   Sun Jun 21 07:17:49 2009(r194573)
@@ -1310,14 +1310,6 @@ fxp_start_body(struct ifnet *ifp)
 
FXP_LOCK_ASSERT(sc, MA_OWNED);
 
-   /*
-* See if we need to suspend xmit until the multicast filter
-* has been reprogrammed (which can only be done at the head
-* of the command chain).
-*/
-   if (sc-need_mcsetup)
-   return;
-
if ((ifp-if_drv_flags  (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) !=
IFF_DRV_RUNNING)
return;
@@ -1763,11 +1755,8 @@ fxp_txeof(struct fxp_softc *sc)
sc-fxp_desc.tx_first = txp;
bus_dmamap_sync(sc-cbl_tag, sc-cbl_map,
BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
-   if (sc-tx_queued == 0) {
+   if (sc-tx_queued == 0)
sc-watchdog_timer = 0;
-   if (sc-need_mcsetup)
-   fxp_mc_setup(sc);
-   }
 }
 
 static void
@@ -2077,7 +2066,8 @@ fxp_tick(void *xsc)
if (sc-rx_idle_secs  FXP_MAX_RX_IDLE) {
sc-rx_idle_secs = 0;
if ((ifp-if_drv_flags  IFF_DRV_RUNNING) != 0)
-   fxp_mc_setup(sc);
+   fxp_init_body(sc);
+   return;
}
/*
 * If there is no pending command, start another stats
@@ -2219,7 +2209,6 @@ fxp_init_body(struct fxp_softc *sc)
struct fxp_cb_ias *cb_ias;
struct fxp_cb_tx *tcbp;
struct fxp_tx *txp;
-   struct fxp_cb_mcs *mcsp;
int i, prm;
 
FXP_LOCK_ASSERT(sc, MA_OWNED);
@@ -2262,25 +2251,10 @@ fxp_init_body(struct fxp_softc *sc)
fxp_load_ucode(sc);
 
/*
-* Initialize the multicast address list.
+* Set IFF_ALLMULTI status. It's needed in configure action
+* command.
 */
-   if (fxp_mc_addrs(sc)) {
-   mcsp = sc-mcsp;
-   mcsp-cb_status = 0;
-   mcsp-cb_command =
-   htole16(FXP_CB_COMMAND_MCAS | FXP_CB_COMMAND_EL);
-   mcsp-link_addr = 0x;
-   /*
-* Start the multicast setup command.
-*/
-   fxp_scb_wait(sc);
-   bus_dmamap_sync(sc-mcs_tag, sc-mcs_map,
-   BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
-   CSR_WRITE_4(sc, FXP_CSR_SCB_GENERAL, sc-mcs_addr);
-   fxp_scb_cmd(sc, FXP_SCB_COMMAND_CU_START);
-   /* ...and wait for it to complete. */
-   fxp_dma_wait(sc, mcsp-cb_status, sc-mcs_tag, sc-mcs_map);
-   }
+   fxp_mc_addrs(sc);
 
/*
 * We temporarily use memory that contains the TxCB list to
@@ -2354,7 +2328,7 @@ fxp_init_body(struct fxp_softc *sc)
cbp-force_fdx =0;  /* (don't) force full duplex */
cbp-fdx_pin_en =   1;  /* (enable) FDX# pin */
cbp-multi_ia = 0;  /* (don't) accept multiple IAs */
-   cbp-mc_all =   sc-flags  FXP_FLAG_ALL_MCAST ? 1 : 0;
+   cbp-mc_all =   ifp-if_flags  IFF_ALLMULTI ? 1 : 0;
cbp-gamla_rx = sc-flags  FXP_FLAG_EXT_RFA ? 1 : 0;
cbp-vlan_strip_en =((sc-flags  FXP_FLAG_EXT_RFA) != 0 
(ifp-if_capenable  IFCAP_VLAN_HWTAGGING) != 0) ? 1 : 0;
@@ -2410,11 +2384,17 @@ fxp_init_body(struct fxp_softc *sc)
fxp_scb_wait(sc);
bus_dmamap_sync(sc-cbl_tag, sc-cbl_map,
BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
+   CSR_WRITE_4(sc, FXP_CSR_SCB_GENERAL, sc-fxp_desc.cbl_addr);

svn commit: r194574 - head/sys/dev/fxp

2009-06-21 Thread Pyun YongHyeon
Author: yongari
Date: Sun Jun 21 07:34:12 2009
New Revision: 194574
URL: http://svn.freebsd.org/changeset/base/194574

Log:
  For ICH based fxp(4) controllers treat them as 82559 compatibles.
  To detect which controller is ICH based one, add a new member
  variable ich to struct fxp_ident and move the struct to
  if_fxpvar.h. Since I've faked controller revision, don't allow
  microcode loading for ICH based controllers.
  With this change all ICH based controllers will have WOL and Rx
  checksum offload capability.
  
  PR:   kern/135451
  Tested by:Alexey Shuvaev ( shuvaev  physik dot uni-wuerzburg dot de ),
pluknet ( pluknet  gmail dot com ),
Gary Jennejohn ( gary.jennejohn  freenet dot de )

Modified:
  head/sys/dev/fxp/if_fxp.c
  head/sys/dev/fxp/if_fxpvar.h

Modified: head/sys/dev/fxp/if_fxp.c
==
--- head/sys/dev/fxp/if_fxp.c   Sun Jun 21 07:17:49 2009(r194573)
+++ head/sys/dev/fxp/if_fxp.c   Sun Jun 21 07:34:12 2009(r194574)
@@ -140,12 +140,6 @@ static u_char fxp_cb_config_template[] =
0x5 /* 21 */
 };
 
-struct fxp_ident {
-   uint16_tdevid;
-   int16_t revid;  /* -1 matches anything */
-   char*name;
-};
-
 /*
  * Claim various Intel PCI device identifiers for this driver.  The
  * sub-vendor and sub-device field are extensively used to identify
@@ -153,52 +147,52 @@ struct fxp_ident {
  * them.
  */
 static struct fxp_ident fxp_ident_table[] = {
-{ 0x1029,  -1, Intel 82559 PCI/CardBus Pro/100 },
-{ 0x1030,  -1, Intel 82559 Pro/100 Ethernet },
-{ 0x1031,  -1, Intel 82801CAM (ICH3) Pro/100 VE Ethernet },
-{ 0x1032,  -1, Intel 82801CAM (ICH3) Pro/100 VE Ethernet },
-{ 0x1033,  -1, Intel 82801CAM (ICH3) Pro/100 VM Ethernet },
-{ 0x1034,  -1, Intel 82801CAM (ICH3) Pro/100 VM Ethernet },
-{ 0x1035,  -1, Intel 82801CAM (ICH3) Pro/100 Ethernet },
-{ 0x1036,  -1, Intel 82801CAM (ICH3) Pro/100 Ethernet },
-{ 0x1037,  -1, Intel 82801CAM (ICH3) Pro/100 Ethernet },
-{ 0x1038,  -1, Intel 82801CAM (ICH3) Pro/100 VM Ethernet },
-{ 0x1039,  -1, Intel 82801DB (ICH4) Pro/100 VE Ethernet },
-{ 0x103A,  -1, Intel 82801DB (ICH4) Pro/100 Ethernet },
-{ 0x103B,  -1, Intel 82801DB (ICH4) Pro/100 VM Ethernet },
-{ 0x103C,  -1, Intel 82801DB (ICH4) Pro/100 Ethernet },
-{ 0x103D,  -1, Intel 82801DB (ICH4) Pro/100 VE Ethernet },
-{ 0x103E,  -1, Intel 82801DB (ICH4) Pro/100 VM Ethernet },
-{ 0x1050,  -1, Intel 82801BA (D865) Pro/100 VE Ethernet },
-{ 0x1051,  -1, Intel 82562ET (ICH5/ICH5R) Pro/100 VE Ethernet },
-{ 0x1059,  -1, Intel 82551QM Pro/100 M Mobile Connection },
-{ 0x1064,  -1, Intel 82562EZ (ICH6) },
-{ 0x1065,  -1, Intel 82562ET/EZ/GT/GZ PRO/100 VE Ethernet },
-{ 0x1068,  -1, Intel 82801FBM (ICH6-M) Pro/100 VE Ethernet },
-{ 0x1069,  -1, Intel 82562EM/EX/GX Pro/100 Ethernet },
-{ 0x1091,  -1, Intel 82562GX Pro/100 Ethernet },
-{ 0x1092,  -1, Intel Pro/100 VE Network Connection },
-{ 0x1093,  -1, Intel Pro/100 VM Network Connection },
-{ 0x1094,  -1, Intel Pro/100 946GZ (ICH7) Network Connection },
-{ 0x1209,  -1, Intel 82559ER Embedded 10/100 Ethernet },
-{ 0x1229,  0x01,   Intel 82557 Pro/100 Ethernet },
-{ 0x1229,  0x02,   Intel 82557 Pro/100 Ethernet },
-{ 0x1229,  0x03,   Intel 82557 Pro/100 Ethernet },
-{ 0x1229,  0x04,   Intel 82558 Pro/100 Ethernet },
-{ 0x1229,  0x05,   Intel 82558 Pro/100 Ethernet },
-{ 0x1229,  0x06,   Intel 82559 Pro/100 Ethernet },
-{ 0x1229,  0x07,   Intel 82559 Pro/100 Ethernet },
-{ 0x1229,  0x08,   Intel 82559 Pro/100 Ethernet },
-{ 0x1229,  0x09,   Intel 82559ER Pro/100 Ethernet },
-{ 0x1229,  0x0c,   Intel 82550 Pro/100 Ethernet },
-{ 0x1229,  0x0d,   Intel 82550 Pro/100 Ethernet },
-{ 0x1229,  0x0e,   Intel 82550 Pro/100 Ethernet },
-{ 0x1229,  0x0f,   Intel 82551 Pro/100 Ethernet },
-{ 0x1229,  0x10,   Intel 82551 Pro/100 Ethernet },
-{ 0x1229,  -1, Intel 82557/8/9 Pro/100 Ethernet },
-{ 0x2449,  -1, Intel 82801BA/CAM (ICH2/3) Pro/100 Ethernet },
-{ 0x27dc,  -1, Intel 82801GB (ICH7) 10/100 Ethernet },
-{ 0,   -1, NULL },
+{ 0x1029,  -1, 0, Intel 82559 PCI/CardBus Pro/100 },
+{ 0x1030,  -1, 0, Intel 82559 Pro/100 Ethernet },
+{ 0x1031,  -1, 3, Intel 82801CAM (ICH3) Pro/100 VE Ethernet },
+{ 0x1032,  -1, 3, Intel 82801CAM (ICH3) Pro/100 VE Ethernet },
+{ 0x1033,  -1, 3, Intel 82801CAM (ICH3) Pro/100 VM Ethernet },
+{ 0x1034,  -1, 3, Intel 82801CAM (ICH3) Pro/100 VM Ethernet },
+{ 0x1035,  -1, 3, Intel 82801CAM (ICH3) Pro/100 Ethernet },
+{ 0x1036,  -1, 3, Intel 82801CAM (ICH3) Pro/100 Ethernet },
+{ 0x1037,  

svn commit: r194575 - head/sys/kern

2009-06-21 Thread Roman Divacky
Author: rdivacky
Date: Sun Jun 21 07:54:47 2009
New Revision: 194575
URL: http://svn.freebsd.org/changeset/base/194575

Log:
  In non-debugging mode make this define (void)0 instead of nothing. This
  helps to catch bugs like the below with clang.
  
if (cond);  --- note the trailing ;
   something();
  
  Approved by:  ed (mentor)
  Discussed on: current@

Modified:
  head/sys/kern/sysv_msg.c

Modified: head/sys/kern/sysv_msg.c
==
--- head/sys/kern/sysv_msg.cSun Jun 21 07:34:12 2009(r194574)
+++ head/sys/kern/sysv_msg.cSun Jun 21 07:54:47 2009(r194575)
@@ -80,7 +80,7 @@ static int sysvmsg_modload(struct module
 #ifdef MSG_DEBUG
 #define DPRINTF(a) printf a
 #else
-#define DPRINTF(a)
+#define DPRINTF(a) (void)0
 #endif
 
 static void msg_freehdr(struct msg *msghdr);
___
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: r194576 - head/sys/fs/ntfs

2009-06-21 Thread Roman Divacky
Author: rdivacky
Date: Sun Jun 21 08:36:30 2009
New Revision: 194576
URL: http://svn.freebsd.org/changeset/base/194576

Log:
  In non-debugging mode make this define (void)0 instead of nothing. This
  helps to catch bugs like the below with clang.
  
if (cond);  --- note the trailing ;
   something();
  
  Approved by:  ed (mentor)
  Discussed on: current@

Modified:
  head/sys/fs/ntfs/ntfs.h

Modified: head/sys/fs/ntfs/ntfs.h
==
--- head/sys/fs/ntfs/ntfs.h Sun Jun 21 07:54:47 2009(r194575)
+++ head/sys/fs/ntfs/ntfs.h Sun Jun 21 08:36:30 2009(r194576)
@@ -296,11 +296,11 @@ MALLOC_DECLARE(M_NTFSNTHASH);
 #if NTFS_DEBUG  1
 #define ddprintf(a) printf a
 #else
-#define ddprintf(a)
+#define ddprintf(a)(void)0
 #endif
 #else
-#define dprintf(a)
-#define ddprintf(a)
+#define dprintf(a) (void)0
+#define ddprintf(a)(void)0
 #endif
 
 extern struct vop_vector ntfs_vnodeops;
___
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: r194577 - head/sys/net

2009-06-21 Thread Roman Divacky
Author: rdivacky
Date: Sun Jun 21 08:49:06 2009
New Revision: 194577
URL: http://svn.freebsd.org/changeset/base/194577

Log:
  In non-debugging mode make this define (void)0 instead of nothing. This
  helps to catch bugs like the below with clang.
  
if (cond);  --- note the trailing ;
   something();
  
  Approved by:  ed (mentor)
  Discussed on: current@

Modified:
  head/sys/net/bridgestp.c

Modified: head/sys/net/bridgestp.c
==
--- head/sys/net/bridgestp.cSun Jun 21 08:36:30 2009(r194576)
+++ head/sys/net/bridgestp.cSun Jun 21 08:49:06 2009(r194577)
@@ -68,7 +68,7 @@ __FBSDID($FreeBSD$);
 #ifdef BRIDGESTP_DEBUG
 #defineDPRINTF(fmt, arg...)printf(bstp:  fmt, ##arg)
 #else
-#defineDPRINTF(fmt, arg...)
+#defineDPRINTF(fmt, arg...)(void)0
 #endif
 
 #definePV2ADDR(pv, eaddr)  do {\
___
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: r194578 - head/sys/sys

2009-06-21 Thread Roman Divacky
Author: rdivacky
Date: Sun Jun 21 09:01:12 2009
New Revision: 194578
URL: http://svn.freebsd.org/changeset/base/194578

Log:
  In non-debugging mode make this define (void)0 instead of nothing. This
  helps to catch bugs like the below with clang.
  
if (cond);  --- note the trailing ;
   something();
  
  Approved by:  ed (mentor)
  Discussed on: current@

Modified:
  head/sys/sys/ktr.h
  head/sys/sys/lock.h
  head/sys/sys/lock_profile.h
  head/sys/sys/mutex.h
  head/sys/sys/sched.h
  head/sys/sys/sx.h

Modified: head/sys/sys/ktr.h
==
--- head/sys/sys/ktr.h  Sun Jun 21 08:49:06 2009(r194577)
+++ head/sys/sys/ktr.h  Sun Jun 21 09:01:12 2009(r194578)
@@ -147,13 +147,13 @@ void  ktr_tracepoint(u_int mask, const ch
 #defineCTR4(m, format, p1, p2, p3, p4) CTR6(m, format, p1, p2, p3, p4, 
0, 0)
 #defineCTR5(m, format, p1, p2, p3, p4, p5) CTR6(m, format, p1, p2, 
p3, p4, p5, 0)
 #else  /* KTR */
-#defineCTR0(m, d)
-#defineCTR1(m, d, p1)
-#defineCTR2(m, d, p1, p2)
-#defineCTR3(m, d, p1, p2, p3)
-#defineCTR4(m, d, p1, p2, p3, p4)
-#defineCTR5(m, d, p1, p2, p3, p4, p5)
-#defineCTR6(m, d, p1, p2, p3, p4, p5, p6)
+#defineCTR0(m, d)  (void)0
+#defineCTR1(m, d, p1)  (void)0
+#defineCTR2(m, d, p1, p2)  (void)0
+#defineCTR3(m, d, p1, p2, p3)  (void)0
+#defineCTR4(m, d, p1, p2, p3, p4)  (void)0
+#defineCTR5(m, d, p1, p2, p3, p4, p5)  (void)0
+#defineCTR6(m, d, p1, p2, p3, p4, p5, p6)  (void)0
 #endif /* KTR */
 
 #defineTR0(d)  CTR0(KTR_GEN, d)

Modified: head/sys/sys/lock.h
==
--- head/sys/sys/lock.h Sun Jun 21 08:49:06 2009(r194577)
+++ head/sys/sys/lock.h Sun Jun 21 09:01:12 2009(r194578)
@@ -283,21 +283,21 @@ void  witness_thread_exit(struct thread *
witness_line(lock)
 
 #else  /* WITNESS */
-#defineWITNESS_INIT(lock, type)
-#defineWITNESS_DESTROY(lock)
+#defineWITNESS_INIT(lock, type)(void)0
+#defineWITNESS_DESTROY(lock)   (void)0
 #defineWITNESS_DEFINEORDER(lock1, lock2)   0
-#defineWITNESS_CHECKORDER(lock, flags, file, line, interlock)
-#defineWITNESS_LOCK(lock, flags, file, line)
-#defineWITNESS_UPGRADE(lock, flags, file, line)
-#defineWITNESS_DOWNGRADE(lock, flags, file, line)
-#defineWITNESS_UNLOCK(lock, flags, file, line)
+#defineWITNESS_CHECKORDER(lock, flags, file, line, interlock)  (void)0
+#defineWITNESS_LOCK(lock, flags, file, line)   (void)0
+#defineWITNESS_UPGRADE(lock, flags, file, line)(void)0
+#defineWITNESS_DOWNGRADE(lock, flags, file, line)  (void)0
+#defineWITNESS_UNLOCK(lock, flags, file, line) (void)0
 #defineWITNESS_CHECK(flags, lock, fmt, ...)0
-#defineWITNESS_WARN(flags, lock, fmt, ...)
-#defineWITNESS_SAVE_DECL(n)
-#defineWITNESS_SAVE(lock, n)
-#defineWITNESS_RESTORE(lock, n)
-#defineWITNESS_NORELEASE(lock)
-#defineWITNESS_RELEASEOK(lock)
+#defineWITNESS_WARN(flags, lock, fmt, ...) (void)0
+#defineWITNESS_SAVE_DECL(n)(void)0
+#defineWITNESS_SAVE(lock, n)   (void)0
+#defineWITNESS_RESTORE(lock, n)(void)0
+#defineWITNESS_NORELEASE(lock) (void)0
+#defineWITNESS_RELEASEOK(lock) (void)0
 #defineWITNESS_FILE(lock) (?)
 #defineWITNESS_LINE(lock) (0)
 #endif /* WITNESS */

Modified: head/sys/sys/lock_profile.h
==
--- head/sys/sys/lock_profile.h Sun Jun 21 08:49:06 2009(r194577)
+++ head/sys/sys/lock_profile.h Sun Jun 21 09:01:12 2009(r194578)
@@ -63,10 +63,10 @@ lock_profile_obtain_lock_failed(struct l
 
 #else /* !LOCK_PROFILING */
 
-#definelock_profile_release_lock(lo)
-#define lock_profile_obtain_lock_failed(lo, contested, waittime)
-#define lock_profile_obtain_lock_success(lo, contested, waittime, file, line)
-#definelock_profile_thread_exit(td)
+#definelock_profile_release_lock(lo)   
(void)0
+#define lock_profile_obtain_lock_failed(lo, contested, waittime)   (void)0
+#define lock_profile_obtain_lock_success(lo, contested, waittime, file, line)  
(void)0
+#definelock_profile_thread_exit(td)
(void)0
 
 #endif 

svn commit: r194580 - head/sys/netipx

2009-06-21 Thread Robert Watson
Author: rwatson
Date: Sun Jun 21 10:10:44 2009
New Revision: 194580
URL: http://svn.freebsd.org/changeset/base/194580

Log:
  Remove historical support for capturing IPX packets in the output path
  using raw IPX sockets.  While functional, this support is disabled
  using a flag that can't be changed from userspace, and google reveals
  no documentation or use of that flag anywhere.  This eliminates a
  potential lock order reversal and code reentrance issue in which the
  output path reentered the input path in IPX.
  
  An alternative to removal would be to use the netisr, as a comment I
  added in 2005 suggests.  While this change is fairly straight-forward,
  the lack of any consumers or the easy possibility of consumers (kernel
  modification and recompile required) suggests that this is simply an
  unused feature.
  
  Update README to remove this TODO, and a TODO regarding IPX/IP
  encapsulation which was also removed a few years ago.
  
  MFC after:1 week

Modified:
  head/sys/netipx/README
  head/sys/netipx/ipx_input.c
  head/sys/netipx/ipx_outputfl.c
  head/sys/netipx/ipx_var.h

Modified: head/sys/netipx/README
==
--- head/sys/netipx/README  Sun Jun 21 09:39:43 2009(r194579)
+++ head/sys/netipx/README  Sun Jun 21 10:10:44 2009(r194580)
@@ -39,11 +39,3 @@ Modifications Copyright (c) 2004-2006 Ro
 but unsent data.  As with TCP, it should instead grab its own
 reference to the socket so that it is not released, as hold onto it
 until the data transfer is complete.
-
-(3) Raw socket capture of IPX output intercepts packets in the SPX output
-routine in order to feed them back into the raw socket.  This results
-in recursion into the socket code in the transmit path; instead,
-captured packets should be fed into a netisr that reinjects them into
-raw sockets from a new (asynchronous) context.
-
-(4) IPX over IP encapsulation needs work to make it properly MPSAFE.

Modified: head/sys/netipx/ipx_input.c
==
--- head/sys/netipx/ipx_input.c Sun Jun 21 09:39:43 2009(r194579)
+++ head/sys/netipx/ipx_input.c Sun Jun 21 10:10:44 2009(r194580)
@@ -452,53 +452,3 @@ ipx_undo_route(struct route *ro)
RTFREE(ro-ro_rt);
}
 }
-
-/*
- * XXXRW: This code should be run in its own netisr dispatch to avoid a call
- * back into the socket code from the IPX output path.
- */
-void
-ipx_watch_output(struct mbuf *m, struct ifnet *ifp)
-{
-   struct ipxpcb *ipxp;
-   struct ifaddr *ifa;
-   struct ipx_ifaddr *ia;
-
-   /*
-* Give any raw listeners a crack at the packet
-*/
-   IPX_LIST_LOCK();
-   LIST_FOREACH(ipxp, ipxrawpcb_list, ipxp_list) {
-   struct mbuf *m0 = m_copy(m, 0, (int)M_COPYALL);
-   if (m0 != NULL) {
-   struct ipx *ipx;
-
-   M_PREPEND(m0, sizeof(*ipx), M_DONTWAIT);
-   if (m0 == NULL)
-   continue;
-   ipx = mtod(m0, struct ipx *);
-   ipx-ipx_sna.x_net = ipx_zeronet;
-   for (ia = ipx_ifaddr; ia != NULL; ia = ia-ia_next)
-   if (ifp == ia-ia_ifp)
-   break;
-   if (ia == NULL)
-   ipx-ipx_sna.x_host = ipx_zerohost;
-   else
-   ipx-ipx_sna.x_host =
-   ia-ia_addr.sipx_addr.x_host;
-
-   if (ifp != NULL  (ifp-if_flags  IFF_POINTOPOINT))
-   TAILQ_FOREACH(ifa, ifp-if_addrhead, ifa_link) {
-   if (ifa-ifa_addr-sa_family == AF_IPX) {
-   ipx-ipx_sna = IA_SIPX(ifa)-sipx_addr;
-   break;
-   }
-   }
-   ipx-ipx_len = ntohl(m0-m_pkthdr.len);
-   IPX_LOCK(ipxp);
-   ipx_input(m0, ipxp);
-   IPX_UNLOCK(ipxp);
-   }
-   }
-   IPX_LIST_UNLOCK();
-}

Modified: head/sys/netipx/ipx_outputfl.c
==
--- head/sys/netipx/ipx_outputfl.c  Sun Jun 21 09:39:43 2009
(r194579)
+++ head/sys/netipx/ipx_outputfl.c  Sun Jun 21 10:10:44 2009
(r194580)
@@ -74,8 +74,6 @@ __FBSDID($FreeBSD$);
 #include netipx/ipx_if.h
 #include netipx/ipx_var.h
 
-static int ipx_copy_output = 0;
-
 int
 ipx_outputfl(struct mbuf *m0, struct route *ro, int flags)
 {
@@ -150,9 +148,6 @@ gotif:
 
if (htons(ipx-ipx_len) = ifp-if_mtu) {
ipxstat.ipxs_localout++;
-   if (ipx_copy_output) {
-   

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

2009-06-21 Thread Roman Divacky
Author: rdivacky
Date: Sun Jun 21 10:29:31 2009
New Revision: 194581
URL: http://svn.freebsd.org/changeset/base/194581

Log:
  Switch cmd argument to u_long. This matches what if_ethersubr.c does and
  allows the code to compile cleanly on amd64 with clang.
  
  Reviewed by:  rwatson
  Approved by:  ed (mentor)

Modified:
  head/sys/net/fddi.h
  head/sys/net/firewire.h
  head/sys/net/if.c
  head/sys/net/if_arc.h
  head/sys/net/if_arcsubr.c
  head/sys/net/if_fddisubr.c
  head/sys/net/if_fwsubr.c
  head/sys/net/if_iso88025subr.c
  head/sys/net/iso88025.h
  head/sys/netinet/ip_mroute.c
  head/sys/netinet/ip_mroute.h
  head/sys/netinet/raw_ip.c
  head/sys/netinet6/ip6_mroute.c
  head/sys/netinet6/ip6_mroute.h
  head/sys/netinet6/raw_ip6.c

Modified: head/sys/net/fddi.h
==
--- head/sys/net/fddi.h Sun Jun 21 10:10:44 2009(r194580)
+++ head/sys/net/fddi.h Sun Jun 21 10:29:31 2009(r194581)
@@ -99,7 +99,7 @@ struct fddi_header {
 
 void   fddi_ifattach(struct ifnet *, const u_int8_t *, int);
 void   fddi_ifdetach(struct ifnet *, int);
-intfddi_ioctl(struct ifnet *, int, caddr_t);
+intfddi_ioctl(struct ifnet *, u_long, caddr_t);
 
 #endif /* _KERNEL */
 #endif /* _NET_FDDI_H_ */

Modified: head/sys/net/firewire.h
==
--- head/sys/net/firewire.h Sun Jun 21 10:10:44 2009(r194580)
+++ head/sys/net/firewire.h Sun Jun 21 10:29:31 2009(r194581)
@@ -135,7 +135,7 @@ extern  voidfirewire_input(struct ifnet 
 extern voidfirewire_ifattach(struct ifnet *, struct fw_hwaddr *);
 extern voidfirewire_ifdetach(struct ifnet *);
 extern voidfirewire_busreset(struct ifnet *);
-extern int firewire_ioctl(struct ifnet *, int, caddr_t);
+extern int firewire_ioctl(struct ifnet *, u_long, caddr_t);
 
 #endif /* !_KERNEL */
 

Modified: head/sys/net/if.c
==
--- head/sys/net/if.c   Sun Jun 21 10:10:44 2009(r194580)
+++ head/sys/net/if.c   Sun Jun 21 10:29:31 2009(r194581)
@@ -2382,7 +2382,7 @@ ifioctl(struct socket *so, u_long cmd, c
error = (*ifp-if_ioctl)(ifp, cmd, data);
 #else
{
-   int ocmd = cmd;
+   u_long ocmd = cmd;
 
switch (cmd) {
 

Modified: head/sys/net/if_arc.h
==
--- head/sys/net/if_arc.h   Sun Jun 21 10:10:44 2009(r194580)
+++ head/sys/net/if_arc.h   Sun Jun 21 10:29:31 2009(r194581)
@@ -134,7 +134,7 @@ int arc_isphds(u_int8_t);
 void   arc_input(struct ifnet *, struct mbuf *);
 intarc_output(struct ifnet *, struct mbuf *,
struct sockaddr *, struct route *);
-intarc_ioctl(struct ifnet *, int, caddr_t);
+intarc_ioctl(struct ifnet *, u_long, caddr_t);
 
 void   arc_frag_init(struct ifnet *);
 struct mbuf *  arc_frag_next(struct ifnet *);

Modified: head/sys/net/if_arcsubr.c
==
--- head/sys/net/if_arcsubr.c   Sun Jun 21 10:10:44 2009(r194580)
+++ head/sys/net/if_arcsubr.c   Sun Jun 21 10:29:31 2009(r194581)
@@ -672,7 +672,7 @@ arc_ifdetach(struct ifnet *ifp)
 }
 
 int
-arc_ioctl(struct ifnet *ifp, int command, caddr_t data)
+arc_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
 {
struct ifaddr *ifa = (struct ifaddr *) data;
struct ifreq *ifr = (struct ifreq *) data;

Modified: head/sys/net/if_fddisubr.c
==
--- head/sys/net/if_fddisubr.c  Sun Jun 21 10:10:44 2009(r194580)
+++ head/sys/net/if_fddisubr.c  Sun Jun 21 10:29:31 2009(r194581)
@@ -617,7 +617,7 @@ fddi_ifdetach(ifp, bpf)
 int
 fddi_ioctl (ifp, command, data)
struct ifnet *ifp;
-   int command;
+   u_long command;
caddr_t data;
 {
struct ifaddr *ifa;

Modified: head/sys/net/if_fwsubr.c
==
--- head/sys/net/if_fwsubr.cSun Jun 21 10:10:44 2009(r194580)
+++ head/sys/net/if_fwsubr.cSun Jun 21 10:29:31 2009(r194581)
@@ -631,7 +631,7 @@ firewire_input(struct ifnet *ifp, struct
 }
 
 int
-firewire_ioctl(struct ifnet *ifp, int command, caddr_t data)
+firewire_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
 {
struct ifaddr *ifa = (struct ifaddr *) data;
struct ifreq *ifr = (struct ifreq *) data;

Modified: head/sys/net/if_iso88025subr.c
==
--- head/sys/net/if_iso88025subr.c  Sun Jun 21 10:10:44 2009
(r194580)
+++ head/sys/net/if_iso88025subr.c  Sun Jun 21 10:29:31 2009
(r194581)
@@ -149,7 +149,7 @@ iso88025_ifdetach(ifp, 

svn commit: r194582 - in head/sys/dev/usb: . storage

2009-06-21 Thread Remko Lodder
Author: remko
Date: Sun Jun 21 11:21:16 2009
New Revision: 194582
URL: http://svn.freebsd.org/changeset/base/194582

Log:
  Add support for the Myson Heden 8813.
  Note that I also added the usbdev to the list, because the 8813 version
  is not yet known there. I might have twisted the sorting there but because
  8813 comes before 8818, I added it before that (with _8813 to differentiate)
  the item.
  
  PR:   135628
  Submitted by: Yoshikazu GOTO goto at on-link dot jp
  Approved by:  imp (mentor, implicit)

Modified:
  head/sys/dev/usb/storage/umass.c
  head/sys/dev/usb/usbdevs

Modified: head/sys/dev/usb/storage/umass.c
==
--- head/sys/dev/usb/storage/umass.cSun Jun 21 10:29:31 2009
(r194581)
+++ head/sys/dev/usb/storage/umass.cSun Jun 21 11:21:16 2009
(r194582)
@@ -629,6 +629,10 @@ static const struct umass_devdescr umass
UMASS_PROTO_DEFAULT,
IGNORE_RESIDUE | NO_SYNCHRONIZE_CACHE
},
+   {USB_VENDOR_MYSON, USB_PRODUCT_MYSON_HEDEN_8813, RID_WILDCARD,
+   UMASS_PROTO_SCSI | UMASS_PROTO_BBB,
+   NO_SYNCHRONIZE_CACHE
+   },
{USB_VENDOR_MYSON, USB_PRODUCT_MYSON_STARREADER, RID_WILDCARD,
UMASS_PROTO_DEFAULT,
NO_SYNCHRONIZE_CACHE

Modified: head/sys/dev/usb/usbdevs
==
--- head/sys/dev/usb/usbdevsSun Jun 21 10:29:31 2009(r194581)
+++ head/sys/dev/usb/usbdevsSun Jun 21 11:21:16 2009(r194582)
@@ -1819,6 +1819,7 @@ product MSYSTEMS DISKONKEY0x0010  DiskOn
 product MSYSTEMS DISKONKEY20x0011  DiskOnKey
 
 /* Myson products */
+product MYSON HEDEN_8813   0x8813  USB-IDE
 product MYSON HEDEN0x8818  USB-IDE
 product MYSON STARREADER   0x9920  USB flash card adapter
 
___
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: r194583 - head/lib/libc/arm/string

2009-06-21 Thread Stanislav Sedov
Author: stas
Date: Sun Jun 21 12:58:56 2009
New Revision: 194583
URL: http://svn.freebsd.org/changeset/base/194583

Log:
  - Fix strncmp on arm. Return 0 as result without performing the
main cycle only if the len passed is equal to 0. If end address
overflows use last possible address as the end address.
  
  Based on: discussion on arm@
  MFC after:1 month

Modified:
  head/lib/libc/arm/string/strncmp.S

Modified: head/lib/libc/arm/string/strncmp.S
==
--- head/lib/libc/arm/string/strncmp.S  Sun Jun 21 11:21:16 2009
(r194582)
+++ head/lib/libc/arm/string/strncmp.S  Sun Jun 21 12:58:56 2009
(r194583)
@@ -33,13 +33,17 @@
 __FBSDID($FreeBSD$);
 
 ENTRY(strncmp)
-/* if ((len - 1)  0) return 0 */
-   subsr2, r2, #1
-   movmi   r0, #0
-   movmi   pc, lr
+/* if (len == 0) return 0 */
+   cmp r2, #0
+   moveq   r0, #0
+   moveq   pc, lr
 
 /* ip == last src address to compare */
-   add ip, r0, r2
+   addsip, r0, r2
+   sub ip, ip, #1
+/* Use last possible address on overflow. */
+   movcs   ip, #0
+   subcs   ip, ip, #1
 1:
ldrbr2, [r0], #1
ldrbr3, [r1], #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


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

2009-06-21 Thread Stanislav Sedov
On Sun, 21 Jun 2009 09:01:12 + (UTC)
Roman Divacky rdiva...@freebsd.org mentioned:

 Modified: head/sys/sys/lock_profile.h
 ==
 --- head/sys/sys/lock_profile.h   Sun Jun 21 08:49:06 2009
 (r194577)
 +++ head/sys/sys/lock_profile.h   Sun Jun 21 09:01:12 2009
 (r194578)
 @@ -63,10 +63,10 @@ lock_profile_obtain_lock_failed(struct l
  
  #else /* !LOCK_PROFILING */
  
 -#define  lock_profile_release_lock(lo)
 -#define lock_profile_obtain_lock_failed(lo, contested, waittime)
 -#define lock_profile_obtain_lock_success(lo, contested, waittime, file, line)
 -#define  lock_profile_thread_exit(td)
 +#define  lock_profile_release_lock(lo)   
 (void)0
 +#define lock_profile_obtain_lock_failed(lo, contested, waittime) (void)0
 +#define lock_profile_obtain_lock_success(lo, contested, waittime, file, 
 line)(void)0
 +#define  lock_profile_thread_exit(td)
 (void)0
  
  #endif  /* !LOCK_PROFILING */

This now overflows the 80-column line limit, while it is used to not
before.  Can you, please, add line breaks wherever required?

-- 
Stanislav Sedov
ST4096-RIPE


pgp5tEtIaY7Wx.pgp
Description: PGP signature


svn commit: r194584 - head/sys/dev/usb/storage

2009-06-21 Thread Remko Lodder
Author: remko
Date: Sun Jun 21 13:13:13 2009
New Revision: 194584
URL: http://svn.freebsd.org/changeset/base/194584

Log:
  use PROTO_DEFAULT.
  
  Requested by: hps

Modified:
  head/sys/dev/usb/storage/umass.c

Modified: head/sys/dev/usb/storage/umass.c
==
--- head/sys/dev/usb/storage/umass.cSun Jun 21 12:58:56 2009
(r194583)
+++ head/sys/dev/usb/storage/umass.cSun Jun 21 13:13:13 2009
(r194584)
@@ -630,7 +630,7 @@ static const struct umass_devdescr umass
IGNORE_RESIDUE | NO_SYNCHRONIZE_CACHE
},
{USB_VENDOR_MYSON, USB_PRODUCT_MYSON_HEDEN_8813, RID_WILDCARD,
-   UMASS_PROTO_SCSI | UMASS_PROTO_BBB,
+   UMASS_PROTO_DEFAULT,
NO_SYNCHRONIZE_CACHE
},
{USB_VENDOR_MYSON, USB_PRODUCT_MYSON_STARREADER, RID_WILDCARD,
___
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: r194586 - in head/sys: cddl/compat/opensolaris/kern cddl/compat/opensolaris/sys cddl/contrib/opensolaris/uts/common/fs/zfs kern sys

2009-06-21 Thread Konstantin Belousov
Author: kib
Date: Sun Jun 21 13:41:32 2009
New Revision: 194586
URL: http://svn.freebsd.org/changeset/base/194586

Log:
  Add another flags argument to vn_open_cred. Use it to specify that some
  vn_open_cred invocations shall not audit namei path.
  
  In particular, specify VN_OPEN_NOAUDIT for dotdot lookup performed by
  default implementation of vop_vptocnp, and for the open done for core
  file. vn_fullpath is called from the audit code, and vn_open there need
  to disable audit to avoid infinite recursion. Core file is created on
  return to user mode, that, in particular, happens during syscall return.
  The creation of the core file is audited by direct calls, and we do not
  want to overwrite audit information for syscall.
  
  Reported, reviewed and tested by: rwatson

Modified:
  head/sys/cddl/compat/opensolaris/kern/opensolaris_kobj.c
  head/sys/cddl/compat/opensolaris/sys/vnode.h
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
  head/sys/kern/kern_alq.c
  head/sys/kern/kern_sig.c
  head/sys/kern/vfs_default.c
  head/sys/kern/vfs_vnops.c
  head/sys/sys/vnode.h

Modified: head/sys/cddl/compat/opensolaris/kern/opensolaris_kobj.c
==
--- head/sys/cddl/compat/opensolaris/kern/opensolaris_kobj.cSun Jun 21 
13:15:56 2009(r194585)
+++ head/sys/cddl/compat/opensolaris/kern/opensolaris_kobj.cSun Jun 21 
13:41:32 2009(r194586)
@@ -85,7 +85,8 @@ kobj_open_file_vnode(const char *file)
 
flags = FREAD;
NDINIT(nd, LOOKUP, MPSAFE, UIO_SYSSPACE, file, td);
-   error = vn_open_cred(nd, flags, O_NOFOLLOW, curthread-td_ucred, 
NULL);
+   error = vn_open_cred(nd, flags, O_NOFOLLOW, 0, curthread-td_ucred,
+   NULL);
NDFREE(nd, NDF_ONLY_PNBUF);
if (error != 0)
return (NULL);

Modified: head/sys/cddl/compat/opensolaris/sys/vnode.h
==
--- head/sys/cddl/compat/opensolaris/sys/vnode.hSun Jun 21 13:15:56 
2009(r194585)
+++ head/sys/cddl/compat/opensolaris/sys/vnode.hSun Jun 21 13:41:32 
2009(r194586)
@@ -182,7 +182,7 @@ vn_openat(char *pnamep, enum uio_seg seg
vref(startvp);
NDINIT_ATVP(nd, operation, MPSAFE, UIO_SYSSPACE, pnamep, startvp, td);
filemode |= O_NOFOLLOW;
-   error = vn_open_cred(nd, filemode, createmode, td-td_ucred, NULL);
+   error = vn_open_cred(nd, filemode, createmode, 0, td-td_ucred, NULL);
NDFREE(nd, NDF_ONLY_PNBUF);
if (error == 0) {
/* We just unlock so we hold a reference. */

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Sun Jun 
21 13:15:56 2009(r194585)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Sun Jun 
21 13:41:32 2009(r194586)
@@ -4519,7 +4519,7 @@ vop_getextattr {
flags = FREAD;
NDINIT_ATVP(nd, LOOKUP, NOFOLLOW | MPSAFE, UIO_SYSSPACE, attrname,
xvp, td);
-   error = vn_open_cred(nd, flags, 0, ap-a_cred, NULL);
+   error = vn_open_cred(nd, flags, 0, 0, ap-a_cred, NULL);
vp = nd.ni_vp;
NDFREE(nd, NDF_ONLY_PNBUF);
if (error != 0) {
@@ -4640,7 +4640,7 @@ vop_setextattr {
flags = FFLAGS(O_WRONLY | O_CREAT);
NDINIT_ATVP(nd, LOOKUP, NOFOLLOW | MPSAFE, UIO_SYSSPACE, attrname,
xvp, td);
-   error = vn_open_cred(nd, flags, 0600, ap-a_cred, NULL);
+   error = vn_open_cred(nd, flags, 0600, 0, ap-a_cred, NULL);
vp = nd.ni_vp;
NDFREE(nd, NDF_ONLY_PNBUF);
if (error != 0) {

Modified: head/sys/kern/kern_alq.c
==
--- head/sys/kern/kern_alq.cSun Jun 21 13:15:56 2009(r194585)
+++ head/sys/kern/kern_alq.cSun Jun 21 13:41:32 2009(r194586)
@@ -351,7 +351,7 @@ alq_open(struct alq **alqp, const char *
NDINIT(nd, LOOKUP, NOFOLLOW | MPSAFE, UIO_SYSSPACE, file, td);
flags = FWRITE | O_NOFOLLOW | O_CREAT;
 
-   error = vn_open_cred(nd, flags, cmode, cred, NULL);
+   error = vn_open_cred(nd, flags, cmode, 0, cred, NULL);
if (error)
return (error);
 

Modified: head/sys/kern/kern_sig.c
==
--- head/sys/kern/kern_sig.cSun Jun 21 13:15:56 2009(r194585)
+++ head/sys/kern/kern_sig.cSun Jun 21 13:41:32 2009(r194586)
@@ -2940,7 +2940,8 @@ coredump(struct thread *td)
 restart:
NDINIT(nd, LOOKUP, NOFOLLOW | MPSAFE, UIO_SYSSPACE, name, td);
flags = O_CREAT | FWRITE | O_NOFOLLOW;
-   error = vn_open(nd, flags, S_IRUSR | S_IWUSR, NULL);
+   error = vn_open_cred(nd, flags, 

Re: svn commit: r194493 - head/usr.bin/catman

2009-06-21 Thread Alexey Dokuchaev
Bruce Evans wrote:
 I've never seen a machine that actually runs catman.  I remove the
 cat directories on all my machines to prevent any saving of cat
 pages.  All FreeBSD cluster machines that I checked (just 3) have
 0, 1 and 2 saved cat pages.  This shows shows that catman isn't run
 on them and that root rarely looks at man pages on them.

This kinda brings up the question, do we actually need catman(1) at all
these days of fast CPU and disks and plenty of RAM?

./danfe
___
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: r194493 - head/usr.bin/catman

2009-06-21 Thread Dag-Erling Smørgrav
Alexey Dokuchaev da...@freebsd.org writes:
 This kinda brings up the question, do we actually need catman(1) at all
 these days of fast CPU and disks and plenty of RAM?

Show me the fast CPU and plenty of RAM on this board:

http://www.soekris.com/net4801.htm

DES
-- 
Dag-Erling Smørgrav - d...@des.no
___
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: r194493 - head/usr.bin/catman

2009-06-21 Thread Dag-Erling Smørgrav
Bruce Evans b...@optusnet.com.au writes:
 I've never seen a machine that actually runs catman.  I remove the
 cat directories on all my machines to prevent any saving of cat
 pages.  All FreeBSD cluster machines that I checked (just 3) have
 0, 1 and 2 saved cat pages.  This shows shows that catman isn't run
 on them and that root rarely looks at man pages on them.

Most stock FreeBSD installations don't need to run catman, because cat
pages for the default locale (which are also used for any locale man(1)
doesn't recognize) are included on the installation ISOs and installed
by default.  Adding cat pages for the other locales man(1) recognizes
(en.ISO8859-1 and en.UTF-8) would add around 13 MB to the ISO and 20 MB
to the installed system.

DES
-- 
Dag-Erling Smørgrav - d...@des.no
___
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: r194587 - stable/7/bin/cp

2009-06-21 Thread Jilles Tjoelker
Author: jilles
Date: Sun Jun 21 15:36:10 2009
New Revision: 194587
URL: http://svn.freebsd.org/changeset/base/194587

Log:
  MFC r193086: Preserve file flags on symlinks in cp -Rp.
  This reported ENOSYS before.
  
  PR:   bin/111226 (part of)
  Submitted by: Martin Kammerhofer
  Approved by:  ed (mentor) (implicit)

Modified:
  stable/7/bin/cp/   (props changed)
  stable/7/bin/cp/utils.c

Modified: stable/7/bin/cp/utils.c
==
--- stable/7/bin/cp/utils.c Sun Jun 21 13:41:32 2009(r194586)
+++ stable/7/bin/cp/utils.c Sun Jun 21 15:36:10 2009(r194587)
@@ -339,7 +339,7 @@ setfile(struct stat *fs, int fd)
if (!gotstat || fs-st_flags != ts.st_flags)
if (fdval ?
fchflags(fd, fs-st_flags) :
-   (islink ? (errno = ENOSYS) :
+   (islink ? lchflags(to.p_path, fs-st_flags) :
chflags(to.p_path, fs-st_flags))) {
warn(chflags: %s, to.p_path);
rval = 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: r194590 - head/sys/netipx

2009-06-21 Thread Robert Watson
Author: rwatson
Date: Sun Jun 21 16:11:26 2009
New Revision: 194590
URL: http://svn.freebsd.org/changeset/base/194590

Log:
  Update copyright on netipx.

Modified:
  head/sys/netipx/README

Modified: head/sys/netipx/README
==
--- head/sys/netipx/README  Sun Jun 21 16:10:40 2009(r194589)
+++ head/sys/netipx/README  Sun Jun 21 16:11:26 2009(r194590)
@@ -25,7 +25,7 @@ The Regents of the University of Califor
 
 Modifications Copyright (c) 1995, Mike Mitchell
 Modifications Copyright (c) 1995, John Hay
-Modifications Copyright (c) 2004-2006 Robert N. M. Watson
+Modifications Copyright (c) 2004-2009 Robert N. M. Watson
 
 */
 
___
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: r194591 - head/sys/netipx

2009-06-21 Thread Robert Watson
Author: rwatson
Date: Sun Jun 21 16:11:40 2009
New Revision: 194591
URL: http://svn.freebsd.org/changeset/base/194591

Log:
  Remove unuxed ipx_zerohost.
  
  MFC after:3 days

Modified:
  head/sys/netipx/ipx_input.c
  head/sys/netipx/ipx_var.h

Modified: head/sys/netipx/ipx_input.c
==
--- head/sys/netipx/ipx_input.c Sun Jun 21 16:11:26 2009(r194590)
+++ head/sys/netipx/ipx_input.c Sun Jun 21 16:11:40 2009(r194591)
@@ -106,7 +106,6 @@ static  void ipx_forward(struct mbuf *m);
 static void ipxintr(struct mbuf *m);
 
 const unionipx_net ipx_zeronet;
-const unionipx_host ipx_zerohost;
 
 const unionipx_net ipx_broadnet = { .s_net[0] = 0x,
.s_net[1] = 0x };

Modified: head/sys/netipx/ipx_var.h
==
--- head/sys/netipx/ipx_var.h   Sun Jun 21 16:11:26 2009(r194590)
+++ head/sys/netipx/ipx_var.h   Sun Jun 21 16:11:40 2009(r194591)
@@ -97,7 +97,6 @@ extern struct sockaddr_ipx ipx_netmask;
 extern struct sockaddr_ipx ipx_hostmask;
 
 extern const union ipx_net ipx_zeronet;
-extern const union ipx_host ipx_zerohost;
 extern const union ipx_net ipx_broadnet;
 extern const union ipx_host ipx_broadhost;
 
___
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: r194493 - head/usr.bin/catman

2009-06-21 Thread Brooks Davis
On Sun, Jun 21, 2009 at 04:48:09PM +0200, Dag-Erling Sm??rgrav wrote:
 Alexey Dokuchaev da...@freebsd.org writes:
  This kinda brings up the question, do we actually need catman(1) at all
  these days of fast CPU and disks and plenty of RAM?
 
 Show me the fast CPU and plenty of RAM on this board:
 
 http://www.soekris.com/net4801.htm

For such hardware, the OpenBSD mdoc renderer is likely to be a better
fit anyway.  It's orders of magnitude faster than *roff and wouldn't
waste space on catpages that will in all likely hood never be used.

-- Brooks


pgpnfx6VCqXwL.pgp
Description: PGP signature


svn commit: r194599 - in stable/6/sys: . compat/linux contrib/pf dev/cxgb

2009-06-21 Thread Dmitry Chagin
Author: dchagin
Date: Sun Jun 21 19:02:32 2009
New Revision: 194599
URL: http://svn.freebsd.org/changeset/base/194599

Log:
  MFC r164890 (by jkim):
  Fixes for 'blocking in fifoor state' problem of LTP tests.
  linux_*stat*() functions were opening files with O_RDONLY to get
  major/minor pair for char/block special files.  Unfortunately,
  when these functions are used against fifo, it is blocked forever
  because there is no writer.  Instead, we only open char/block special
  files for major/minor conversion.  We have to get rid of kern_open()
  entirely from translate_path_major_minor() but today is not the day.
  While I am here, add checks for errors before calling
  translate_path_major_minor().
  
  MFC r179651:
  
  d_ino member of linux_dirent structure should be unsigned long.
  
  MFC r182892:
  
  Getdents requires padding with 2 bytes instead of 1 byte
  as with getdents64. The last byte is used for storing
  the d_type, add this to plain getdents case where it was
  missing before. Also change the code to use strlcpy instead
  of plain strcpy.
  
  MFC r188572:
  
  Fix an edge-case of the linux readdir: We need the size of a linux
  dirent structure, not the size of a pointer to it.
  
  PR:   kern/113939
  Approved by:  kib (mentor)

Modified:
  stable/6/sys/   (props changed)
  stable/6/sys/compat/linux/linux_file.c
  stable/6/sys/compat/linux/linux_stats.c
  stable/6/sys/contrib/pf/   (props changed)
  stable/6/sys/dev/cxgb/   (props changed)

Modified: stable/6/sys/compat/linux/linux_file.c
==
--- stable/6/sys/compat/linux/linux_file.c  Sun Jun 21 17:35:04 2009
(r194598)
+++ stable/6/sys/compat/linux/linux_file.c  Sun Jun 21 19:02:32 2009
(r194599)
@@ -232,7 +232,7 @@ linux_readdir(struct thread *td, struct 
  */
 
 struct l_dirent {
-   l_long  d_ino;
+   l_ulong d_ino;
l_off_t d_off;
l_ushortd_reclen;
chard_name[LINUX_NAME_MAX + 1];
@@ -246,9 +246,20 @@ struct l_dirent64 {
chard_name[LINUX_NAME_MAX + 1];
 };
 
-#define LINUX_RECLEN(de,namlen) \
-ALIGNchar *)(de)-d_name - (char *)de) + (namlen) + 1))
+/*
+ * Linux uses the last byte in the dirent buffer to store d_type,
+ * at least glibc-2.7 requires it. That is why l_dirent is padded with 2 bytes.
+ */
+#define LINUX_RECLEN(namlen)   \
+roundup((offsetof(struct l_dirent, d_name) + (namlen) + 2),
\
+sizeof(l_ulong))
+
+#define LINUX_RECLEN64(namlen) \
+roundup((offsetof(struct l_dirent64, d_name) + (namlen) + 1),  \
+sizeof(uint64_t))
 
+#define LINUX_MAXRECLENmax(LINUX_RECLEN(LINUX_NAME_MAX),   
\
+   LINUX_RECLEN64(LINUX_NAME_MAX))
 #defineLINUX_DIRBLKSIZ 512
 
 static int
@@ -261,12 +272,13 @@ getdents_common(struct thread *td, struc
int len, reclen;/* BSD-format */
caddr_t outp;   /* Linux-format */
int resid, linuxreclen=0;   /* Linux-format */
+   caddr_t lbuf;   /* Linux-format */
struct file *fp;
struct uio auio;
struct iovec aiov;
off_t off;
-   struct l_dirent linux_dirent;
-   struct l_dirent64 linux_dirent64;
+   struct l_dirent *linux_dirent;
+   struct l_dirent64 *linux_dirent64;
int buflen, error, eofflag, nbytes, justone;
u_long *cookies = NULL, *cookiep;
int ncookies, vfslocked;
@@ -276,7 +288,7 @@ getdents_common(struct thread *td, struc
/* readdir(2) case. Always struct dirent. */
if (is64bit)
return (EINVAL);
-   nbytes = sizeof(linux_dirent);
+   nbytes = sizeof(*linux_dirent);
justone = 1;
} else
justone = 0;
@@ -302,6 +314,7 @@ getdents_common(struct thread *td, struc
buflen = max(LINUX_DIRBLKSIZ, nbytes);
buflen = min(buflen, MAXBSIZE);
buf = malloc(buflen, M_TEMP, M_WAITOK);
+   lbuf = malloc(LINUX_MAXRECLEN, M_TEMP, M_WAITOK | M_ZERO);
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
 
 again:
@@ -379,8 +392,8 @@ again:
}
 
linuxreclen = (is64bit)
-   ? LINUX_RECLEN(linux_dirent64, bdp-d_namlen)
-   : LINUX_RECLEN(linux_dirent, bdp-d_namlen);
+   ? LINUX_RECLEN64(bdp-d_namlen)
+   : LINUX_RECLEN(bdp-d_namlen);
 
if (reclen  len || resid  linuxreclen) {
outp++;
@@ -389,34 +402,41 @@ again:
 
if (justone) {
/* readdir(2) case. */
-   linux_dirent.d_ino = (l_long)bdp-d_fileno;
-   linux_dirent.d_off = 

svn commit: r194600 - head/sys/dev/ic

2009-06-21 Thread Sam Leffler
Author: sam
Date: Sun Jun 21 19:17:22 2009
New Revision: 194600
URL: http://svn.freebsd.org/changeset/base/194600

Log:
  add %b formats for various registers

Modified:
  head/sys/dev/ic/ns16550.h

Modified: head/sys/dev/ic/ns16550.h
==
--- head/sys/dev/ic/ns16550.h   Sun Jun 21 19:02:32 2009(r194599)
+++ head/sys/dev/ic/ns16550.h   Sun Jun 21 19:17:22 2009(r194600)
@@ -46,6 +46,8 @@
 #defineIER_ERLS0x4
 #defineIER_EMSC0x8
 
+#defineIER_BITS\20\1ERXRDY\2ETXRDY\3ERLS\4EMSC
+
 #definecom_iir 2   /* interrupt identification register 
(R) */
 #defineREG_IIR com_iir
 #defineIIR_IMASK   0xf
@@ -57,6 +59,8 @@
 #defineIIR_MLSC0x0
 #defineIIR_FIFO_MASK   0xc0/* set if FIFOs are enabled */
 
+#defineIIR_BITS\20\1NOPEND\2TXRDY\3RXRDY
+
 #definecom_lcr 3   /* line control register (R/W) */
 #definecom_cfcrcom_lcr /* character format control register 
(R/W) */
 #defineREG_LCR com_lcr
@@ -97,6 +101,8 @@
 #defineMCR_RTS 0x02
 #defineMCR_DTR 0x01
 
+#defineMCR_BITS\20\1DTR\2RTS\3DRS\4IE\5LOOPBACK\10PRESCALE
+
 #definecom_lsr 5   /* line status register (R/W) */
 #defineREG_LSR com_lsr
 #defineLSR_RCV_FIFO0x80
@@ -111,6 +117,8 @@
 #defineLSR_RXRDY   0x01
 #defineLSR_RCV_MASK0x1f
 
+#defineLSR_BITS
\20\1RXRDY\2OE\3PE\4FE\5BI\6THRE\7TEMT\10RCV_FIFO
+
 #definecom_msr 6   /* modem status register (R/W) */
 #defineREG_MSR com_msr
 #defineMSR_DCD 0x80
@@ -122,6 +130,8 @@
 #defineMSR_DDSR0x02
 #defineMSR_DCTS0x01
 
+#defineMSR_BITS
\20\1DCTS\2DDSR\3TERI\4DDCD\5CTS\6DSR\7RI\10DCD
+
 /* 8250 multiplexed registers #[0-1].  Access enabled by LCR[7]. */
 #definecom_dll 0   /* divisor latch low (R/W) */
 #definecom_dlblcom_dll
@@ -154,6 +164,8 @@
 #defineFCR_RX_HIGH 0xc0
 #defineFIFO_RX_HIGHFCR_RX_HIGH
 
+#defineFCR_BITS\20\1ENABLE\2RCV_RST\3XMT_RST\4DMA
+
 /* 16650 registers #2,[4-7].  Access enabled by LCR_EFR_ENABLE. */
 
 #definecom_efr 2   /* enhanced features register (R/W) */
___
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: r194602 - in head/sys: net netatalk netinet netinet6 netipx

2009-06-21 Thread Robert Watson
Author: rwatson
Date: Sun Jun 21 19:30:33 2009
New Revision: 194602
URL: http://svn.freebsd.org/changeset/base/194602

Log:
  Clean up common ifaddr management:
  
  - Unify reference count and lock initialization in a single function,
ifa_init().
  - Move tear-down from a macro (IFAFREE) to a function ifa_free().
  - Move reference count bump from a macro (IFAREF) to a function ifa_ref().
  - Instead of using a u_int protected by a mutex to refcount(9) for
reference count management.
  
  The ifa_mtx is now used for exactly one ioctl, and possibly should be
  removed.
  
  MFC after:3 weeks

Modified:
  head/sys/net/if.c
  head/sys/net/if_var.h
  head/sys/net/route.c
  head/sys/net/rtsock.c
  head/sys/netatalk/at_control.c
  head/sys/netinet/in.c
  head/sys/netinet6/in6.c
  head/sys/netinet6/in6_ifattach.c
  head/sys/netinet6/nd6_nbr.c
  head/sys/netipx/ipx.c

Modified: head/sys/net/if.c
==
--- head/sys/net/if.c   Sun Jun 21 19:21:01 2009(r194601)
+++ head/sys/net/if.c   Sun Jun 21 19:30:33 2009(r194602)
@@ -758,7 +758,7 @@ if_attach_internal(struct ifnet *ifp, in
socksize = roundup2(socksize, sizeof(long));
ifasize = sizeof(*ifa) + 2 * socksize;
ifa = malloc(ifasize, M_IFADDR, M_WAITOK | M_ZERO);
-   IFA_LOCK_INIT(ifa);
+   ifa_init(ifa);
sdl = (struct sockaddr_dl *)(ifa + 1);
sdl-sdl_len = socksize;
sdl-sdl_family = AF_LINK;
@@ -775,7 +775,6 @@ if_attach_internal(struct ifnet *ifp, in
sdl-sdl_len = masklen;
while (namelen != 0)
sdl-sdl_data[--namelen] = 0xff;
-   ifa-ifa_refcnt = 1;
TAILQ_INSERT_HEAD(ifp-if_addrhead, ifa, ifa_link);
/* Reliably crash if used uninitialized. */
ifp-if_broadcastaddr = NULL;
@@ -896,7 +895,7 @@ if_purgeaddrs(struct ifnet *ifp)
}
 #endif /* INET6 */
TAILQ_REMOVE(ifp-if_addrhead, ifa, ifa_link);
-   IFAFREE(ifa);
+   ifa_free(ifa);
}
 }
 
@@ -1013,7 +1012,7 @@ if_detach_internal(struct ifnet *ifp, in
if (!TAILQ_EMPTY(ifp-if_addrhead)) {
ifa = TAILQ_FIRST(ifp-if_addrhead);
TAILQ_REMOVE(ifp-if_addrhead, ifa, ifa_link);
-   IFAFREE(ifa);
+   ifa_free(ifa);
}
}
 
@@ -1420,6 +1419,34 @@ if_rtdel(struct radix_node *rn, void *ar
 }
 
 /*
+ * Reference count functions for ifaddrs.
+ */
+void
+ifa_init(struct ifaddr *ifa)
+{
+
+   mtx_init(ifa-ifa_mtx, ifaddr, NULL, MTX_DEF);
+   refcount_init(ifa-ifa_refcnt, 1);
+}
+
+void
+ifa_ref(struct ifaddr *ifa)
+{
+
+   refcount_acquire(ifa-ifa_refcnt);
+}
+
+void
+ifa_free(struct ifaddr *ifa)
+{
+
+   if (refcount_release(ifa-ifa_refcnt)) {
+   mtx_destroy(ifa-ifa_mtx);
+   free(ifa, M_IFADDR);
+   }
+}
+
+/*
  * XXX: Because sockaddr_dl has deeper structure than the sockaddr
  * structs used to represent other address families, it is necessary
  * to perform a different comparison.
@@ -1711,10 +1738,10 @@ link_rtrequest(int cmd, struct rtentry *
return;
ifa = ifaof_ifpforaddr(dst, ifp);
if (ifa) {
-   IFAREF(ifa);/* XXX */
+   ifa_ref(ifa);   /* XXX */
oifa = rt-rt_ifa;
rt-rt_ifa = ifa;
-   IFAFREE(oifa);
+   ifa_free(oifa);
if (ifa-ifa_rtrequest  ifa-ifa_rtrequest != link_rtrequest)
ifa-ifa_rtrequest(cmd, rt, info);
}

Modified: head/sys/net/if_var.h
==
--- head/sys/net/if_var.h   Sun Jun 21 19:21:01 2009(r194601)
+++ head/sys/net/if_var.h   Sun Jun 21 19:30:33 2009(r194602)
@@ -706,11 +706,14 @@ struct ifaddr {
 /* for compatibility with other BSDs */
 #defineifa_listifa_link
 
-#defineIFA_LOCK_INIT(ifa)  \
-mtx_init((ifa)-ifa_mtx, ifaddr, NULL, MTX_DEF)
+#ifdef _KERNEL
 #defineIFA_LOCK(ifa)   mtx_lock((ifa)-ifa_mtx)
 #defineIFA_UNLOCK(ifa) mtx_unlock((ifa)-ifa_mtx)
-#defineIFA_DESTROY(ifa)mtx_destroy((ifa)-ifa_mtx)
+
+void   ifa_free(struct ifaddr *ifa);
+void   ifa_init(struct ifaddr *ifa);
+void   ifa_ref(struct ifaddr *ifa);
+#endif
 
 /*
  * The prefix structure contains information about one prefix
@@ -741,24 +744,6 @@ struct ifmultiaddr {
 };
 
 #ifdef _KERNEL
-#defineIFAFREE(ifa)\
-   do {\
-   IFA_LOCK(ifa);  \
-   KASSERT((ifa)-ifa_refcnt  0,  \
-   

svn commit: r194603 - in stable/7/sys: . contrib/pf

2009-06-21 Thread Dag-Erling Smorgrav
Author: des
Date: Sun Jun 21 19:31:41 2009
New Revision: 194603
URL: http://svn.freebsd.org/changeset/base/194603

Log:
  Record r192973 as merged so it won't show up as eligible.

Modified:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)
___
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: r194604 - in stable/7/sys: . contrib/pf kern sys

2009-06-21 Thread Dag-Erling Smorgrav
Author: des
Date: Sun Jun 21 19:39:34 2009
New Revision: 194604
URL: http://svn.freebsd.org/changeset/base/194604

Log:
  merge r193027, r193557, r192900, r193028: fix trailing-slash symlink bug
  
  PR:   kern/21768

Modified:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)
  stable/7/sys/kern/vfs_lookup.c
  stable/7/sys/sys/namei.h

Modified: stable/7/sys/kern/vfs_lookup.c
==
--- stable/7/sys/kern/vfs_lookup.c  Sun Jun 21 19:31:41 2009
(r194603)
+++ stable/7/sys/kern/vfs_lookup.c  Sun Jun 21 19:39:34 2009
(r194604)
@@ -138,6 +138,9 @@ namei(struct nameidata *ndp)
cnp-cn_flags = ~LOCKSHARED;
fdp = p-p_fd;
 
+   /* We will set this ourselves if we need it. */
+   cnp-cn_flags = ~TRAILINGSLASH;
+
/*
 * Get a buffer for the name to be translated, and copy the
 * name into the buffer.
@@ -224,7 +227,7 @@ namei(struct nameidata *ndp)
vfslocked = (ndp-ni_cnd.cn_flags  GIANTHELD) != 0;
ndp-ni_cnd.cn_flags = ~GIANTHELD;
/*
-* Check for symbolic link
+* If not a symbolic link, we're done.
 */
if ((cnp-cn_flags  ISSYMLINK) == 0) {
if ((cnp-cn_flags  (SAVENAME | SAVESTART)) == 0) {
@@ -367,7 +370,6 @@ lookup(struct nameidata *ndp)
int docache;/* == 0 do not cache last component */
int wantparent; /* 1 = wantparent or lockparent flag */
int rdonly; /* lookup read-only flag bit */
-   int trailing_slash;
int error = 0;
int dpunlocked = 0; /* dp has already been unlocked */
struct componentname *cnp = ndp-ni_cnd;
@@ -439,13 +441,12 @@ dirloop:
 * trailing slashes to handle symlinks, existing non-directories
 * and non-existing files that won't be directories specially later.
 */
-   trailing_slash = 0;
while (*cp == '/'  (cp[1] == '/' || cp[1] == '\0')) {
cp++;
ndp-ni_pathlen--;
if (*cp == '\0') {
-   trailing_slash = 1;
-   *ndp-ni_next = '\0';   /* XXX for direnter() ... */
+   *ndp-ni_next = '\0';
+   cnp-cn_flags |= TRAILINGSLASH;
}
}
ndp-ni_next = cp;
@@ -604,27 +605,24 @@ unionlookup:
if (error != EJUSTRETURN)
goto bad;
/*
-* If creating and at end of pathname, then can consider
-* allowing file to be created.
+* At this point, we know we're at the end of the
+* pathname.  If creating / renaming, we can consider
+* allowing the file or directory to be created / renamed,
+* provided we're not on a read-only filesystem.
 */
if (rdonly) {
error = EROFS;
goto bad;
}
-   if (*cp == '\0'  trailing_slash 
-!(cnp-cn_flags  WILLBEDIR)) {
+   /* trailing slash only allowed for directories */
+   if ((cnp-cn_flags  TRAILINGSLASH) 
+   !(cnp-cn_flags  WILLBEDIR)) {
error = ENOENT;
goto bad;
}
if ((cnp-cn_flags  LOCKPARENT) == 0)
VOP_UNLOCK(dp, 0, td);
/*
-* This is a temporary assert to make sure I know what the
-* behavior here was.
-*/
-   KASSERT((cnp-cn_flags  (WANTPARENT|LOCKPARENT)) != 0,
-  (lookup: Unhandled case.));
-   /*
 * We return with ni_vp NULL to indicate that the entry
 * doesn't currently exist, leaving a pointer to the
 * (possibly locked) directory vnode in ndp-ni_dvp.
@@ -687,7 +685,7 @@ unionlookup:
 * Check for symbolic link
 */
if ((dp-v_type == VLNK) 
-   ((cnp-cn_flags  FOLLOW) || trailing_slash ||
+   ((cnp-cn_flags  FOLLOW) || (cnp-cn_flags  TRAILINGSLASH) ||
 *ndp-ni_next == '/')) {
cnp-cn_flags |= ISSYMLINK;
if (dp-v_iflag  VI_DOOMED) {
@@ -710,18 +708,10 @@ unionlookup:
goto success;
}
 
-   /*
-* Check for bogus trailing slashes.
-*/
-   if (trailing_slash  dp-v_type != VDIR) {
-   error = ENOTDIR;
-   goto bad2;
-   }
-
 nextname:
/*
-* Not a symbolic link.  If more pathname,
-* continue at next component, else return.
+* Not a symbolic link that we will follow.  Continue with the
+* next 

svn commit: r194607 - head/sys/vm

2009-06-21 Thread Alan Cox
Author: alc
Date: Sun Jun 21 20:29:14 2009
New Revision: 194607
URL: http://svn.freebsd.org/changeset/base/194607

Log:
  Implement a mechanism within vm_phys_alloc_contig() to defer all necessary
  calls to vdrop() until after the free page queues lock is released.  This
  eliminates repeatedly releasing and reacquiring the free page queues lock
  each time the last cached page is reclaimed from a vnode-backed object.

Modified:
  head/sys/vm/vm_phys.c

Modified: head/sys/vm/vm_phys.c
==
--- head/sys/vm/vm_phys.c   Sun Jun 21 20:08:07 2009(r194606)
+++ head/sys/vm/vm_phys.c   Sun Jun 21 20:29:14 2009(r194607)
@@ -594,7 +594,7 @@ vm_phys_alloc_contig(unsigned long npage
struct vm_phys_seg *seg;
vm_object_t m_object;
vm_paddr_t pa, pa_last, size;
-   vm_page_t m, m_ret;
+   vm_page_t deferred_vdrop_list, m, m_ret;
int flind, i, oind, order, pind;
 
size = npages  PAGE_SHIFT;
@@ -604,6 +604,7 @@ vm_phys_alloc_contig(unsigned long npage
(vm_phys_alloc_contig: alignment must be a power of 2));
KASSERT((boundary  (boundary - 1)) == 0,
(vm_phys_alloc_contig: boundary must be a power of 2));
+   deferred_vdrop_list = NULL;
/* Compute the queue that is the best fit for npages. */
for (order = 0; (1  order)  npages; order++);
mtx_lock(vm_page_queue_free_mtx);
@@ -697,10 +698,23 @@ done:
(vm_phys_alloc_contig: page %p is busy, m));
KASSERT(m-dirty == 0,
(vm_phys_alloc_contig: page %p is dirty, m));
-   m_object = m-object;
if ((m-flags  PG_CACHED) != 0) {
m-valid = 0;
+   m_object = m-object;
vm_page_cache_remove(m);
+   if (m_object-type == OBJT_VNODE 
+   m_object-cache == NULL) {
+   /*
+* Enqueue the vnode for deferred vdrop().
+*
+* Unmanaged pages don't use pageq, so it
+* can be safely abused to construct a short-
+* lived queue of vnodes.
+*/
+   m-pageq.tqe_prev = m_object-handle;
+   m-pageq.tqe_next = deferred_vdrop_list;
+   deferred_vdrop_list = m;
+   }
} else {
KASSERT(VM_PAGE_IS_FREE(m),
(vm_phys_alloc_contig: page %p is not free, m));
@@ -714,13 +728,6 @@ done:
m-flags = PG_UNMANAGED | (m-flags  PG_ZERO);
m-oflags = 0;
/* Unmanaged pages don't use act_count. */
-   if (m_object != NULL 
-   m_object-type == OBJT_VNODE 
-   m_object-cache == NULL) {
-   mtx_unlock(vm_page_queue_free_mtx);
-   vdrop(m_object-handle);
-   mtx_lock(vm_page_queue_free_mtx);
-   }
}
for (; i  roundup2(npages, 1  imin(oind, order)); i++) {
m = m_ret[i];
@@ -730,6 +737,10 @@ done:
vm_phys_free_pages(m, 0);
}
mtx_unlock(vm_page_queue_free_mtx);
+   while (deferred_vdrop_list != NULL) {
+   vdrop((struct vnode *)deferred_vdrop_list-pageq.tqe_prev);
+   deferred_vdrop_list = deferred_vdrop_list-pageq.tqe_next;
+   }
return (m_ret);
 }
 
___
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: r194608 - head/sys/netipx

2009-06-21 Thread Robert Watson
Author: rwatson
Date: Sun Jun 21 21:04:12 2009
New Revision: 194608
URL: http://svn.freebsd.org/changeset/base/194608

Log:
  Introduce basic locking of global IPX address list 'ipx_ifaddr' using
  a new rwlock, ipx_ifaddr_rw, wrapped with macros.  This locking is
  necessary but not sufficient, in isolation, to satisfy the stability
  requirements of a fully parallel IPX input path during interface
  reconfiguration.
  
  MFC after:3 weeks

Modified:
  head/sys/netipx/ipx.c
  head/sys/netipx/ipx_if.h
  head/sys/netipx/ipx_input.c
  head/sys/netipx/ipx_outputfl.c
  head/sys/netipx/ipx_pcb.c

Modified: head/sys/netipx/ipx.c
==
--- head/sys/netipx/ipx.c   Sun Jun 21 20:29:14 2009(r194607)
+++ head/sys/netipx/ipx.c   Sun Jun 21 21:04:12 2009(r194608)
@@ -65,8 +65,10 @@ __FBSDID($FreeBSD$);
 #include sys/param.h
 #include sys/kernel.h
 #include sys/systm.h
+#include sys/lock.h
 #include sys/malloc.h
 #include sys/priv.h
+#include sys/rwlock.h
 #include sys/sockio.h
 #include sys/socket.h
 
@@ -78,9 +80,10 @@ __FBSDID($FreeBSD$);
 #include netipx/ipx_var.h
 
 /*
- * XXXRW: Requires synchronization.
+ * The IPX-layer address list is protected by ipx_ifaddr_rw.
  */
-struct ipx_ifaddr *ipx_ifaddr;
+struct rwlock   ipx_ifaddr_rw;
+struct ipx_ifaddr  *ipx_ifaddr;
 
 static voidipx_ifscrub(struct ifnet *ifp, struct ipx_ifaddr *ia);
 static int ipx_ifinit(struct ifnet *ifp, struct ipx_ifaddr *ia,
@@ -345,6 +348,8 @@ ipx_iaonnetof(struct ipx_addr *dst)
struct ipx_ifaddr *ia_maybe = NULL;
union ipx_net net = dst-x_net;
 
+   IPX_IFADDR_LOCK_ASSERT();
+
for (ia = ipx_ifaddr; ia != NULL; ia = ia-ia_next) {
if ((ifp = ia-ia_ifp) != NULL) {
if (ifp-if_flags  IFF_POINTOPOINT) {

Modified: head/sys/netipx/ipx_if.h
==
--- head/sys/netipx/ipx_if.hSun Jun 21 20:29:14 2009(r194607)
+++ head/sys/netipx/ipx_if.hSun Jun 21 21:04:12 2009(r194608)
@@ -105,7 +105,16 @@ struct ipx_aliasreq {
 #defineETHERTYPE_IPX   0x8137  /* Only  Ethernet_II Available 
*/
 
 #ifdef _KERNEL
-extern struct  ipx_ifaddr *ipx_ifaddr;
+extern struct rwlockipx_ifaddr_rw;
+extern struct ipx_ifaddr   *ipx_ifaddr;
+
+#defineIPX_IFADDR_LOCK_INIT()  rw_init(ipx_ifaddr_rw, 
ipx_ifaddr_rw)
+#defineIPX_IFADDR_LOCK_ASSERT()rw_assert(ipx_ifaddr_rw, 
RA_LOCKED)
+#defineIPX_IFADDR_RLOCK()  rw_rlock(ipx_ifaddr_rw)
+#defineIPX_IFADDR_RUNLOCK()rw_runlock(ipx_ifaddr_rw)
+#defineIPX_IFADDR_WLOCK()  rw_wlock(ipx_ifaddr_rw)
+#defineIPX_IFADDR_WUNLOCK()rw_wunlock(ipx_ifaddr_rw)
+#defineIPX_IFADDR_RLOCK_ASSERT()   rw_assert(ipx_ifaddr_rw, 
RA_WLOCKED)
 
 struct ipx_ifaddr  *ipx_iaonnetof(struct ipx_addr *dst);
 #endif

Modified: head/sys/netipx/ipx_input.c
==
--- head/sys/netipx/ipx_input.c Sun Jun 21 20:29:14 2009(r194607)
+++ head/sys/netipx/ipx_input.c Sun Jun 21 21:04:12 2009(r194608)
@@ -72,6 +72,7 @@ __FBSDID($FreeBSD$);
 #include sys/socket.h
 #include sys/kernel.h
 #include sys/random.h
+#include sys/rwlock.h
 #include sys/sysctl.h
 
 #include net/if.h
@@ -146,6 +147,7 @@ ipx_init(void)
LIST_INIT(ipxrawpcb_list);
 
IPX_LIST_LOCK_INIT();
+   IPX_IFADDR_LOCK_INIT();
 
ipx_netmask.sipx_len = 6;
ipx_netmask.sipx_addr.x_net = ipx_broadnet;
@@ -253,11 +255,15 @@ ipxintr(struct mbuf *m)
 * If it is a broadcast to the net where it was
 * received from, treat it as ours.
 */
+   IPX_IFADDR_RLOCK();
for (ia = ipx_ifaddr; ia != NULL; ia = ia-ia_next)
if((ia-ia_ifa.ifa_ifp == m-m_pkthdr.rcvif) 
   ipx_neteq(ia-ia_addr.sipx_addr,
-ipx-ipx_dna))
+ipx-ipx_dna)) {
+   IPX_IFADDR_RUNLOCK();
goto ours;
+   }
+   IPX_IFADDR_RUNLOCK();
 
/*
 * Look to see if I need to eat this packet.
@@ -278,12 +284,13 @@ ipxintr(struct mbuf *m)
 * Is this our packet? If not, forward.
 */
} else {
+   IPX_IFADDR_RLOCK();
for (ia = ipx_ifaddr; ia != NULL; ia = ia-ia_next)
if (ipx_hosteq(ipx-ipx_dna, ia-ia_addr.sipx_addr) 
(ipx_neteq(ipx-ipx_dna, ia-ia_addr.sipx_addr) ||
 

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

2009-06-21 Thread Olivier Houchard
Author: cognet
Date: Sun Jun 21 21:38:12 2009
New Revision: 194609
URL: http://svn.freebsd.org/changeset/base/194609

Log:
  Disable write-back until I figure out what's wrong with it on the i81342.
  There's no need to disable the MMU once we're done inflating the kernel.

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

Modified: head/sys/arm/arm/elf_trampoline.c
==
--- head/sys/arm/arm/elf_trampoline.c   Sun Jun 21 21:04:12 2009
(r194608)
+++ head/sys/arm/arm/elf_trampoline.c   Sun Jun 21 21:38:12 2009
(r194609)
@@ -550,7 +550,7 @@ setup_pagetables(unsigned int pt_addr, v
for (addr = physstart; addr  physend; addr += L1_S_SIZE) {
pd[addr  L1_S_SHIFT] = L1_TYPE_S|L1_S_C|L1_S_AP(AP_KRW)|
L1_S_DOM(PMAP_DOMAIN_KERNEL) | addr;
-   if (write_back)
+   if (write_back  0)
pd[addr  L1_S_SHIFT] |= L1_S_B;
}
/* XXX: See below */
@@ -610,12 +610,6 @@ __start(void)
(unsigned int)func_end + 800 , 0);
if (altdst  dst)
dst = altdst;
-   cpu_idcache_wbinv_all();
-   cpu_l2cache_wbinv_all();
-   __asm __volatile(mrc p15, 0, %0, c1, c0, 0\n
-   bic %0, %0, #1\n /* MMU_ENABLE */
-   mcr p15, 0, %0, c1, c0, 0\n
-   : =r (pt_addr));
} else
 #endif
dst = 4 + load_kernel((unsigned int)kernel_start, 
___
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: r194610 - head/sys/netipx

2009-06-21 Thread Robert Watson
Author: rwatson
Date: Sun Jun 21 21:42:29 2009
New Revision: 194610
URL: http://svn.freebsd.org/changeset/base/194610

Log:
  Add ipx_ifaddr locking to ipx_control(), which should close most
  remaining potential races in ifconfig's management of IPX addresses.
  
  This is largely accomplished by dropping a global write lock for the
  IPX address list over the body of in_control(), although there are
  some places we bump the refcount on an ifaddr of interest while
  calling out to the routing code or link layer code, which might
  require revisiting.
  
  Annotate one as a potential race if two simultaneous delete ioctls
  are issued for the same IPX addresses at once.
  
  MFC after:3 weeks

Modified:
  head/sys/netipx/ipx.c

Modified: head/sys/netipx/ipx.c
==
--- head/sys/netipx/ipx.c   Sun Jun 21 21:38:12 2009(r194609)
+++ head/sys/netipx/ipx.c   Sun Jun 21 21:42:29 2009(r194610)
@@ -1,6 +1,8 @@
 /*-
  * Copyright (c) 1984, 1985, 1986, 1987, 1993
- * The Regents of the University of California.  All rights reserved.
+ * The Regents of the University of California.
+ * Copyright (c) 2009 Robert N. M. Watson
+ * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -109,32 +111,44 @@ ipx_control(struct socket *so, u_long cm
 */
if (ifp == NULL)
return (EADDRNOTAVAIL);
+
+   IPX_IFADDR_WLOCK();
for (ia = ipx_ifaddr; ia != NULL; ia = ia-ia_next)
if (ia-ia_ifp == ifp)
break;
 
switch (cmd) {
case SIOCGIFADDR:
-   if (ia == NULL)
-   return (EADDRNOTAVAIL);
+   if (ia == NULL) {
+   error = EADDRNOTAVAIL;
+   goto out;
+   }
*(struct sockaddr_ipx *)ifr-ifr_addr = ia-ia_addr;
-   return (0);
+   goto out;
 
case SIOCGIFBRDADDR:
-   if (ia == NULL)
-   return (EADDRNOTAVAIL);
-   if ((ifp-if_flags  IFF_BROADCAST) == 0)
-   return (EINVAL);
+   if (ia == NULL) {
+   error = EADDRNOTAVAIL;
+   goto out;
+   }
+   if ((ifp-if_flags  IFF_BROADCAST) == 0) {
+   error = EINVAL;
+   goto out;
+   }
*(struct sockaddr_ipx *)ifr-ifr_dstaddr = ia-ia_broadaddr;
-   return (0);
+   goto out;
 
case SIOCGIFDSTADDR:
-   if (ia == NULL)
-   return (EADDRNOTAVAIL);
-   if ((ifp-if_flags  IFF_POINTOPOINT) == 0)
-   return (EINVAL);
+   if (ia == NULL) {
+   error = EADDRNOTAVAIL;
+   goto out;
+   }
+   if ((ifp-if_flags  IFF_POINTOPOINT) == 0) {
+   error = EINVAL;
+   goto out;
+   }
*(struct sockaddr_ipx *)ifr-ifr_dstaddr = ia-ia_dstaddr;
-   return (0);
+   goto out;
}
 
switch (cmd) {
@@ -143,7 +157,7 @@ ipx_control(struct socket *so, u_long cm
priv = (cmd == SIOCAIFADDR) ? PRIV_NET_ADDIFADDR :
PRIV_NET_DELIFADDR;
if (td  (error = priv_check(td, priv)) != 0)
-   return (error);
+   goto out;
if (ifra-ifra_addr.sipx_family == AF_IPX)
for (oia = ia; ia != NULL; ia = ia-ia_next) {
if (ia-ia_ifp == ifp  
@@ -151,20 +165,24 @@ ipx_control(struct socket *so, u_long cm
  ifra-ifra_addr.sipx_addr))
break;
}
-   if (cmd == SIOCDIFADDR  ia == NULL)
-   return (EADDRNOTAVAIL);
+   if (cmd == SIOCDIFADDR  ia == NULL) {
+   error = EADDRNOTAVAIL;
+   goto out;
+   }
/* FALLTHROUGH */
 
case SIOCSIFADDR:
case SIOCSIFDSTADDR:
if (td  (error = priv_check(td, PRIV_NET_SETLLADDR)) != 0)
-   return (error);
+   goto out;
if (ia == NULL) {
oia = (struct ipx_ifaddr *)
malloc(sizeof(*ia), M_IFADDR,
-   M_WAITOK | M_ZERO);
-   if (oia == NULL)
-   return (ENOBUFS);
+   M_NOWAIT | M_ZERO);
+   if (oia == NULL) {
+   error = ENOBUFS;
+   goto out;
+ 

Re: svn commit: r194493 - head/usr.bin/catman

2009-06-21 Thread Bruce Simpson

Brooks Davis wrote:

On Sun, Jun 21, 2009 at 04:48:09PM +0200, Dag-Erling Sm??rgrav wrote:
  

Alexey Dokuchaev da...@freebsd.org writes:


This kinda brings up the question, do we actually need catman(1) at all
these days of fast CPU and disks and plenty of RAM?
  

Show me the fast CPU and plenty of RAM on this board:

http://www.soekris.com/net4801.htm



For such hardware, the OpenBSD mdoc renderer is likely to be a better
fit anyway.  It's orders of magnitude faster than *roff and wouldn't
waste space on catpages that will in all likely hood never be used.
  


Also, why are people expecting to render man pages on an embedded 
platform anyway?


I thought the reasoning behind embedded systems was that they were just 
that, and the usual expectations of desktop systems didn't necessarily 
apply. I don't expect to be able to read man pages on my pfSense 
firewall -- and its custom installed predecessor before that, didn't 
have man pages installed at all to save space in the runtime image. So 
surely the point about the Soekris here is moot?


best,
BMS
___
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: r194493 - head/usr.bin/catman

2009-06-21 Thread Matthew D. Fuller
On Sun, Jun 21, 2009 at 04:48:09PM +0200 I heard the voice of
Dag-Erling Smørgrav, and lo! it spake thus:
 Alexey Dokuchaev da...@freebsd.org writes:
  This kinda brings up the question, do we actually need catman(1) at all
  these days of fast CPU and disks and plenty of RAM?
 
 Show me the fast CPU and plenty of RAM on this board:

Actually, I looked at this sort of things some years ago when I was
sitting in front of a PPro (which was way outdated by that time), and
even the largest manpage I could find in base didn't take more than 6
or 8 seconds to render.

Now, a PPro 200 probably has rather more suds than a net4801, but it's
not a huge difference.  One can come up with situations where there's
reason to use catman, but my conclusion at the time was that I
couldn't come up with any value in man(1) writing out catpages.


-- 
Matthew Fuller (MF4839)   |  fulle...@over-yonder.net
Systems/Network Administrator |  http://www.over-yonder.net/~fullermd/
   On the Internet, nobody can hear you scream.
___
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: r194493 - head/usr.bin/catman

2009-06-21 Thread Dag-Erling Smørgrav
Bruce Simpson b...@incunabulum.net writes:
 Also, why are people expecting to render man pages on an embedded
 platform anyway?

You'd be surprised how often I type 'man pf.conf' on that box :)

DES
-- 
Dag-Erling Smørgrav - d...@des.no
___
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: r194586 - in head/sys: cddl/compat/opensolaris/kern cddl/compat/opensolaris/sys cddl/contrib/opensolaris/uts/common/fs/zfs kern sys

2009-06-21 Thread Bruce Evans

On Sun, 21 Jun 2009, Konstantin Belousov wrote:


Log:
 Add another flags argument to vn_open_cred. Use it to specify that some
 vn_open_cred invocations shall not audit namei path.



Modified: head/sys/cddl/compat/opensolaris/kern/opensolaris_kobj.c
==
--- head/sys/cddl/compat/opensolaris/kern/opensolaris_kobj.cSun Jun 21 
13:15:56 2009(r194585)
+++ head/sys/cddl/compat/opensolaris/kern/opensolaris_kobj.cSun Jun 21 
13:41:32 2009(r194586)
@@ -85,7 +85,8 @@ kobj_open_file_vnode(const char *file)

flags = FREAD;
NDINIT(nd, LOOKUP, MPSAFE, UIO_SYSSPACE, file, td);
-   error = vn_open_cred(nd, flags, O_NOFOLLOW, curthread-td_ucred, 
NULL);
+   error = vn_open_cred(nd, flags, O_NOFOLLOW, 0, curthread-td_ucred,
+   NULL);


I was going to ask why not put the flag in the existing flags arg,
like O_NOFOLLOW here?, but it seems that there is no existing flags
arg and the above O_NOFOLLOW is garbage.  O_NOFOLLOW happens to be
0x100, so I think the above asks for mode S_IRUSR.

Now I will ask why not put O_NOFOLLOW here and the new flag in the
existing pointer-to-flags arg?.


Modified: head/sys/cddl/compat/opensolaris/sys/vnode.h
==
--- head/sys/cddl/compat/opensolaris/sys/vnode.hSun Jun 21 13:15:56 
2009(r194585)
+++ head/sys/cddl/compat/opensolaris/sys/vnode.hSun Jun 21 13:41:32 
2009(r194586)
@@ -182,7 +182,7 @@ vn_openat(char *pnamep, enum uio_seg seg
vref(startvp);
NDINIT_ATVP(nd, operation, MPSAFE, UIO_SYSSPACE, pnamep, startvp, td);
filemode |= O_NOFOLLOW;
-   error = vn_open_cred(nd, filemode, createmode, td-td_ucred, NULL);
+   error = vn_open_cred(nd, filemode, createmode, 0, td-td_ucred, NULL);


Here it does put O_NOFOLLOW in the existing pointer-to-flags arg.  It
obfuscates the open-flags variable by naming it filemode.


Modified: head/sys/kern/vfs_vnops.c
==
--- head/sys/kern/vfs_vnops.c   Sun Jun 21 13:15:56 2009(r194585)
+++ head/sys/kern/vfs_vnops.c   Sun Jun 21 13:41:32 2009(r194586)
@@ -102,11 +102,8 @@ vn_open(ndp, flagp, cmode, fp)
 * due to the NDINIT being done elsewhere.
 */
int
-vn_open_cred(ndp, flagp, cmode, cred, fp)
-   struct nameidata *ndp;
-   int *flagp, cmode;
-   struct ucred *cred;
-   struct file *fp;
+vn_open_cred(struct nameidata *ndp, int *flagp, int cmode, u_int vn_open_flags,
+struct ucred *cred, struct file *fp)
{
struct vnode *vp;
struct mount *mp;
@@ -124,9 +121,11 @@ restart:
if (fmode  O_CREAT) {


Internally, flags are obfuscated by copying *flagp to the misnamed local
variable fmode.

The pointer-to-flags variable has about 12 spare bits in it.  It already
has just 1 kernel-only flag (O_HASLOCK, misnamed FHASLOCK and misassigned
in the middle of the user flags).  fcntl.h's list of open flags has
been obfuscated by putting AT_ flags in the middle of the list.

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: r194611 - in head/sys: amd64/include i386/include

2009-06-21 Thread Alan Cox
Author: alc
Date: Mon Jun 22 04:21:02 2009
New Revision: 194611
URL: http://svn.freebsd.org/changeset/base/194611

Log:
  Eliminate dead code.  These definitions should have been deleted with the
  introduction of i686_mem.c in r45405.
  
  Merge adjacent #ifdef _KERNEL/#endif blocks.

Modified:
  head/sys/amd64/include/pmap.h
  head/sys/i386/include/pmap.h

Modified: head/sys/amd64/include/pmap.h
==
--- head/sys/amd64/include/pmap.h   Sun Jun 21 21:42:29 2009
(r194610)
+++ head/sys/amd64/include/pmap.h   Mon Jun 22 04:21:02 2009
(r194611)
@@ -175,9 +175,7 @@ typedef u_int64_t pml4_entry_t;
 #definePML4pml4e   ((pd_entry_t *)(addr_PML4pml4e))
 
 extern u_int64_t KPML4phys;/* physical address of kernel level 4 */
-#endif
 
-#ifdef _KERNEL
 /*
  * virtual address to page table entry and
  * to physical address.
@@ -294,14 +292,6 @@ struct pv_chunk {
 
 #ifdef _KERNEL
 
-#define NPPROVMTRR 8
-#define PPRO_VMTRRphysBase00x200
-#define PPRO_VMTRRphysMask00x201
-struct ppro_vmtrr {
-   u_int64_t base, mask;
-};
-extern struct ppro_vmtrr PPro_vmtrr[NPPROVMTRR];
-
 extern caddr_t CADDR1;
 extern pt_entry_t *CMAP1;
 extern vm_paddr_t phys_avail[];

Modified: head/sys/i386/include/pmap.h
==
--- head/sys/i386/include/pmap.hSun Jun 21 21:42:29 2009
(r194610)
+++ head/sys/i386/include/pmap.hMon Jun 22 04:21:02 2009
(r194611)
@@ -185,9 +185,7 @@ extern pd_entry_t PTDpde[];
 extern pdpt_entry_t *IdlePDPT;
 #endif
 extern pd_entry_t *IdlePTD;/* physical address of Idle state directory */
-#endif
 
-#ifdef _KERNEL
 /*
  * virtual address to page table entry and
  * to physical address.
@@ -450,14 +448,6 @@ struct pv_chunk {
 
 #ifdef _KERNEL
 
-#define NPPROVMTRR 8
-#define PPRO_VMTRRphysBase00x200
-#define PPRO_VMTRRphysMask00x201
-struct ppro_vmtrr {
-   u_int64_t base, mask;
-};
-extern struct ppro_vmtrr PPro_vmtrr[NPPROVMTRR];
-
 extern caddr_t CADDR1;
 extern pt_entry_t *CMAP1;
 extern vm_paddr_t phys_avail[];
___
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