svn commit: r300195 - head/sys/dev/bwn

2016-05-18 Thread Adrian Chadd
Author: adrian
Date: Thu May 19 05:09:20 2016
New Revision: 300195
URL: https://svnweb.freebsd.org/changeset/base/300195

Log:
  [bwn] quieten the "invalid firmware state".
  
  That pops up in the rev 5xx / 6xx microcode on the later cores
  (4312, 4322.) I'm not sure why this is happening yet and I'll
  dig into it, but Linux b43 does the same thing.

Modified:
  head/sys/dev/bwn/if_bwn.c

Modified: head/sys/dev/bwn/if_bwn.c
==
--- head/sys/dev/bwn/if_bwn.c   Thu May 19 05:06:48 2016(r300194)
+++ head/sys/dev/bwn/if_bwn.c   Thu May 19 05:09:20 2016(r300195)
@@ -3774,8 +3774,11 @@ bwn_mac_enable(struct bwn_mac *mac)
state = bwn_shm_read_2(mac, BWN_SHARED,
BWN_SHARED_UCODESTAT);
if (state != BWN_SHARED_UCODESTAT_SUSPEND &&
-   state != BWN_SHARED_UCODESTAT_SLEEP)
-   device_printf(sc->sc_dev, "warn: firmware state (%d)\n", state);
+   state != BWN_SHARED_UCODESTAT_SLEEP) {
+   DPRINTF(sc, BWN_DEBUG_FW,
+   "%s: warn: firmware state (%d)\n",
+   __func__, state);
+   }
 
mac->mac_suspended--;
KASSERT(mac->mac_suspended >= 0,
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r300194 - head/sys/dev/bwn

2016-05-18 Thread Adrian Chadd
Author: adrian
Date: Thu May 19 05:06:48 2016
New Revision: 300194
URL: https://svnweb.freebsd.org/changeset/base/300194

Log:
  [bwn] program in the MAC capabilities somewhere where later microcode
  expects it.
  
  Obtained from:Linux b43

Modified:
  head/sys/dev/bwn/if_bwn.c
  head/sys/dev/bwn/if_bwnreg.h

Modified: head/sys/dev/bwn/if_bwn.c
==
--- head/sys/dev/bwn/if_bwn.c   Thu May 19 05:06:12 2016(r300193)
+++ head/sys/dev/bwn/if_bwn.c   Thu May 19 05:06:48 2016(r300194)
@@ -2071,6 +2071,19 @@ bwn_core_init(struct bwn_mac *mac)
hf &= ~BWN_HF_SKIP_CFP_UPDATE;
bwn_hf_write(mac, hf);
 
+   /* Tell the firmware about the MAC capabilities */
+   if (siba_get_revid(sc->sc_dev) >= 13) {
+   uint32_t cap;
+   cap = BWN_READ_4(mac, BWN_MAC_HW_CAP);
+   DPRINTF(sc, BWN_DEBUG_RESET,
+   "%s: hw capabilities: 0x%08x\n",
+   __func__, cap);
+   bwn_shm_write_2(mac, BWN_SHARED, BWN_SHARED_MACHW_L,
+   cap & 0x);
+   bwn_shm_write_2(mac, BWN_SHARED, BWN_SHARED_MACHW_H,
+   (cap >> 16) & 0x);
+   }
+
bwn_set_txretry(mac, BWN_RETRY_SHORT, BWN_RETRY_LONG);
bwn_shm_write_2(mac, BWN_SHARED, BWN_SHARED_SHORT_RETRY_FALLBACK, 3);
bwn_shm_write_2(mac, BWN_SHARED, BWN_SHARED_LONG_RETRY_FALLBACK, 2);

Modified: head/sys/dev/bwn/if_bwnreg.h
==
--- head/sys/dev/bwn/if_bwnreg.hThu May 19 05:06:12 2016
(r300193)
+++ head/sys/dev/bwn/if_bwnreg.hThu May 19 05:06:48 2016
(r300194)
@@ -169,6 +169,7 @@
 #defineBWN_RAM_CONTROL 0x130
 #defineBWN_RAM_DATA0x134
 #defineBWN_PS_STATUS   0x140
+#defineBWN_MAC_HW_CAP  0x15c   /* core rev >= 13 */
 #defineBWN_RF_HWENABLED_HI 0x158
 #defineBWN_RF_HWENABLED_HI_MASK(1 << 16)
 #defineBWN_SHM_CONTROL 0x160
@@ -284,6 +285,8 @@
 #defineBWN_SHARED_SPU_WAKEUP   0x0094
 #defineBWN_SHARED_PRETBTT  0x0096
 #defineBWN_SHARED_CHAN 0x00a0
+#defineBWN_SHARED_MACHW_L  0x00c0
+#defineBWN_SHARED_MACHW_H  0x00c2
 #defineBWN_SHARED_AUTOINC  0x0100
 #defineBWN_SHARED_PROBE_RESP_PHYCTL0x0188
 #defineBWN_SHARED_EDCFQ0x0240
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r300193 - head/sys/gnu/dev/bwn/phy_n

2016-05-18 Thread Adrian Chadd
Author: adrian
Date: Thu May 19 05:06:12 2016
New Revision: 300193
URL: https://svnweb.freebsd.org/changeset/base/300193

Log:
  [bwn] typo.

Modified:
  head/sys/gnu/dev/bwn/phy_n/if_bwn_radio_2057.c

Modified: head/sys/gnu/dev/bwn/phy_n/if_bwn_radio_2057.c
==
--- head/sys/gnu/dev/bwn/phy_n/if_bwn_radio_2057.c  Thu May 19 04:48:13 
2016(r300192)
+++ head/sys/gnu/dev/bwn/phy_n/if_bwn_radio_2057.c  Thu May 19 05:06:12 
2016(r300193)
@@ -32,7 +32,7 @@ __FBSDID("$FreeBSD$");
  */
 
 #include "opt_wlan.h"
-#include "opt_bwn.h'
+#include "opt_bwn.h"
 
 #include 
 #include 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r300192 - head/sys/gnu/dev/bwn/phy_n

2016-05-18 Thread Adrian Chadd
Author: adrian
Date: Thu May 19 04:48:13 2016
New Revision: 300192
URL: https://svnweb.freebsd.org/changeset/base/300192

Log:
  [bwn] disable rfon checks so the 2056/2057 radios are programmed.
  
  This was the big missing piece for getting the BCM94322MC NIC
  to work at all.
  
  Tested:
  
  * BCM4322, STA mode (2g, 5g)

Modified:
  head/sys/gnu/dev/bwn/phy_n/if_bwn_phy_n_core.c

Modified: head/sys/gnu/dev/bwn/phy_n/if_bwn_phy_n_core.c
==
--- head/sys/gnu/dev/bwn/phy_n/if_bwn_phy_n_core.c  Thu May 19 04:46:21 
2016(r300191)
+++ head/sys/gnu/dev/bwn/phy_n/if_bwn_phy_n_core.c  Thu May 19 04:48:13 
2016(r300192)
@@ -6743,15 +6743,21 @@ bwn_nphy_op_software_rfkill(struct bwn_m
"%s: called; rev=%d, rf_on=%d, active=%d\n", __func__,
phy->rev, mac->mac_phy.rf_on, active);
 
+   /*
+* XXX TODO: don't bother doing RF programming if it's
+* already done.  But, bwn(4) currently sets rf_on in the
+* PHY setup and leaves it on after startup, which causes
+* the below to not init the 2056/2057 radios.
+*/
if (active) {
if (phy->rev >= 19) {
/* TODO */
} else if (phy->rev >= 7) {
-   if (!mac->mac_phy.rf_on)
+// if (!mac->mac_phy.rf_on)
bwn_radio_2057_init(mac);
bwn_switch_channel(mac, bwn_get_chan(mac));
} else if (phy->rev >= 3) {
-   if (!mac->mac_phy.rf_on)
+// if (!mac->mac_phy.rf_on)
bwn_radio_init2056(mac);
bwn_switch_channel(mac, bwn_get_chan(mac));
} else {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r300191 - head/sys/gnu/dev/bwn/phy_n

2016-05-18 Thread Adrian Chadd
Author: adrian
Date: Thu May 19 04:46:21 2016
New Revision: 300191
URL: https://svnweb.freebsd.org/changeset/base/300191

Log:
  [bwn] improve N-PHY debuggability a little bit.

Modified:
  head/sys/gnu/dev/bwn/phy_n/if_bwn_phy_n_core.c

Modified: head/sys/gnu/dev/bwn/phy_n/if_bwn_phy_n_core.c
==
--- head/sys/gnu/dev/bwn/phy_n/if_bwn_phy_n_core.c  Thu May 19 04:45:50 
2016(r300190)
+++ head/sys/gnu/dev/bwn/phy_n/if_bwn_phy_n_core.c  Thu May 19 04:46:21 
2016(r300191)
@@ -1406,6 +1406,7 @@ static uint8_t bwn_radio_2056_rcal(struc
 
if (phy->rev != 3)
return 0;
+   DPRINTF(mac->mac_sc, BWN_DEBUG_RF, "%s: called\n", __func__);
 
mast2 = BWN_RF_READ(mac, B2056_SYN_PLL_MAST2);
BWN_RF_WRITE(mac, B2056_SYN_PLL_MAST2, mast2 | 0x7);
@@ -1432,6 +1433,8 @@ static uint8_t bwn_radio_2056_rcal(struc
 
 static void bwn_radio_init2056_pre(struct bwn_mac *mac)
 {
+   DPRINTF(mac->mac_sc, BWN_DEBUG_RF, "%s: called\n", __func__);
+
BWN_PHY_MASK(mac, BWN_NPHY_RFCTL_CMD,
 ~BWN_NPHY_RFCTL_CMD_CHIP0PU);
/* Maybe wl meant to reset and set (order?) RFCTL_CMD_OEPORFORCE? */
@@ -1445,6 +1448,8 @@ static void bwn_radio_init2056_pre(struc
 
 static void bwn_radio_init2056_post(struct bwn_mac *mac)
 {
+   DPRINTF(mac->mac_sc, BWN_DEBUG_RF, "%s: called\n", __func__);
+
BWN_RF_SET(mac, B2056_SYN_COM_CTRL, 0xB);
BWN_RF_SET(mac, B2056_SYN_COM_PU, 0x2);
BWN_RF_SET(mac, B2056_SYN_COM_RESET, 0x2);
@@ -1462,6 +1467,8 @@ static void bwn_radio_init2056_post(stru
  */
 static void bwn_radio_init2056(struct bwn_mac *mac)
 {
+   DPRINTF(mac->mac_sc, BWN_DEBUG_RF, "%s: called\n", __func__);
+
bwn_radio_init2056_pre(mac);
b2056_upload_inittabs(mac, 0, 0);
bwn_radio_init2056_post(mac);
@@ -6375,6 +6382,7 @@ static void bwn_nphy_pmu_spur_avoid(stru
 
/* XXX bhnd */
if (bwn_is_bus_siba(mac)) {
+   DPRINTF(sc, BWN_DEBUG_RESET, "%s: spuravoid %d\n", __func__, 
avoid);
siba_pmu_spuravoid_pllupdate(sc->sc_dev, avoid);
}
 }
@@ -6391,7 +6399,7 @@ static void bwn_nphy_channel_setup(struc
uint16_t tmp16;
 
if (bwn_channel_band(mac, new_channel) == BWN_BAND_5G) {
-   DPRINTF(sc, BWN_DEBUG_RESET, "%s: BAND_2G\n", __func__);
+   DPRINTF(sc, BWN_DEBUG_RESET, "%s: BAND_5G; chan=%d\n", 
__func__, ch);
/* Switch to 2 GHz for a moment to access BWN_PHY_B_BBCFG */
BWN_PHY_MASK(mac, BWN_NPHY_BANDCTL, ~BWN_NPHY_BANDCTL_5GHZ);
 
@@ -6403,7 +6411,7 @@ static void bwn_nphy_channel_setup(struc
BWN_WRITE_2(mac, BWN_PSM_PHY_HDR, tmp16);
BWN_PHY_SET(mac, BWN_NPHY_BANDCTL, BWN_NPHY_BANDCTL_5GHZ);
} else if (bwn_channel_band(mac, new_channel) == BWN_BAND_2G) {
-   DPRINTF(sc, BWN_DEBUG_RESET, "%s: BAND_2G\n", __func__);
+   DPRINTF(sc, BWN_DEBUG_RESET, "%s: BAND_2G; chan=%d\n", 
__func__, ch);
BWN_PHY_MASK(mac, BWN_NPHY_BANDCTL, ~BWN_NPHY_BANDCTL_5GHZ);
tmp16 = BWN_READ_2(mac, BWN_PSM_PHY_HDR);
BWN_WRITE_2(mac, BWN_PSM_PHY_HDR, tmp16 | 4);
@@ -6731,10 +6739,11 @@ bwn_nphy_op_software_rfkill(struct bwn_m
if (BWN_READ_4(mac, BWN_MACCTL) & BWN_MACCTL_ON)
BWN_ERRPRINTF(mac->mac_sc, "MAC not suspended\n");
 
+   DPRINTF(mac->mac_sc, BWN_DEBUG_RESET | BWN_DEBUG_PHY,
+   "%s: called; rev=%d, rf_on=%d, active=%d\n", __func__,
+   phy->rev, mac->mac_phy.rf_on, active);
+
if (active) {
-   DPRINTF(mac->mac_sc, BWN_DEBUG_RESET | BWN_DEBUG_PHY,
-   "%s: called; rev=%d, rf_on=%d\n", __func__,
-   phy->rev, mac->mac_phy.rf_on);
if (phy->rev >= 19) {
/* TODO */
} else if (phy->rev >= 7) {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r300190 - head/sys/gnu/dev/bwn/phy_n

2016-05-18 Thread Adrian Chadd
Author: adrian
Date: Thu May 19 04:45:50 2016
New Revision: 300190
URL: https://svnweb.freebsd.org/changeset/base/300190

Log:
  [bwn] add opt_wlan.h and opt_bwn.h to each of the phy_n source files.

Modified:
  head/sys/gnu/dev/bwn/phy_n/if_bwn_phy_n_core.c
  head/sys/gnu/dev/bwn/phy_n/if_bwn_phy_n_ppr.c
  head/sys/gnu/dev/bwn/phy_n/if_bwn_phy_n_tables.c
  head/sys/gnu/dev/bwn/phy_n/if_bwn_radio_2055.c
  head/sys/gnu/dev/bwn/phy_n/if_bwn_radio_2056.c
  head/sys/gnu/dev/bwn/phy_n/if_bwn_radio_2057.c

Modified: head/sys/gnu/dev/bwn/phy_n/if_bwn_phy_n_core.c
==
--- head/sys/gnu/dev/bwn/phy_n/if_bwn_phy_n_core.c  Thu May 19 04:29:25 
2016(r300189)
+++ head/sys/gnu/dev/bwn/phy_n/if_bwn_phy_n_core.c  Thu May 19 04:45:50 
2016(r300190)
@@ -31,6 +31,9 @@ __FBSDID("$FreeBSD$");
  * The Broadcom Wireless LAN controller driver.
  */
 
+#include "opt_wlan.h"
+#include "opt_bwn.h"
+
 #include 
 #include 
 #include 

Modified: head/sys/gnu/dev/bwn/phy_n/if_bwn_phy_n_ppr.c
==
--- head/sys/gnu/dev/bwn/phy_n/if_bwn_phy_n_ppr.c   Thu May 19 04:29:25 
2016(r300189)
+++ head/sys/gnu/dev/bwn/phy_n/if_bwn_phy_n_ppr.c   Thu May 19 04:45:50 
2016(r300190)
@@ -29,6 +29,8 @@ __FBSDID("$FreeBSD$");
 /*
  * The Broadcom Wireless LAN controller driver.
  */
+#include "opt_wlan.h"
+#include "opt_bwn.h"
 
 #include 
 #include 

Modified: head/sys/gnu/dev/bwn/phy_n/if_bwn_phy_n_tables.c
==
--- head/sys/gnu/dev/bwn/phy_n/if_bwn_phy_n_tables.cThu May 19 04:29:25 
2016(r300189)
+++ head/sys/gnu/dev/bwn/phy_n/if_bwn_phy_n_tables.cThu May 19 04:45:50 
2016(r300190)
@@ -30,6 +30,9 @@ __FBSDID("$FreeBSD$");
  * The Broadcom Wireless LAN controller driver.
  */
 
+#include "opt_wlan.h"
+#include "opt_bwn.h"
+
 #include 
 #include 
 #include 

Modified: head/sys/gnu/dev/bwn/phy_n/if_bwn_radio_2055.c
==
--- head/sys/gnu/dev/bwn/phy_n/if_bwn_radio_2055.c  Thu May 19 04:29:25 
2016(r300189)
+++ head/sys/gnu/dev/bwn/phy_n/if_bwn_radio_2055.c  Thu May 19 04:45:50 
2016(r300190)
@@ -30,6 +30,9 @@ __FBSDID("$FreeBSD$");
  * The Broadcom Wireless LAN controller driver.
  */
 
+#include "opt_wlan.h"
+#include "opt_bwn.h"
+
 #include 
 #include 
 #include 

Modified: head/sys/gnu/dev/bwn/phy_n/if_bwn_radio_2056.c
==
--- head/sys/gnu/dev/bwn/phy_n/if_bwn_radio_2056.c  Thu May 19 04:29:25 
2016(r300189)
+++ head/sys/gnu/dev/bwn/phy_n/if_bwn_radio_2056.c  Thu May 19 04:45:50 
2016(r300190)
@@ -31,6 +31,9 @@ __FBSDID("$FreeBSD$");
  * The Broadcom Wireless LAN controller driver.
  */
 
+#include "opt_wlan.h"
+#include "opt_bwn.h"
+
 #include 
 #include 
 #include 

Modified: head/sys/gnu/dev/bwn/phy_n/if_bwn_radio_2057.c
==
--- head/sys/gnu/dev/bwn/phy_n/if_bwn_radio_2057.c  Thu May 19 04:29:25 
2016(r300189)
+++ head/sys/gnu/dev/bwn/phy_n/if_bwn_radio_2057.c  Thu May 19 04:45:50 
2016(r300190)
@@ -31,6 +31,9 @@ __FBSDID("$FreeBSD$");
  * The Broadcom Wireless LAN controller driver.
  */
 
+#include "opt_wlan.h"
+#include "opt_bwn.h'
+
 #include 
 #include 
 #include 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r300189 - head/sys/dev/bwn

2016-05-18 Thread Adrian Chadd
Author: adrian
Date: Thu May 19 04:29:25 2016
New Revision: 300189
URL: https://svnweb.freebsd.org/changeset/base/300189

Log:
  [bwn] add extra debugging.

Modified:
  head/sys/dev/bwn/if_bwn.c

Modified: head/sys/dev/bwn/if_bwn.c
==
--- head/sys/dev/bwn/if_bwn.c   Thu May 19 04:28:49 2016(r300188)
+++ head/sys/dev/bwn/if_bwn.c   Thu May 19 04:29:25 2016(r300189)
@@ -2008,6 +2008,8 @@ bwn_core_init(struct bwn_mac *mac)
KASSERT(mac->mac_status == BWN_MAC_STATUS_UNINIT,
("%s:%d: fail", __func__, __LINE__));
 
+   DPRINTF(mac->mac_sc, BWN_DEBUG_RESET, "%s: called\n", __func__);
+
siba_powerup(sc->sc_dev, 0);
if (!siba_dev_isup(sc->sc_dev))
bwn_reset_core(mac, mac->mac_phy.gmode);
@@ -2041,6 +2043,7 @@ bwn_core_init(struct bwn_mac *mac)
if (error)
goto fail0;
}
+   DPRINTF(mac->mac_sc, BWN_DEBUG_RESET, "%s: chip_init\n", __func__);
error = bwn_chip_init(mac);
if (error)
goto fail0;
@@ -2088,6 +2091,7 @@ bwn_core_init(struct bwn_mac *mac)
bwn_spu_setdelay(mac, 1);
bwn_bt_enable(mac);
 
+   DPRINTF(mac->mac_sc, BWN_DEBUG_RESET, "%s: powerup\n", __func__);
siba_powerup(sc->sc_dev,
!(siba_sprom_get_bf_lo(sc->sc_dev) & BWN_BFL_CRYSTAL_NOSLOW));
bwn_set_macaddr(mac);
@@ -2097,12 +2101,14 @@ bwn_core_init(struct bwn_mac *mac)
 
mac->mac_status = BWN_MAC_STATUS_INITED;
 
+   DPRINTF(mac->mac_sc, BWN_DEBUG_RESET, "%s: done\n", __func__);
return (error);
 
 fail0:
siba_powerdown(sc->sc_dev);
KASSERT(mac->mac_status == BWN_MAC_STATUS_UNINIT,
("%s:%d: fail", __func__, __LINE__));
+   DPRINTF(mac->mac_sc, BWN_DEBUG_RESET, "%s: fail\n", __func__);
return (error);
 }
 
@@ -3716,6 +3722,9 @@ bwn_mac_suspend(struct bwn_mac *mac)
KASSERT(mac->mac_suspended >= 0,
("%s:%d: fail", __func__, __LINE__));
 
+   DPRINTF(mac->mac_sc, BWN_DEBUG_RESET, "%s: suspended=%d\n",
+   __func__, mac->mac_suspended);
+
if (mac->mac_suspended == 0) {
bwn_psctl(mac, BWN_PS_AWAKE);
BWN_WRITE_4(mac, BWN_MACCTL,
@@ -3746,6 +3755,9 @@ bwn_mac_enable(struct bwn_mac *mac)
struct bwn_softc *sc = mac->mac_sc;
uint16_t state;
 
+   DPRINTF(mac->mac_sc, BWN_DEBUG_RESET, "%s: suspended=%d\n",
+   __func__, mac->mac_suspended);
+
state = bwn_shm_read_2(mac, BWN_SHARED,
BWN_SHARED_UCODESTAT);
if (state != BWN_SHARED_UCODESTAT_SUSPEND &&
@@ -4783,12 +4795,15 @@ bwn_intr(void *arg)
(sc->sc_flags & BWN_FLAG_INVALID))
return (FILTER_STRAY);
 
+   DPRINTF(sc, BWN_DEBUG_INTR, "%s: called\n", __func__);
+
reason = BWN_READ_4(mac, BWN_INTR_REASON);
if (reason == 0x)   /* shared IRQ */
return (FILTER_STRAY);
reason &= mac->mac_intr_mask;
if (reason == 0)
return (FILTER_HANDLED);
+   DPRINTF(sc, BWN_DEBUG_INTR, "%s: reason=0x%08x\n", __func__, reason);
 
mac->mac_reason[0] = BWN_READ_4(mac, BWN_DMA0_REASON) & 0x0001dc00;
mac->mac_reason[1] = BWN_READ_4(mac, BWN_DMA1_REASON) & 0xdc00;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r300188 - head/sys/dev/bwn

2016-05-18 Thread Adrian Chadd
Author: adrian
Date: Thu May 19 04:28:49 2016
New Revision: 300188
URL: https://svnweb.freebsd.org/changeset/base/300188

Log:
  [bwn] toggle the PHY clock during chip reset.
  
  Tested:
  
  * BCM4311, STA mode
  * BCM4312, STA mode
  * BCM4321, STA mode
  * BCM4322, STA mde

Modified:
  head/sys/dev/bwn/if_bwn.c

Modified: head/sys/dev/bwn/if_bwn.c
==
--- head/sys/dev/bwn/if_bwn.c   Thu May 19 04:23:54 2016(r300187)
+++ head/sys/dev/bwn/if_bwn.c   Thu May 19 04:28:49 2016(r300188)
@@ -1359,13 +1359,15 @@ bwn_reset_core(struct bwn_mac *mac, int 
 
/* Take PHY out of reset */
low = (siba_read_4(sc->sc_dev, SIBA_TGSLOW) | SIBA_TGSLOW_FGC) &
-   ~BWN_TGSLOW_PHYRESET;
+   ~(BWN_TGSLOW_PHYRESET | BWN_TGSLOW_PHYCLOCK_ENABLE);
siba_write_4(sc->sc_dev, SIBA_TGSLOW, low);
siba_read_4(sc->sc_dev, SIBA_TGSLOW);
-   DELAY(1000);
-   siba_write_4(sc->sc_dev, SIBA_TGSLOW, low & ~SIBA_TGSLOW_FGC);
+   DELAY(2000);
+   low &= ~SIBA_TGSLOW_FGC;
+   low |= BWN_TGSLOW_PHYCLOCK_ENABLE;
+   siba_write_4(sc->sc_dev, SIBA_TGSLOW, low);
siba_read_4(sc->sc_dev, SIBA_TGSLOW);
-   DELAY(1000);
+   DELAY(2000);
 
if (mac->mac_phy.switch_analog != NULL)
mac->mac_phy.switch_analog(mac, 1);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r300187 - head/sys/dev/bwn

2016-05-18 Thread Adrian Chadd
Author: adrian
Date: Thu May 19 04:23:54 2016
New Revision: 300187
URL: https://svnweb.freebsd.org/changeset/base/300187

Log:
  [bwn] enable dual-phy on BCM4322MC.
  
  Tested (with later commits):
  
  * BCM4322MC, STA mode, 2G + 5G

Modified:
  head/sys/dev/bwn/if_bwn.c

Modified: head/sys/dev/bwn/if_bwn.c
==
--- head/sys/dev/bwn/if_bwn.c   Thu May 19 04:22:58 2016(r300186)
+++ head/sys/dev/bwn/if_bwn.c   Thu May 19 04:23:54 2016(r300187)
@@ -1202,7 +1202,8 @@ bwn_attach_core(struct bwn_mac *mac)
if (siba_get_pci_device(sc->sc_dev) != 0x4312 &&
siba_get_pci_device(sc->sc_dev) != 0x4319 &&
siba_get_pci_device(sc->sc_dev) != 0x4324 &&
-   siba_get_pci_device(sc->sc_dev) != 0x4328) {
+   siba_get_pci_device(sc->sc_dev) != 0x4328 &&
+   siba_get_pci_device(sc->sc_dev) != 0x432b) {
have_a = have_bg = 0;
if (mac->mac_phy.type == BWN_PHYTYPE_A)
have_a = 1;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r300186 - head/sys/dev/bwn

2016-05-18 Thread Adrian Chadd
Author: adrian
Date: Thu May 19 04:22:58 2016
New Revision: 300186
URL: https://svnweb.freebsd.org/changeset/base/300186

Log:
  [bwn] rename TGS low registers to be consistent with naming scheme.

Modified:
  head/sys/dev/bwn/if_bwn_phy_common.c
  head/sys/dev/bwn/if_bwnreg.h

Modified: head/sys/dev/bwn/if_bwn_phy_common.c
==
--- head/sys/dev/bwn/if_bwn_phy_common.cThu May 19 04:11:49 2016
(r300185)
+++ head/sys/dev/bwn/if_bwn_phy_common.cThu May 19 04:22:58 2016
(r300186)
@@ -186,9 +186,9 @@ bwn_mac_phy_clock_set(struct bwn_mac *ma
if (bwn_is_bus_siba(mac)) {
val = siba_read_4(sc->sc_dev, SIBA_TGSLOW);
if (enabled)
-   val |= BWN_TMSLOW_MACPHYCLKEN;
+   val |= BWN_TGSLOW_MACPHYCLKEN;
else
-   val &= ~BWN_TMSLOW_MACPHYCLKEN;
+   val &= ~BWN_TGSLOW_MACPHYCLKEN;
siba_write_4(sc->sc_dev, SIBA_TGSLOW, val);
}
 }

Modified: head/sys/dev/bwn/if_bwnreg.h
==
--- head/sys/dev/bwn/if_bwnreg.hThu May 19 04:11:49 2016
(r300185)
+++ head/sys/dev/bwn/if_bwnreg.hThu May 19 04:22:58 2016
(r300186)
@@ -97,8 +97,8 @@
 /* SIBA control registers */
 #defineBWN_TGSLOW_PHYCLOCK_ENABLE  0x0004
 #defineBWN_TGSLOW_PHYRESET 0x0008
-#defineBWN_TMSLOW_MACPHYCLKEN  0x0010  /* MAC PHY 
Clock Control Enable (rev >= 5) */
-#defineBWN_TMSLOW_PLLREFSEL0x0020  /* PLL 
Frequency Reference Select (rev >= 5) */
+#defineBWN_TGSLOW_MACPHYCLKEN  0x0010  /* MAC PHY 
Clock Control Enable (rev >= 5) */
+#defineBWN_TGSLOW_PLLREFSEL0x0020  /* PLL 
Frequency Reference Select (rev >= 5) */
 /* PHY_BANDWIDTH: N-PHY only */
 #defineBWN_TGSLOW_PHY_BANDWIDTH0x00C0
 #defineBWN_TGSLOW_PHY_BANDWIDTH_10MHZ  0x
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r300184 - head/sys/dev/siba

2016-05-18 Thread Adrian Chadd
Author: adrian
Date: Thu May 19 04:11:00 2016
New Revision: 300184
URL: https://svnweb.freebsd.org/changeset/base/300184

Log:
  [siba] implement PMU behaviour for chips with a separate PMU module.
  
  * PMU controls the clock setup
  * Correctly set idle low power handling
  * Use a hard-coded powerup delay for some of the newer hardware
(including the BCM4322, which I've tested with.)
  
  Tested:
  
  * BCM4322, 2G + 5G STA mode
  
  Obtained from:Linux b43 (PMU behaviour)

Modified:
  head/sys/dev/siba/siba_core.c

Modified: head/sys/dev/siba/siba_core.c
==
--- head/sys/dev/siba/siba_core.c   Thu May 19 04:03:41 2016
(r300183)
+++ head/sys/dev/siba/siba_core.c   Thu May 19 04:11:00 2016
(r300184)
@@ -774,6 +774,13 @@ siba_cc_clock(struct siba_cc *scc, enum 
if (sd == NULL)
return;
siba = sd->sd_bus;
+
+   /*
+* PMU controls clockmode; separate function is needed
+*/
+   if (scc->scc_caps & SIBA_CC_CAPS_PMU)
+   return;
+
/*
 * chipcommon < r6 (no dynamic clock control)
 * chipcommon >= r10 (unknown)
@@ -930,6 +937,7 @@ siba_cc_pmu_init(struct siba_cc *scc)
DPRINTF(siba, SIBA_DEBUG_PMU, "PMU(r%u) found (caps %#x)\n",
scc->scc_pmu.rev, pmucap);
 
+#if 0
if (scc->scc_pmu.rev >= 1) {
if (siba->siba_chiprev < 2 && siba->siba_chipid == 0x4325)
SIBA_CC_MASK32(scc, SIBA_CC_PMUCTL,
@@ -938,6 +946,12 @@ siba_cc_pmu_init(struct siba_cc *scc)
SIBA_CC_SET32(scc, SIBA_CC_PMUCTL,
SIBA_CC_PMUCTL_NOILP);
}
+#endif
+   if (scc->scc_pmu.rev == 1) {
+   SIBA_CC_MASK32(scc, SIBA_CC_PMUCTL, ~SIBA_CC_PMUCTL_NOILP);
+   } else {
+   SIBA_CC_SET32(scc, SIBA_CC_PMUCTL, SIBA_CC_PMUCTL_NOILP);
+   }
 
/* initialize PLL & PMU resources */
switch (siba->siba_chipid) {
@@ -1070,8 +1084,22 @@ siba_cc_powerup_delay(struct siba_cc *sc
struct siba_softc *siba = scc->scc_dev->sd_bus;
int min;
 
-   if (siba->siba_type != SIBA_TYPE_PCI ||
-   !(scc->scc_caps & SIBA_CC_CAPS_PWCTL))
+   if (siba->siba_type != SIBA_TYPE_PCI)
+   return;
+
+   if (scc->scc_caps & SIBA_CC_CAPS_PMU) {
+   if ((siba->siba_chipid == 0x4312) ||
+   (siba->siba_chipid == 0x4322) ||
+   (siba->siba_chipid == 0x4328)) {
+   scc->scc_powerup_delay = 7000;
+   } else {
+   /* 0x4325 is marked as TODO */
+   scc->scc_powerup_delay = 15000;
+   }
+   return;
+   }
+
+   if (!(scc->scc_caps & SIBA_CC_CAPS_PWCTL))
return;
 
min = siba_cc_clockfreq(scc, 0);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r300185 - head/sys/dev/siba

2016-05-18 Thread Adrian Chadd
Author: adrian
Date: Thu May 19 04:11:49 2016
New Revision: 300185
URL: https://svnweb.freebsd.org/changeset/base/300185

Log:
  [siba] use consistent naming.

Modified:
  head/sys/dev/siba/siba_core.c
  head/sys/dev/siba/sibareg.h

Modified: head/sys/dev/siba/siba_core.c
==
--- head/sys/dev/siba/siba_core.c   Thu May 19 04:11:00 2016
(r300184)
+++ head/sys/dev/siba/siba_core.c   Thu May 19 04:11:49 2016
(r300185)
@@ -1827,26 +1827,26 @@ siba_sprom_r8(struct siba_sprom *out, co
 
/* FEM */
SIBA_SHIFTOUT(fem.ghz2.tssipos, SIBA_SPROM8_FEM2G,
-   SSB_SROM8_FEM_TSSIPOS);
+   SIBA_SROM8_FEM_TSSIPOS);
SIBA_SHIFTOUT(fem.ghz2.extpa_gain, SIBA_SPROM8_FEM2G,
-   SSB_SROM8_FEM_EXTPA_GAIN);
+   SIBA_SROM8_FEM_EXTPA_GAIN);
SIBA_SHIFTOUT(fem.ghz2.pdet_range, SIBA_SPROM8_FEM2G,
-   SSB_SROM8_FEM_PDET_RANGE);
+   SIBA_SROM8_FEM_PDET_RANGE);
SIBA_SHIFTOUT(fem.ghz2.tr_iso, SIBA_SPROM8_FEM2G,
-   SSB_SROM8_FEM_TR_ISO);
+   SIBA_SROM8_FEM_TR_ISO);
SIBA_SHIFTOUT(fem.ghz2.antswlut, SIBA_SPROM8_FEM2G,
-   SSB_SROM8_FEM_ANTSWLUT);
+   SIBA_SROM8_FEM_ANTSWLUT);
 
SIBA_SHIFTOUT(fem.ghz5.tssipos, SIBA_SPROM8_FEM5G,
-   SSB_SROM8_FEM_TSSIPOS);
+   SIBA_SROM8_FEM_TSSIPOS);
SIBA_SHIFTOUT(fem.ghz5.extpa_gain, SIBA_SPROM8_FEM5G,
-   SSB_SROM8_FEM_EXTPA_GAIN);
+   SIBA_SROM8_FEM_EXTPA_GAIN);
SIBA_SHIFTOUT(fem.ghz5.pdet_range, SIBA_SPROM8_FEM5G,
-   SSB_SROM8_FEM_PDET_RANGE);
+   SIBA_SROM8_FEM_PDET_RANGE);
SIBA_SHIFTOUT(fem.ghz5.tr_iso, SIBA_SPROM8_FEM5G,
-   SSB_SROM8_FEM_TR_ISO);
+   SIBA_SROM8_FEM_TR_ISO);
SIBA_SHIFTOUT(fem.ghz5.antswlut, SIBA_SPROM8_FEM5G,
-   SSB_SROM8_FEM_ANTSWLUT);
+   SIBA_SROM8_FEM_ANTSWLUT);
 
/* Extract cores power info info */
for (i = 0; i < nitems(pwr_info_offset); i++) {

Modified: head/sys/dev/siba/sibareg.h
==
--- head/sys/dev/siba/sibareg.h Thu May 19 04:11:00 2016(r300184)
+++ head/sys/dev/siba/sibareg.h Thu May 19 04:11:49 2016(r300185)
@@ -488,11 +488,11 @@
 /* The FEM blocks share the same structure */
 #defineSIBA_SPROM8_FEM2G   0x10ae
 #defineSIBA_SPROM8_FEM5G   0x10b0
-#define SSB_SROM8_FEM_TSSIPOS  0x0001
-#define SSB_SROM8_FEM_EXTPA_GAIN   0x0006
-#define SSB_SROM8_FEM_PDET_RANGE   0x00F8
-#define SSB_SROM8_FEM_TR_ISO   0x0700
-#define SSB_SROM8_FEM_ANTSWLUT 0xF800
+#define SIBA_SROM8_FEM_TSSIPOS 0x0001
+#define SIBA_SROM8_FEM_EXTPA_GAIN  0x0006
+#define SIBA_SROM8_FEM_PDET_RANGE  0x00F8
+#define SIBA_SROM8_FEM_TR_ISO  0x0700
+#define SIBA_SROM8_FEM_ANTSWLUT0xF800
 
 #defineSIBA_SPROM8_MAXP_BG 0x10c0
 #defineSIBA_SPROM8_MAXP_BG_MASK0x00ff
@@ -520,10 +520,10 @@
 #defineSIBA_SPROM8_OFDM5GPO0x1146
 #defineSIBA_SPROM8_OFDM5GLPO   0x114a
 #defineSIBA_SPROM8_OFDM5GHPO   0x114e
-#defineSIBA_SPROM8_CDDPO   0x1192
-#defineSIBA_SPROM8_STBCPO  0x1194
-#defineSIBA_SPROM8_BW40PO  0x1196
-#defineSIBA_SPROM8_BWDUPPO 0x1198
+#defineSIBA_SPROM8_CDDPO   0x0192
+#defineSIBA_SPROM8_STBCPO  0x0194
+#defineSIBA_SPROM8_BW40PO  0x0196
+#defineSIBA_SPROM8_BWDUPPO 0x0198
 
 /* There are 4 blocks with power info sharing the same layout */
 #defineSIBA_SROM8_PWR_INFO_CORE0   0x10C0
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r300183 - head/sys/dev/siba

2016-05-18 Thread Adrian Chadd
Author: adrian
Date: Thu May 19 04:03:41 2016
New Revision: 300183
URL: https://svnweb.freebsd.org/changeset/base/300183

Log:
  [siba] handle the PMU resource setup/init for 0x4322 series chips.
  
  Tested (with other changes):
  
  * BCM4322 11abgn device, chip id 0x4322.

Modified:
  head/sys/dev/siba/siba_core.c

Modified: head/sys/dev/siba/siba_core.c
==
--- head/sys/dev/siba/siba_core.c   Thu May 19 04:02:13 2016
(r300182)
+++ head/sys/dev/siba/siba_core.c   Thu May 19 04:03:41 2016
(r300183)
@@ -945,6 +945,17 @@ siba_cc_pmu_init(struct siba_cc *scc)
siba_cc_pmu1_pll0_init(scc, 0 /* use default */);
/* use the default: min = 0xcbb max = 0x7 */
break;
+   case 0x4322:
+   if (scc->scc_pmu.rev == 2) {
+   DPRINTF(siba, SIBA_DEBUG_PMU, "%s: chipid 0x4322; 
PLLing\n",
+   __func__);
+   SIBA_CC_WRITE32(scc, SIBA_CC_PLLCTL_ADDR, 0x000a);
+   SIBA_CC_WRITE32(scc, SIBA_CC_PLLCTL_DATA, 0x380005c0);
+   }
+   /* use the default: min = 0xcbb max = 0x7 */
+   break;
+   case 43222:
+   break;
case 0x4325:
siba_cc_pmu1_pll0_init(scc, 0 /* use default */);
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r300182 - head/sys/dev/siba

2016-05-18 Thread Adrian Chadd
Author: adrian
Date: Thu May 19 04:02:13 2016
New Revision: 300182
URL: https://svnweb.freebsd.org/changeset/base/300182

Log:
  [siba] fix up some comments and debug output.

Modified:
  head/sys/dev/siba/siba_core.c

Modified: head/sys/dev/siba/siba_core.c
==
--- head/sys/dev/siba/siba_core.c   Thu May 19 04:01:33 2016
(r300181)
+++ head/sys/dev/siba/siba_core.c   Thu May 19 04:02:13 2016
(r300182)
@@ -335,7 +335,7 @@ siba_scan(struct siba_softc *siba)
sd->sd_coreidx = i;
 
DPRINTF(siba, SIBA_DEBUG_SCAN,
-   "core %d (%s) found (cc %#xrev %#x vendor %#x)\n",
+   "core %d (%s) found (cc %#x rev %#x vendor %#x)\n",
i, siba_core_name(sd->sd_id.sd_device),
sd->sd_id.sd_device, sd->sd_id.sd_rev,
sd->sd_id.sd_vendor);
@@ -430,6 +430,7 @@ siba_pci_switchcore_sub(struct siba_soft
return (0);
DELAY(10);
}
+   DPRINTF(siba, SIBA_DEBUG_SWITCHCORE, "%s: idx %d, failed\n", __func__, 
idx);
return (ENODEV);
 #undef RETRY_MAX
 }
@@ -2184,6 +2185,8 @@ siba_dma_translation(device_t dev)
KASSERT(siba->siba_type == SIBA_TYPE_PCI,
("unsupported bustype %d\n", siba->siba_type));
 #endif
+
+   /* Default */
return (SIBA_PCI_DMA);
 }
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r300181 - head/sys/dev/siba

2016-05-18 Thread Adrian Chadd
Author: adrian
Date: Thu May 19 04:01:33 2016
New Revision: 300181
URL: https://svnweb.freebsd.org/changeset/base/300181

Log:
  [siba] add DMA debugging section, for changes later on to DMA addressing.

Modified:
  head/sys/dev/siba/siba_core.c

Modified: head/sys/dev/siba/siba_core.c
==
--- head/sys/dev/siba/siba_core.c   Thu May 19 03:56:07 2016
(r300180)
+++ head/sys/dev/siba/siba_core.c   Thu May 19 04:01:33 2016
(r300181)
@@ -69,6 +69,7 @@ enum {
SIBA_DEBUG_SWITCHCORE   = 0x0008,   /* switching core */
SIBA_DEBUG_SPROM= 0x0010,   /* SPROM */
SIBA_DEBUG_CORE = 0x0020,   /* handling cores */
+   SIBA_DEBUG_DMA  = 0x0040,   /* DMA bits */
SIBA_DEBUG_ANY  = 0x
 };
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r300180 - head/etc/ntp

2016-05-18 Thread Cy Schubert
Author: cy
Date: Thu May 19 03:56:07 2016
New Revision: 300180
URL: https://svnweb.freebsd.org/changeset/base/300180

Log:
  Update leap-seconds to leap-seconds.3661459200.
  NO leap second will be introduced at the end of June 2016.
  
  This commit reapplies the r298887 minor spelling fix.
  
  Obtained from:ftp://tycho.usno.navy.mil/pub/ntp/.
  See also: http://www.iers.org/SharedDocs/News/EN/BulletinC.html
  MFC after:2 weeks

Modified:
  head/etc/ntp/leap-seconds

Modified: head/etc/ntp/leap-seconds
==
--- head/etc/ntp/leap-seconds   Thu May 19 03:18:54 2016(r300179)
+++ head/etc/ntp/leap-seconds   Thu May 19 03:56:07 2016(r300180)
@@ -130,7 +130,7 @@
 #  Washington, DC
 #  jeffrey.prilla...@usno.navy.mil
 #
-#  Last Update of leap second values:  31 Dec 2015
+#  Last Update of leap second values:  11 Jan 2016
 #
 #  The following line shows this last update date in NTP timestamp 
 #  format. This is the date on which the most recent change to
@@ -138,7 +138,7 @@
 #  be identified by the unique pair of characters in the first two 
 #  columns as shown below.
 #
-#$  3660508800
+#$  3661459200
 #
 #  The data in this file will be updated periodically as new leap 
 #  seconds are announced. In addition to being entered on the line
@@ -170,10 +170,10 @@
 #  current -- the update time stamp, the data and the name of the file 
 #  will not change.
 #
-#  Updated through IERS Bulletin C 50
-#  File expires on:  1 Jun 2016
+#  Updated through IERS Bulletin C 51
+#  File expires on:  1 Dec 2016
 #
-#@ 3673728000
+#@ 3689539200
 #
 2272060800 10  # 1 Jan 1972
 2287785600 11  # 1 Jul 1972
@@ -217,5 +217,5 @@
 #  the hash line is also ignored in the
 #  computation.
 #
-#h 44a44c49 35b22601 a9c7054c 8c56cf57 9b6f6ed5
+#h 63b4df04 0907d94f 2dadb7a1 684f7767 2a372421
 #
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r300177 - head/contrib/ipfilter/man

2016-05-18 Thread Cy Schubert
In message 
, Conrad Meyer writes:
> On Wed, May 18, 2016 at 7:06 PM, Cy Schubert  wrote:
> > Author: cy
> > Date: Thu May 19 02:06:48 2016
> > New Revision: 300177
> > URL: https://svnweb.freebsd.org/changeset/base/300177
> >
> > Log:
> >   Fix typo.
> >
> > Modified: head/contrib/ipfilter/man/ipf.5
> > ===
> ===
> > -pass in proto udp from any prot = 2049 to any with frags keep fags
> > +pass in proto udp from any port = 2049 to any with frags keep fags
>  
> Is that not a typo?

That too. Fixed. Thanks for noticing.


-- 
Cheers,
Cy Schubert  or 
FreeBSD UNIX:     Web:  http://www.FreeBSD.org

The need of the many outweighs the greed of the few.


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


svn commit: r300179 - head/contrib/ipfilter/man

2016-05-18 Thread Cy Schubert
Author: cy
Date: Thu May 19 03:18:54 2016
New Revision: 300179
URL: https://svnweb.freebsd.org/changeset/base/300179

Log:
  Fix another typo.
  
  Reported by:  cem
  MFC after:6 days

Modified:
  head/contrib/ipfilter/man/ipf.5

Modified: head/contrib/ipfilter/man/ipf.5
==
--- head/contrib/ipfilter/man/ipf.5 Thu May 19 02:58:30 2016
(r300178)
+++ head/contrib/ipfilter/man/ipf.5 Thu May 19 03:18:54 2016
(r300179)
@@ -881,7 +881,7 @@ through without needing to explicitly al
 An example of how this is done is as follows:
 .PP
 .nf
-pass in proto udp from any port = 2049 to any with frags keep fags
+pass in proto udp from any port = 2049 to any with frags keep frags
 .fi
 .SH Building a tree of rules
 .PP
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r300178 - head

2016-05-18 Thread Warner Losh
Author: imp
Date: Thu May 19 02:58:30 2016
New Revision: 300178
URL: https://svnweb.freebsd.org/changeset/base/300178

Log:
  Turns out, mipsn32el worked at one point, so add it back in.
  
  Pointed out by: jmallet@

Modified:
  head/Makefile.inc1

Modified: head/Makefile.inc1
==
--- head/Makefile.inc1  Thu May 19 02:06:48 2016(r300177)
+++ head/Makefile.inc1  Thu May 19 02:58:30 2016(r300178)
@@ -224,6 +224,7 @@ KNOWN_ARCHES?=  aarch64/arm64 \
mips \
mipsel/mips \
mips64el/mips \
+   mipsn32el/mips \
mips64/mips \
mipsn32/mips \
powerpc \
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r300177 - head/contrib/ipfilter/man

2016-05-18 Thread Conrad Meyer
On Wed, May 18, 2016 at 7:06 PM, Cy Schubert  wrote:
> Author: cy
> Date: Thu May 19 02:06:48 2016
> New Revision: 300177
> URL: https://svnweb.freebsd.org/changeset/base/300177
>
> Log:
>   Fix typo.
>
> Modified: head/contrib/ipfilter/man/ipf.5
> ==
> -pass in proto udp from any prot = 2049 to any with frags keep fags
> +pass in proto udp from any port = 2049 to any with frags keep fags
 
Is that not a typo?

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


svn commit: r300177 - head/contrib/ipfilter/man

2016-05-18 Thread Cy Schubert
Author: cy
Date: Thu May 19 02:06:48 2016
New Revision: 300177
URL: https://svnweb.freebsd.org/changeset/base/300177

Log:
  Fix typo.
  
  Reported by:  Ruben Kerkhof 
  MFC after:6 days

Modified:
  head/contrib/ipfilter/man/ipf.5

Modified: head/contrib/ipfilter/man/ipf.5
==
--- head/contrib/ipfilter/man/ipf.5 Thu May 19 00:04:58 2016
(r300176)
+++ head/contrib/ipfilter/man/ipf.5 Thu May 19 02:06:48 2016
(r300177)
@@ -881,7 +881,7 @@ through without needing to explicitly al
 An example of how this is done is as follows:
 .PP
 .nf
-pass in proto udp from any prot = 2049 to any with frags keep fags
+pass in proto udp from any port = 2049 to any with frags keep fags
 .fi
 .SH Building a tree of rules
 .PP
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r300174 - head/sbin/dhclient

2016-05-18 Thread Don Lewis
On 18 May, Conrad E. Meyer wrote:
> Author: cem
> Date: Wed May 18 23:41:55 2016
> New Revision: 300174
> URL: https://svnweb.freebsd.org/changeset/base/300174
> 
> Log:
>   dhclient: Fix the trivial buffer overruns correctly
>   
>   A DHCP client identifier is simply the hardware type (one byte) concatenated
>   with the hardware address (some variable number of bytes, but at most 16).
>   Limit the size of the temporary buffer to match and the rest of the
>   calculations shake out correctly.
>   
>   This is a follow-up to the incorrect r299512, reverted in r300172.
>   
>   CIDs:   1008682, 1305550
>   Sponsored by:   EMC / Isilon Storage Division
> 
> Modified:
>   head/sbin/dhclient/dhclient.c
> 
> Modified: head/sbin/dhclient/dhclient.c
> ==
> --- head/sbin/dhclient/dhclient.c Wed May 18 23:39:31 2016
> (r300173)
> +++ head/sbin/dhclient/dhclient.c Wed May 18 23:41:55 2016
> (r300174)
> @@ -1570,7 +1570,7 @@ make_discover(struct interface_info *ip,
>   }
>  
>   /* set unique client identifier */
> - char client_ident[sizeof(struct hardware)];
> + char client_ident[sizeof(ip->hw_address.haddr) + 1];
>   if (!options[DHO_DHCP_CLIENT_IDENTIFIER]) {
>   int hwlen = (ip->hw_address.hlen < sizeof(client_ident)-1) ?
>   ip->hw_address.hlen : sizeof(client_ident)-1;
> 

That might work as well.

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


Re: svn commit: r300113 - in head/sys: conf kern net sys

2016-05-18 Thread K. Macy
Those are new. Please just patch iflib to use them and let's move on.
-M

On Wed, May 18, 2016 at 4:58 PM, Gleb Smirnoff  wrote:
>   Hi!
>
> On Wed, May 18, 2016 at 04:35:58AM +, Scott Long wrote:
> S> 
> ==
> S> --- head/sys/net/if.cWed May 18 04:04:14 2016(r300112)
> S> +++ head/sys/net/if.cWed May 18 04:35:58 2016(r300113)
> S> @@ -3900,6 +3900,19 @@ if_multiaddr_count(if_t ifp, int max)
> S>  return (count);
> S>  }
> S>
> S> +int
> S> +if_multi_apply(struct ifnet *ifp, int (*filter)(void *, struct 
> ifmultiaddr *, int), void *arg)
> S> +{
> S> +struct ifmultiaddr *ifma;
> S> +int cnt = 0;
> S> +
> S> +if_maddr_rlock(ifp);
> S> +TAILQ_FOREACH(ifma, >if_multiaddrs, ifma_link)
> S> +cnt += filter(arg, ifma, cnt);
> S> +if_maddr_runlock(ifp);
> S> +return (cnt);
> S> +}
> S> +
> S>  struct mbuf *
> S>  if_dequeue(if_t ifp)
> S>  {
>
> In my projects/ifnet a similar functions exist:
>
> /*
>  * Traversing through interface address lists.
>  */
> typedef voidifaddr_cb_t(void *, struct sockaddr *, struct sockaddr *,
> struct sockaddr *);
> typedef voidifmaddr_cb_t(void *, struct sockaddr *);
> voidif_foreach_addr(if_t, ifaddr_cb_t, void *);
> voidif_foreach_maddr(if_t, ifmaddr_cb_t, void *);
>
> /*
>  * Methods for drivers to access interface unicast and multicast
>  * addresses.  Driver do not know 'struct ifaddr' neither 'struct 
> ifmultiaddr'.
>  */
> void
> if_foreach_addr(if_t ifp, ifaddr_cb_t cb, void *cb_arg)
> {
> struct ifaddr *ifa;
>
> IF_ADDR_RLOCK(ifp);
> TAILQ_FOREACH(ifa, >if_addrhead, ifa_link)
> (*cb)(cb_arg, ifa->ifa_addr, ifa->ifa_dstaddr,
> ifa->ifa_netmask);
> IF_ADDR_RUNLOCK(ifp);
> }
>
> void
> if_foreach_maddr(if_t ifp, ifmaddr_cb_t cb, void *cb_arg)
> {
> struct ifmultiaddr *ifma;
>
> IF_ADDR_RLOCK(ifp);
> TAILQ_FOREACH(ifma, >if_multiaddrs, ifma_link)
> (*cb)(cb_arg, ifma->ifma_addr);
> IF_ADDR_RUNLOCK(ifp);
> }
>
> Do you mind if I adopt head to them instead of if_multi_apply()?
>
> --
> Totus tuus, Glebius.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r300176 - head/sys/dev/tsec

2016-05-18 Thread Justin Hibbits
Author: jhibbits
Date: Thu May 19 00:04:58 2016
New Revision: 300176
URL: https://svnweb.freebsd.org/changeset/base/300176

Log:
  Add an alternate compatible string for eTSEC devices.
  
  Newer device trees now use fsl,etsec2 to denote eTSEC nodes.  Same device, new
  name.

Modified:
  head/sys/dev/tsec/if_tsec_fdt.c

Modified: head/sys/dev/tsec/if_tsec_fdt.c
==
--- head/sys/dev/tsec/if_tsec_fdt.c Wed May 18 23:41:58 2016
(r300175)
+++ head/sys/dev/tsec/if_tsec_fdt.c Thu May 19 00:04:58 2016
(r300176)
@@ -115,7 +115,8 @@ tsec_fdt_probe(device_t dev)
strcmp(ofw_bus_get_type(dev), "network") != 0)
return (ENXIO);
 
-   if (!ofw_bus_is_compatible(dev, "gianfar"))
+   if (!ofw_bus_is_compatible(dev, "gianfar") &&
+   !ofw_bus_is_compatible(dev, "fsl,etsec2"))
return (ENXIO);
 
sc = device_get_softc(dev);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r300167 - in head: contrib/bsnmp/snmpd usr.sbin/bsnmpd/bsnmpd

2016-05-18 Thread Chris Torek
>I don't know much about CMSG*, so I wouldn't have if you didn't ask :-).

One thing to know about the CMSG (control message) stuff is that
it is badly broken, at least on I32LP64 systems.  Not the CMSG_*
aligning macros themselves (the alignment is linked to stuff I did
back in the early sparc-port days, around 1992 or so), but
internally, when file descriptor rights are internalized before
sending.  This converts them from 32 bit "int"s to 64 bit
pointers, which winds up breaking other code.

See https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=181741
(I attached a revised set of patches that apply to current kernels,
adding a rewrite of the transform code for sanity / readability.)

>... So void * works better in all cases in the kernel.

If someone wanted to change CMSG_DATA, CMSG_FIRSTHDR, and
CMSG_NEXTHDR to produce "void *", I'd vote in favor of that. :-)

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


Re: svn commit: r300167 - in head: contrib/bsnmp/snmpd usr.sbin/bsnmpd/bsnmpd

2016-05-18 Thread Ian Lepore
On Thu, 2016-05-19 at 09:43 +1000, Bruce Evans wrote:
> On Wed, 18 May 2016, Ian Lepore wrote:
> 
> > On Wed, 2016-05-18 at 22:02 +, Gleb Smirnoff wrote:
> >> Log:
> >>   Revert r299830, it has couple of fatal errors.
> >>
> >>   The CMSG_ family of macros take care of alignment, so we don't
> need
> >> r299830
> >>   at all, even if it was correct.  Put NO_WCAST_ALIGN into
> Makefile.
> 
> The breaks detection of cast-align bugs elsewhere in the program.
> 
> > So all of this was about a "cast increases required alignment" kind
> of
> > warning for a macro that takes care of alignment?  Wouldn't the
> proper
> > fix then be to change CMSG_DATA() so that its internal cast is
> void*
> > instead of unsigned char* (he asked, knowing Bruce would come along
> > soon and point out why that's a dumb question)?
> 
> I don't know much about CMSG*, so I wouldn't have if you didn't ask :
> -).
> 
> Changing its type might expose bugs.  Kernel code mostly casts it so
> would get the same cast-align error if that were enabled in the
> kernel.
> netinet6 passes it to a function without an explicit cast.  The
> function
> does an implicit conversion to a struct pointer and there should be a
> different warning for that.  char * and u_char * are required to be
> binary compatible with void *, but it is bad style to depend on that.
> 
> So void * works better in all cases in the kernel.
> 
> LINUX_CMSG_DATA() already returns void *.
> 
> Bruce
> 

For some reason I had assumed a (void*) cast would wish away the
warning about increasing alignment (without losing that warning at
other places in that code).  Now I can't say for sure why I thought
that would be so, but it does seem to me I've fixed warnings like that
by casting through void* as an intermediate type.  But maybe that was a
different situation/different warning.

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


Re: svn commit: r300113 - in head/sys: conf kern net sys

2016-05-18 Thread Gleb Smirnoff
  Hi!

On Wed, May 18, 2016 at 04:35:58AM +, Scott Long wrote:
S> 
==
S> --- head/sys/net/if.cWed May 18 04:04:14 2016(r300112)
S> +++ head/sys/net/if.cWed May 18 04:35:58 2016(r300113)
S> @@ -3900,6 +3900,19 @@ if_multiaddr_count(if_t ifp, int max)
S>  return (count);
S>  }
S>  
S> +int
S> +if_multi_apply(struct ifnet *ifp, int (*filter)(void *, struct ifmultiaddr 
*, int), void *arg)
S> +{
S> +struct ifmultiaddr *ifma;
S> +int cnt = 0;
S> +
S> +if_maddr_rlock(ifp);
S> +TAILQ_FOREACH(ifma, >if_multiaddrs, ifma_link)
S> +cnt += filter(arg, ifma, cnt);
S> +if_maddr_runlock(ifp);
S> +return (cnt);
S> +}
S> +
S>  struct mbuf *
S>  if_dequeue(if_t ifp)
S>  {

In my projects/ifnet a similar functions exist:

/*
 * Traversing through interface address lists.
 */
typedef voidifaddr_cb_t(void *, struct sockaddr *, struct sockaddr *,
struct sockaddr *);
typedef voidifmaddr_cb_t(void *, struct sockaddr *);
voidif_foreach_addr(if_t, ifaddr_cb_t, void *);
voidif_foreach_maddr(if_t, ifmaddr_cb_t, void *);

/*
 * Methods for drivers to access interface unicast and multicast
 * addresses.  Driver do not know 'struct ifaddr' neither 'struct ifmultiaddr'.
 */
void
if_foreach_addr(if_t ifp, ifaddr_cb_t cb, void *cb_arg)
{
struct ifaddr *ifa;

IF_ADDR_RLOCK(ifp);
TAILQ_FOREACH(ifa, >if_addrhead, ifa_link)
(*cb)(cb_arg, ifa->ifa_addr, ifa->ifa_dstaddr,
ifa->ifa_netmask);
IF_ADDR_RUNLOCK(ifp);
}

void
if_foreach_maddr(if_t ifp, ifmaddr_cb_t cb, void *cb_arg)
{
struct ifmultiaddr *ifma;

IF_ADDR_RLOCK(ifp);
TAILQ_FOREACH(ifma, >if_multiaddrs, ifma_link)
(*cb)(cb_arg, ifma->ifma_addr);
IF_ADDR_RUNLOCK(ifp);
}

Do you mind if I adopt head to them instead of if_multi_apply()?

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


Re: svn commit: r300167 - in head: contrib/bsnmp/snmpd usr.sbin/bsnmpd/bsnmpd

2016-05-18 Thread Bruce Evans

On Wed, 18 May 2016, Ian Lepore wrote:


On Wed, 2016-05-18 at 22:02 +, Gleb Smirnoff wrote:

Log:
  Revert r299830, it has couple of fatal errors.

  The CMSG_ family of macros take care of alignment, so we don't need
r299830
  at all, even if it was correct.  Put NO_WCAST_ALIGN into Makefile.


The breaks detection of cast-align bugs elsewhere in the program.


So all of this was about a "cast increases required alignment" kind of
warning for a macro that takes care of alignment?  Wouldn't the proper
fix then be to change CMSG_DATA() so that its internal cast is void*
instead of unsigned char* (he asked, knowing Bruce would come along
soon and point out why that's a dumb question)?


I don't know much about CMSG*, so I wouldn't have if you didn't ask :-).

Changing its type might expose bugs.  Kernel code mostly casts it so
would get the same cast-align error if that were enabled in the kernel.
netinet6 passes it to a function without an explicit cast.  The function
does an implicit conversion to a struct pointer and there should be a
different warning for that.  char * and u_char * are required to be
binary compatible with void *, but it is bad style to depend on that.

So void * works better in all cases in the kernel.

LINUX_CMSG_DATA() already returns void *.

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


svn commit: r300175 - head/sys/arm/amlogic/aml8726

2016-05-18 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Wed May 18 23:41:58 2016
New Revision: 300175
URL: https://svnweb.freebsd.org/changeset/base/300175

Log:
  Use OF_prop_free instead of direct call to free(9)
  
  Reviewed by:  ganbold

Modified:
  head/sys/arm/amlogic/aml8726/aml8726_ccm.c
  head/sys/arm/amlogic/aml8726/aml8726_mmc.c
  head/sys/arm/amlogic/aml8726/aml8726_pinctrl.c
  head/sys/arm/amlogic/aml8726/aml8726_sdxc-m8.c
  head/sys/arm/amlogic/aml8726/aml8726_usb_phy-m3.c
  head/sys/arm/amlogic/aml8726/aml8726_usb_phy-m6.c

Modified: head/sys/arm/amlogic/aml8726/aml8726_ccm.c
==
--- head/sys/arm/amlogic/aml8726/aml8726_ccm.c  Wed May 18 23:41:55 2016
(r300174)
+++ head/sys/arm/amlogic/aml8726/aml8726_ccm.c  Wed May 18 23:41:58 2016
(r300175)
@@ -141,7 +141,7 @@ aml8726_ccm_configure_gates(struct aml87
AML_CCM_UNLOCK(sc);
}
 
-   free(functions, M_OFWPROP);
+   OF_prop_free(functions);
 
return (0);
 }

Modified: head/sys/arm/amlogic/aml8726/aml8726_mmc.c
==
--- head/sys/arm/amlogic/aml8726/aml8726_mmc.c  Wed May 18 23:41:55 2016
(r300174)
+++ head/sys/arm/amlogic/aml8726/aml8726_mmc.c  Wed May 18 23:41:58 2016
(r300175)
@@ -605,11 +605,11 @@ aml8726_mmc_attach(device_t dev)
else {
device_printf(dev, "unknown function attribute %.*s in FDT\n",
len, function_name);
-   free(function_name, M_OFWPROP);
+   OF_prop_free(function_name);
return (ENXIO);
}
 
-   free(function_name, M_OFWPROP);
+   OF_prop_free(function_name);
 
sc->pwr_en.dev = NULL;
 
@@ -661,7 +661,7 @@ aml8726_mmc_attach(device_t dev)
device_printf(dev,
"unknown voltage attribute %.*s in FDT\n",
len, voltage);
-   free(voltages, M_OFWPROP);
+   OF_prop_free(voltages);
return (ENXIO);
}
 
@@ -678,7 +678,7 @@ aml8726_mmc_attach(device_t dev)
}
}
 
-   free(voltages, M_OFWPROP);
+   OF_prop_free(voltages);
 
sc->vselect.dev = NULL;
 

Modified: head/sys/arm/amlogic/aml8726/aml8726_pinctrl.c
==
--- head/sys/arm/amlogic/aml8726/aml8726_pinctrl.c  Wed May 18 23:41:55 
2016(r300174)
+++ head/sys/arm/amlogic/aml8726/aml8726_pinctrl.c  Wed May 18 23:41:58 
2016(r300175)
@@ -210,11 +210,11 @@ aml8726_pinctrl_configure_pins(device_t 
if (f->name == NULL) {
device_printf(dev, "unknown function attribute %.*s in FDT\n",
len, function_name);
-   free(function_name, M_OFWPROP);
+   OF_prop_free(function_name);
return (ENXIO);
}
 
-   free(function_name, M_OFWPROP);
+   OF_prop_free(function_name);
 
len = OF_getprop_alloc(node, "amlogic,pull",
sizeof(char), (void **));
@@ -234,12 +234,12 @@ aml8726_pinctrl_configure_pins(device_t 
device_printf(dev,
"unknown pull attribute %.*s in FDT\n",
len, pull);
-   free(pull, M_OFWPROP);
+   OF_prop_free(pull);
return (ENXIO);
}
}
 
-   free(pull, M_OFWPROP);
+   OF_prop_free(pull);
 
/*
 * Setting the pull direction isn't supported on all SoC.
@@ -403,7 +403,7 @@ aml8726_pinctrl_configure_pins(device_t 
AML_PINCTRL_UNLOCK(sc);
}
 
-   free(pins, M_OFWPROP);
+   OF_prop_free(pins);
 
return (0);
 }

Modified: head/sys/arm/amlogic/aml8726/aml8726_sdxc-m8.c
==
--- head/sys/arm/amlogic/aml8726/aml8726_sdxc-m8.c  Wed May 18 23:41:55 
2016(r300174)
+++ head/sys/arm/amlogic/aml8726/aml8726_sdxc-m8.c  Wed May 18 23:41:58 
2016(r300175)
@@ -821,7 +821,7 @@ aml8726_sdxc_attach(device_t dev)
device_printf(dev,
"unknown voltage attribute %.*s in FDT\n",
len, voltage);
-   free(voltages, M_OFWPROP);
+   OF_prop_free(voltages);
return (ENXIO);
}
 
@@ -838,7 +838,7 @@ aml8726_sdxc_attach(device_t dev)
}
}
 
-   free(voltages, M_OFWPROP);
+   OF_prop_free(voltages);
 
sc->vselect.dev = NULL;
 

Modified: head/sys/arm/amlogic/aml8726/aml8726_usb_phy-m3.c
==
--- head/sys/arm/amlogic/aml8726/aml8726_usb_phy-m3.c   Wed May 

svn commit: r300174 - head/sbin/dhclient

2016-05-18 Thread Conrad E. Meyer
Author: cem
Date: Wed May 18 23:41:55 2016
New Revision: 300174
URL: https://svnweb.freebsd.org/changeset/base/300174

Log:
  dhclient: Fix the trivial buffer overruns correctly
  
  A DHCP client identifier is simply the hardware type (one byte) concatenated
  with the hardware address (some variable number of bytes, but at most 16).
  Limit the size of the temporary buffer to match and the rest of the
  calculations shake out correctly.
  
  This is a follow-up to the incorrect r299512, reverted in r300172.
  
  CIDs: 1008682, 1305550
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/sbin/dhclient/dhclient.c

Modified: head/sbin/dhclient/dhclient.c
==
--- head/sbin/dhclient/dhclient.c   Wed May 18 23:39:31 2016
(r300173)
+++ head/sbin/dhclient/dhclient.c   Wed May 18 23:41:55 2016
(r300174)
@@ -1570,7 +1570,7 @@ make_discover(struct interface_info *ip,
}
 
/* set unique client identifier */
-   char client_ident[sizeof(struct hardware)];
+   char client_ident[sizeof(ip->hw_address.haddr) + 1];
if (!options[DHO_DHCP_CLIENT_IDENTIFIER]) {
int hwlen = (ip->hw_address.hlen < sizeof(client_ident)-1) ?
ip->hw_address.hlen : sizeof(client_ident)-1;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r300173 - in head/sys: dev/atkbdc dev/le sparc64/central sparc64/ebus sparc64/fhc sparc64/isa sparc64/pci sparc64/sbus sparc64/sparc64

2016-05-18 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Wed May 18 23:39:31 2016
New Revision: 300173
URL: https://svnweb.freebsd.org/changeset/base/300173

Log:
  Use OF_prop_free instead of direct call to free(9)
  
  Reviewed by:  marius

Modified:
  head/sys/dev/atkbdc/atkbdc_ebus.c
  head/sys/dev/le/lebuffer_sbus.c
  head/sys/sparc64/central/central.c
  head/sys/sparc64/ebus/ebus.c
  head/sys/sparc64/fhc/fhc.c
  head/sys/sparc64/isa/isa.c
  head/sys/sparc64/pci/ofw_pci.c
  head/sys/sparc64/sbus/dma_sbus.c
  head/sys/sparc64/sbus/sbus.c
  head/sys/sparc64/sparc64/nexus.c
  head/sys/sparc64/sparc64/upa.c

Modified: head/sys/dev/atkbdc/atkbdc_ebus.c
==
--- head/sys/dev/atkbdc/atkbdc_ebus.c   Wed May 18 23:35:37 2016
(r300172)
+++ head/sys/dev/atkbdc/atkbdc_ebus.c   Wed May 18 23:39:31 2016
(r300173)
@@ -242,14 +242,14 @@ atkbdc_ebus_attach(device_t dev)
device_printf(dev,
"<%s>: only two children per 8042 supported\n",
cname);
-   free(cname, M_OFWPROP);
+   OF_prop_free(cname);
continue;
}
adi = malloc(sizeof(struct atkbdc_device), M_ATKBDDEV,
M_NOWAIT | M_ZERO);
if (adi == NULL) {
device_printf(dev, "<%s>: malloc failed\n", cname);
-   free(cname, M_OFWPROP);
+   OF_prop_free(cname);
continue;
}
if (strcmp(cname, "kb_ps2") == 0) {
@@ -261,7 +261,7 @@ atkbdc_ebus_attach(device_t dev)
} else {
device_printf(dev, "<%s>: unknown device\n", cname);
free(adi, M_ATKBDDEV);
-   free(cname, M_OFWPROP);
+   OF_prop_free(cname);
continue;
}
intr = bus_get_resource_start(dev, SYS_RES_IRQ, adi->rid);
@@ -270,7 +270,7 @@ atkbdc_ebus_attach(device_t dev)
"<%s>: cannot determine interrupt resource\n",
cname);
free(adi, M_ATKBDDEV);
-   free(cname, M_OFWPROP);
+   OF_prop_free(cname);
continue;
}
resource_list_init(>resources);
@@ -281,7 +281,7 @@ atkbdc_ebus_attach(device_t dev)
cname);
resource_list_free(>resources);
free(adi, M_ATKBDDEV);
-   free(cname, M_OFWPROP);
+   OF_prop_free(cname);
continue;
}
device_set_ivars(cdev, adi);

Modified: head/sys/dev/le/lebuffer_sbus.c
==
--- head/sys/dev/le/lebuffer_sbus.c Wed May 18 23:35:37 2016
(r300172)
+++ head/sys/dev/le/lebuffer_sbus.c Wed May 18 23:39:31 2016
(r300173)
@@ -197,7 +197,7 @@ lebuffer_setup_dinfo(device_t dev, phand
if (slot != -1 && slot != rslot) {
device_printf(dev, "<%s>: multiple slots\n",
ldi->ldi_obdinfo.obd_name);
-   free(reg, M_OFWPROP);
+   OF_prop_free(reg);
goto fail;
}
slot = rslot;
@@ -205,7 +205,7 @@ lebuffer_setup_dinfo(device_t dev, phand
resource_list_add(>ldi_rl, SYS_RES_MEMORY, i, base,
base + reg[i].sbr_size, reg[i].sbr_size);
}
-   free(reg, M_OFWPROP);
+   OF_prop_free(reg);
if (slot != sbus_get_slot(dev)) {
device_printf(dev, "<%s>: parent and child slot do not match\n",
ldi->ldi_obdinfo.obd_name);
@@ -231,7 +231,7 @@ lebuffer_setup_dinfo(device_t dev, phand
resource_list_add(>ldi_rl, SYS_RES_IRQ, i,
iv, iv, 1);
}
-   free(intr, M_OFWPROP);
+   OF_prop_free(intr);
}
return (ldi);
 

Modified: head/sys/sparc64/central/central.c
==
--- head/sys/sparc64/central/central.c  Wed May 18 23:35:37 2016
(r300172)
+++ head/sys/sparc64/central/central.c  Wed May 18 23:39:31 2016
(r300173)
@@ -165,7 +165,7 @@ central_attach(device_t dev)
resource_list_add(>cdi_rl, SYS_RES_MEMORY, i,
reg[i].sbr_offset, reg[i].sbr_offset +
reg[i].sbr_size, reg[i].sbr_size);
-   free(reg, M_OFWPROP);
+   OF_prop_free(reg);
cdev = device_add_child(dev, NULL, -1);
if (cdev == NULL) {
  

svn commit: r300172 - head/sbin/dhclient

2016-05-18 Thread Conrad E. Meyer
Author: cem
Date: Wed May 18 23:35:37 2016
New Revision: 300172
URL: https://svnweb.freebsd.org/changeset/base/300172

Log:
  Revert r299512
  
  It broke client identifiers because I misunderstood the intent of the code.
  There is still a minor issue detected by Coverity (at least, I can't find 
where
  the code proves it isn't an issue).  I'll follow up with a better fix for the
  CIDs.
  
  Reported by:  Ian FREISLICH
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/sbin/dhclient/dhclient.c

Modified: head/sbin/dhclient/dhclient.c
==
--- head/sbin/dhclient/dhclient.c   Wed May 18 22:50:25 2016
(r300171)
+++ head/sbin/dhclient/dhclient.c   Wed May 18 23:35:37 2016
(r300172)
@@ -56,8 +56,6 @@
 #include 
 __FBSDID("$FreeBSD$");
 
-#include 
-
 #include "dhcpd.h"
 #include "privsep.h"
 
@@ -1572,18 +1570,16 @@ make_discover(struct interface_info *ip,
}
 
/* set unique client identifier */
-   struct hardware client_ident;
+   char client_ident[sizeof(struct hardware)];
if (!options[DHO_DHCP_CLIENT_IDENTIFIER]) {
-   size_t hwlen = MIN(ip->hw_address.hlen,
-   sizeof(client_ident.haddr));
-   client_ident.htype = ip->hw_address.htype;
-   client_ident.hlen = hwlen;
-   memcpy(client_ident.haddr, ip->hw_address.haddr, hwlen);
+   int hwlen = (ip->hw_address.hlen < sizeof(client_ident)-1) ?
+   ip->hw_address.hlen : sizeof(client_ident)-1;
+   client_ident[0] = ip->hw_address.htype;
+   memcpy(_ident[1], ip->hw_address.haddr, hwlen);
options[DHO_DHCP_CLIENT_IDENTIFIER] = 
_elements[DHO_DHCP_CLIENT_IDENTIFIER];
-   options[DHO_DHCP_CLIENT_IDENTIFIER]->value = (void 
*)_ident;
-   hwlen += offsetof(struct hardware, haddr);
-   options[DHO_DHCP_CLIENT_IDENTIFIER]->len = hwlen;
-   options[DHO_DHCP_CLIENT_IDENTIFIER]->buf_size = hwlen;
+   options[DHO_DHCP_CLIENT_IDENTIFIER]->value = client_ident;
+   options[DHO_DHCP_CLIENT_IDENTIFIER]->len = hwlen+1;
+   options[DHO_DHCP_CLIENT_IDENTIFIER]->buf_size = hwlen+1;
options[DHO_DHCP_CLIENT_IDENTIFIER]->timeout = 0x;
}
 
@@ -1609,8 +1605,8 @@ make_discover(struct interface_info *ip,
0, sizeof(ip->client->packet.siaddr));
memset(&(ip->client->packet.giaddr),
0, sizeof(ip->client->packet.giaddr));
-   memcpy(ip->client->packet.chaddr, ip->hw_address.haddr,
-   MIN(ip->hw_address.hlen, sizeof(ip->client->packet.chaddr)));
+   memcpy(ip->client->packet.chaddr,
+   ip->hw_address.haddr, ip->hw_address.hlen);
 }
 
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r300167 - in head: contrib/bsnmp/snmpd usr.sbin/bsnmpd/bsnmpd

2016-05-18 Thread Ngie Cooper (yaneurabeya)

> On May 18, 2016, at 15:02, Gleb Smirnoff  wrote:
> 
> Author: glebius
> Date: Wed May 18 22:02:19 2016
> New Revision: 300167
> URL: https://svnweb.freebsd.org/changeset/base/300167
> 
> Log:
>  Revert r299830, it has couple of fatal errors.
> 
>  The CMSG_ family of macros take care of alignment, so we don't need r299830
>  at all, even if it was correct.  Put NO_WCAST_ALIGN into Makefile.
> 
>  Together with:   peter

Thank you :(..
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r300171 - head

2016-05-18 Thread Warner Losh
Author: imp
Date: Wed May 18 22:50:25 2016
New Revision: 300171
URL: https://svnweb.freebsd.org/changeset/base/300171

Log:
  Fix negative logic error. We want gnueabihf ABI when we're NOT
  requesting soft float ABI.
  
  Noticed by: bdrewery

Modified:
  head/Makefile.inc1

Modified: head/Makefile.inc1
==
--- head/Makefile.inc1  Wed May 18 22:24:52 2016(r300170)
+++ head/Makefile.inc1  Wed May 18 22:50:25 2016(r300171)
@@ -459,7 +459,7 @@ BFLAGS+=-B${CROSS_BINUTILS_PREFIX}
 BFLAGS+=   -B${WORLDTMP}/usr/bin
 .endif
 .if ${TARGET} == "arm"
-.if ${TARGET_ARCH:Marmv6*} != "" && ${TARGET_CPUTYPE:M*soft*} != ""
+.if ${TARGET_ARCH:Marmv6*} != "" && ${TARGET_CPUTYPE:M*soft*} == ""
 TARGET_ABI=gnueabihf
 .else
 TARGET_ABI=gnueabi
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r300170 - head/usr.sbin/makefs

2016-05-18 Thread Simon J. Gerraty
Author: sjg
Date: Wed May 18 22:24:52 2016
New Revision: 300170
URL: https://svnweb.freebsd.org/changeset/base/300170

Log:
  Initialize date of rootNode.
  
  Reviewed by:  jtl

Modified:
  head/usr.sbin/makefs/cd9660.c

Modified: head/usr.sbin/makefs/cd9660.c
==
--- head/usr.sbin/makefs/cd9660.c   Wed May 18 22:23:20 2016
(r300169)
+++ head/usr.sbin/makefs/cd9660.c   Wed May 18 22:24:52 2016
(r300170)
@@ -685,6 +685,9 @@ cd9660_finalize_PVD(void)
cd9660_time_8426(
(unsigned char *)diskStructure.primaryDescriptor.effective_date,
tim);
+   /* make this sane */
+   cd9660_time_915(diskStructure.rootNode->dot_record->isoDirRecord->date,
+   tim);
 }
 
 static void
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r300169 - head/sys/fs/fuse

2016-05-18 Thread Rick Macklem
Author: rmacklem
Date: Wed May 18 22:23:20 2016
New Revision: 300169
URL: https://svnweb.freebsd.org/changeset/base/300169

Log:
  If a local (AF_LOCAL, AF_UNIX) socket creation (bind) is attempted
  on a fuse mounted file system, it will crash. Although it may be
  possible to make this work correctly, this patch avoids the crash
  in the meantime.
  I removed the MPASS(), since panicing for the FIFO case didn't make
  a lot of sense when it returns an error for the others.
  
  PR:   195000
  Submitted by: henry.hu...@gmail.com (earlier version)
  MFC after:2 weeks

Modified:
  head/sys/fs/fuse/fuse_vnops.c

Modified: head/sys/fs/fuse/fuse_vnops.c
==
--- head/sys/fs/fuse/fuse_vnops.c   Wed May 18 22:05:50 2016
(r300168)
+++ head/sys/fs/fuse/fuse_vnops.c   Wed May 18 22:23:20 2016
(r300169)
@@ -335,8 +335,9 @@ fuse_vnop_create(struct vop_create_args 
 
/* XXX: Will we ever want devices ? */
if ((vap->va_type != VREG)) {
-   MPASS(vap->va_type != VFIFO);
-   goto bringup;
+   printf("fuse_vnop_create: unsupported va_type %d\n",
+   vap->va_type);
+   return (EINVAL);
}
debug_printf("parent nid = %ju, mode = %x\n", (uintmax_t)parentnid,
mode);
@@ -364,7 +365,7 @@ fuse_vnop_create(struct vop_create_args 
debug_printf("create: got err=%d from daemon\n", err);
goto out;
}
-bringup:
+
feo = fdip->answ;
 
if ((err = fuse_internal_checkentry(feo, VREG))) {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r300167 - in head: contrib/bsnmp/snmpd usr.sbin/bsnmpd/bsnmpd

2016-05-18 Thread Ian Lepore
On Wed, 2016-05-18 at 22:02 +, Gleb Smirnoff wrote:
> Author: glebius
> Date: Wed May 18 22:02:19 2016
> New Revision: 300167
> URL: https://svnweb.freebsd.org/changeset/base/300167
> 
> Log:
>   Revert r299830, it has couple of fatal errors.
>   
>   The CMSG_ family of macros take care of alignment, so we don't need
> r299830
>   at all, even if it was correct.  Put NO_WCAST_ALIGN into Makefile.
>   

So all of this was about a "cast increases required alignment" kind of
warning for a macro that takes care of alignment?  Wouldn't the proper
fix then be to change CMSG_DATA() so that its internal cast is void*
instead of unsigned char* (he asked, knowing Bruce would come along
soon and point out why that's a dumb question)?

-- Ian

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


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

2016-05-18 Thread Gleb Smirnoff
Author: glebius
Date: Wed May 18 22:05:50 2016
New Revision: 300168
URL: https://svnweb.freebsd.org/changeset/base/300168

Log:
  The SA-16:19 wouldn't have happened if the sockargs() had properly typed
  argument for length.  While here make it static and convert to ANSI C.
  
  Reviewed by:  C Turt

Modified:
  head/sys/kern/uipc_syscalls.c
  head/sys/sys/socketvar.h

Modified: head/sys/kern/uipc_syscalls.c
==
--- head/sys/kern/uipc_syscalls.c   Wed May 18 22:02:19 2016
(r300167)
+++ head/sys/kern/uipc_syscalls.c   Wed May 18 22:05:50 2016
(r300168)
@@ -84,6 +84,7 @@ static int getsockname1(struct thread *t
int compat);
 static int getpeername1(struct thread *td, struct getpeername_args *uap,
int compat);
+static int sockargs(struct mbuf **, char *, socklen_t, int);
 
 /*
  * Convert a user file descriptor to a kernel file entry and check if required
@@ -1689,19 +1690,13 @@ ogetpeername(td, uap)
 }
 #endif /* COMPAT_OLDSOCK */
 
-int
-sockargs(mp, buf, buflen, type)
-   struct mbuf **mp;
-   caddr_t buf;
-   int buflen, type;
+static int
+sockargs(struct mbuf **mp, char *buf, socklen_t buflen, int type)
 {
struct sockaddr *sa;
struct mbuf *m;
int error;
 
-   if (buflen < 0)
-   return (EINVAL);
-
if (buflen > MLEN) {
 #ifdef COMPAT_OLDSOCK
if (type == MT_SONAME && buflen <= 112)
@@ -1713,7 +1708,7 @@ sockargs(mp, buf, buflen, type)
}
m = m_get2(buflen, M_WAITOK, type, 0);
m->m_len = buflen;
-   error = copyin(buf, mtod(m, caddr_t), (u_int)buflen);
+   error = copyin(buf, mtod(m, void *), buflen);
if (error != 0)
(void) m_free(m);
else {

Modified: head/sys/sys/socketvar.h
==
--- head/sys/sys/socketvar.hWed May 18 22:02:19 2016(r300167)
+++ head/sys/sys/socketvar.hWed May 18 22:05:50 2016(r300168)
@@ -335,7 +335,6 @@ struct uio;
 /*
  * From uipc_socket and friends
  */
-intsockargs(struct mbuf **mp, caddr_t buf, int buflen, int type);
 intgetsockaddr(struct sockaddr **namp, caddr_t uaddr, size_t len);
 intgetsock_cap(struct thread *td, int fd, cap_rights_t *rightsp,
struct file **fpp, u_int *fflagp);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r300167 - in head: contrib/bsnmp/snmpd usr.sbin/bsnmpd/bsnmpd

2016-05-18 Thread Gleb Smirnoff
Author: glebius
Date: Wed May 18 22:02:19 2016
New Revision: 300167
URL: https://svnweb.freebsd.org/changeset/base/300167

Log:
  Revert r299830, it has couple of fatal errors.
  
  The CMSG_ family of macros take care of alignment, so we don't need r299830
  at all, even if it was correct.  Put NO_WCAST_ALIGN into Makefile.
  
  Together with:peter

Modified:
  head/contrib/bsnmp/snmpd/main.c
  head/usr.sbin/bsnmpd/bsnmpd/Makefile

Modified: head/contrib/bsnmp/snmpd/main.c
==
--- head/contrib/bsnmp/snmpd/main.c Wed May 18 20:55:04 2016
(r300166)
+++ head/contrib/bsnmp/snmpd/main.c Wed May 18 22:02:19 2016
(r300167)
@@ -1169,7 +1169,7 @@ recv_dgram(struct port_input *pi, struct
memcpy(laddr, CMSG_DATA(cmsg), sizeof(struct in_addr));
if (cmsg->cmsg_level == SOL_SOCKET &&
cmsg->cmsg_type == SCM_CREDS)
-   memcpy(cred, CMSG_DATA(cmsg), sizeof(struct sockcred));
+   cred = (struct sockcred *)CMSG_DATA(cmsg);
}
 
if (pi->cred)
@@ -1207,7 +1207,7 @@ snmpd_input(struct port_input *pi, struc
 
ret = recv_stream(pi);
} else {
-   struct in_addr laddr;
+   struct in_addr *laddr;
 
memset(cbuf, 0, CMSG_SPACE(sizeof(struct in_addr)));
msg.msg_control = cbuf;
@@ -1216,11 +1216,11 @@ snmpd_input(struct port_input *pi, struc
cmsgp->cmsg_len = CMSG_LEN(sizeof(struct in_addr));
cmsgp->cmsg_level = IPPROTO_IP;
cmsgp->cmsg_type = IP_SENDSRCADDR;
-   memcpy(, CMSG_DATA(cmsgp), sizeof(struct in_addr));
+   laddr = (struct in_addr *)CMSG_DATA(cmsgp);

-   ret = recv_dgram(pi, );
+   ret = recv_dgram(pi, laddr);
 
-   if (laddr.s_addr == 0) {
+   if (laddr->s_addr == 0) {
msg.msg_control = NULL;
msg.msg_controllen = 0;
}

Modified: head/usr.sbin/bsnmpd/bsnmpd/Makefile
==
--- head/usr.sbin/bsnmpd/bsnmpd/MakefileWed May 18 20:55:04 2016
(r300166)
+++ head/usr.sbin/bsnmpd/bsnmpd/MakefileWed May 18 22:02:19 2016
(r300167)
@@ -47,6 +47,7 @@ MANFILTER=sed -e 's%@MODPATH@%${LIBDIR}
-e 's%@DEFPATH@%${DEFSDIR}/%g'  \
-e 's%@MIBSPATH@%${BMIBSDIR}/%g'
 
+NO_WCAST_ALIGN=yes
 WARNS?=6
 
 .include 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r300165 - head

2016-05-18 Thread Bryan Drewery
On 5/18/16 1:49 PM, Warner Losh wrote:
> Author: imp
> Date: Wed May 18 20:49:09 2016
> New Revision: 300165
> URL: https://svnweb.freebsd.org/changeset/base/300165
> 
> Log:
>   mipsn32el is not a thing, remove it from the list of valid
>   architectures. There's no definition for it, nobody uses it
>   and it is unlikely to ever work. We can put it back when someone
>   demonstrates it running...
>   
>   The new default for armv6 is hard float, so extend that default
>   to the external toolchain support.
> 
> Modified:
>   head/Makefile.inc1
> 
> Modified: head/Makefile.inc1
> ==
> --- head/Makefile.inc1Wed May 18 20:06:45 2016(r300164)
> +++ head/Makefile.inc1Wed May 18 20:49:09 2016(r300165)
> @@ -225,7 +225,6 @@ KNOWN_ARCHES?=aarch64/arm64 \
>   mipsel/mips \
>   mips64el/mips \
>   mips64/mips \
> - mipsn32el/mips \
>   mipsn32/mips \
>   powerpc \
>   powerpc64/powerpc \
> @@ -460,7 +459,7 @@ BFLAGS+=  -B${CROSS_BINUTILS_PREFIX}
>  BFLAGS+= -B${WORLDTMP}/usr/bin
>  .endif
>  .if ${TARGET} == "arm"
> -.if ${TARGET_ARCH:M*hf*} != ""
> +.if ${TARGET_ARCH:Marmv6*} != "" && ${TARGET_CPUTYPE:M*soft*} != ""
>  TARGET_ABI=  gnueabihf
>  .else
>  TARGET_ABI=  gnueabi
> 

It doesn't seem quite right...

~/git/freebsd # XCC=/usr/bin/cc TARGET=arm TARGET_ARCH=armv6 make -f
Makefile.inc1 -V TARGET_ABI -V TARGET_CPUTYPE
gnueabi
(blank)

Did you mean ${TARGET_CPUTYPE:M*soft*} == "" ?

-- 
Regards,
Bryan Drewery
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r300166 - stable/10/lib/libpam/modules

2016-05-18 Thread Bryan Drewery
Author: bdrewery
Date: Wed May 18 20:55:04 2016
New Revision: 300166
URL: https://svnweb.freebsd.org/changeset/base/300166

Log:
  MFC r297947:
  
Build libpam modules in parallel.

Modified:
  stable/10/lib/libpam/modules/Makefile
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/lib/libpam/modules/Makefile
==
--- stable/10/lib/libpam/modules/Makefile   Wed May 18 20:49:09 2016
(r300165)
+++ stable/10/lib/libpam/modules/Makefile   Wed May 18 20:55:04 2016
(r300166)
@@ -27,5 +27,6 @@
 .include "modules.inc"
 
 SUBDIR=${MODULES}
+SUBDIR_PARALLEL=
 
 .include 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r300165 - head

2016-05-18 Thread Warner Losh
Author: imp
Date: Wed May 18 20:49:09 2016
New Revision: 300165
URL: https://svnweb.freebsd.org/changeset/base/300165

Log:
  mipsn32el is not a thing, remove it from the list of valid
  architectures. There's no definition for it, nobody uses it
  and it is unlikely to ever work. We can put it back when someone
  demonstrates it running...
  
  The new default for armv6 is hard float, so extend that default
  to the external toolchain support.

Modified:
  head/Makefile.inc1

Modified: head/Makefile.inc1
==
--- head/Makefile.inc1  Wed May 18 20:06:45 2016(r300164)
+++ head/Makefile.inc1  Wed May 18 20:49:09 2016(r300165)
@@ -225,7 +225,6 @@ KNOWN_ARCHES?=  aarch64/arm64 \
mipsel/mips \
mips64el/mips \
mips64/mips \
-   mipsn32el/mips \
mipsn32/mips \
powerpc \
powerpc64/powerpc \
@@ -460,7 +459,7 @@ BFLAGS+=-B${CROSS_BINUTILS_PREFIX}
 BFLAGS+=   -B${WORLDTMP}/usr/bin
 .endif
 .if ${TARGET} == "arm"
-.if ${TARGET_ARCH:M*hf*} != ""
+.if ${TARGET_ARCH:Marmv6*} != "" && ${TARGET_CPUTYPE:M*soft*} != ""
 TARGET_ABI=gnueabihf
 .else
 TARGET_ABI=gnueabi
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r299830 - head/contrib/bsnmp/snmpd

2016-05-18 Thread Ngie Cooper

> On May 18, 2016, at 11:21, Gleb Smirnoff  wrote:
> 
>  Garrett,
> 
> On Sun, May 15, 2016 at 03:36:19AM +, Garrett Cooper wrote:
> G> Author: ngie
> G> Date: Sun May 15 03:36:19 2016
> G> New Revision: 299830
> G> URL: https://svnweb.freebsd.org/changeset/base/299830
> G> 
> G> Log:
> G>   Fix -Wcast-align warnings
> G>   
> G>   Use memcpy instead of using direct assignment of void* pointers with
> G>   CMSG_DATA(..), which changes alignment
> G>   
> G>   MFC after: 3 weeks
> G>   Reported by: clang
> G>   Sponsored by: EMC / Isilon Storage Division
> G> 
> G> Modified:
> G>   head/contrib/bsnmp/snmpd/main.c
> G> 
> G> Modified: head/contrib/bsnmp/snmpd/main.c
> G> 
> ==
> G> --- head/contrib/bsnmp/snmpd/main.cSun May 15 03:22:13 2016
> (r299829)
> G> +++ head/contrib/bsnmp/snmpd/main.cSun May 15 03:36:19 2016
> (r299830)
> G> @@ -1169,7 +1169,7 @@ recv_dgram(struct port_input *pi, struct
> G>  memcpy(laddr, CMSG_DATA(cmsg), sizeof(struct in_addr));
> G>  if (cmsg->cmsg_level == SOL_SOCKET &&
> G>  cmsg->cmsg_type == SCM_CREDS)
> G> -cred = (struct sockcred *)CMSG_DATA(cmsg);
> G> +memcpy(cred, CMSG_DATA(cmsg), sizeof(struct sockcred));
> 
> And cred is always NULL at this point, isn't it?

markj noted this as well. This is the one commit I should have had reviewed by 
other folks because I missed this point.

I'll revert the commit, mute the warning, and move on... Every time I've tried 
fixing CMSG I've ended up with headaches, so... I'm likely not the right person 
to be fixing these issues.

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


svn commit: r300164 - head/sys/net

2016-05-18 Thread Bjoern A. Zeeb
Author: bz
Date: Wed May 18 20:06:45 2016
New Revision: 300164
URL: https://svnweb.freebsd.org/changeset/base/300164

Log:
  Rather than having the if_vmove() code intermixed in the vnet_destroy()
  function in vnet.c move it to if.c where it logically belongs and put
  it under a VNET_SYSUNINIT() call.
  To not change the current behaviour make sure it runs first thing
  during teardown. In the future this will allow us more flexibility
  on changing the order on when we want to get rid of interfaces.
  
  Stop exporting if_vmove() and make it file static.
  
  Reviewed by:  gnn
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D6438

Modified:
  head/sys/net/if.c
  head/sys/net/if_var.h
  head/sys/net/vnet.c

Modified: head/sys/net/if.c
==
--- head/sys/net/if.c   Wed May 18 19:59:05 2016(r300163)
+++ head/sys/net/if.c   Wed May 18 20:06:45 2016(r300164)
@@ -182,6 +182,9 @@ static int  if_getgroupmembers(struct ifg
 static voidif_delgroups(struct ifnet *);
 static voidif_attach_internal(struct ifnet *, int, struct if_clone *);
 static int if_detach_internal(struct ifnet *, int, struct if_clone **);
+#ifdef VIMAGE
+static voidif_vmove(struct ifnet *, struct vnet *);
+#endif
 
 #ifdef INET6
 /*
@@ -392,6 +395,20 @@ vnet_if_uninit(const void *unused __unus
 }
 VNET_SYSUNINIT(vnet_if_uninit, SI_SUB_INIT_IF, SI_ORDER_FIRST,
 vnet_if_uninit, NULL);
+
+static void
+vnet_if_return(const void *unused __unused)
+{
+   struct ifnet *ifp, *nifp;
+
+   /* Return all inherited interfaces to their parent vnets. */
+   TAILQ_FOREACH_SAFE(ifp, _ifnet, if_link, nifp) {
+   if (ifp->if_home_vnet != ifp->if_vnet)
+   if_vmove(ifp, ifp->if_home_vnet);
+   }
+}
+VNET_SYSUNINIT(vnet_if_return, SI_SUB_VNET_DONE, SI_ORDER_ANY,
+vnet_if_return, NULL);
 #endif
 
 static void

Modified: head/sys/net/if_var.h
==
--- head/sys/net/if_var.h   Wed May 18 19:59:05 2016(r300163)
+++ head/sys/net/if_var.h   Wed May 18 20:06:45 2016(r300164)
@@ -535,7 +535,6 @@ voidif_dead(struct ifnet *);
 intif_delmulti(struct ifnet *, struct sockaddr *);
 void   if_delmulti_ifma(struct ifmultiaddr *);
 void   if_detach(struct ifnet *);
-void   if_vmove(struct ifnet *, struct vnet *);
 void   if_purgeaddrs(struct ifnet *);
 void   if_delallmulti(struct ifnet *);
 void   if_down(struct ifnet *);

Modified: head/sys/net/vnet.c
==
--- head/sys/net/vnet.c Wed May 18 19:59:05 2016(r300163)
+++ head/sys/net/vnet.c Wed May 18 20:06:45 2016(r300164)
@@ -269,7 +269,6 @@ vnet_alloc(void)
 void
 vnet_destroy(struct vnet *vnet)
 {
-   struct ifnet *ifp, *nifp;
 
SDT_PROBE2(vnet, functions, vnet_destroy, entry, __LINE__, vnet);
KASSERT(vnet->vnet_sockcnt == 0,
@@ -280,13 +279,6 @@ vnet_destroy(struct vnet *vnet)
VNET_LIST_WUNLOCK();
 
CURVNET_SET_QUIET(vnet);
-
-   /* Return all inherited interfaces to their parent vnets. */
-   TAILQ_FOREACH_SAFE(ifp, _ifnet, if_link, nifp) {
-   if (ifp->if_home_vnet != ifp->if_vnet)
-   if_vmove(ifp, ifp->if_home_vnet);
-   }
-
vnet_sysuninit();
CURVNET_RESTORE();
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r300088 - in releng/9.3: . sys/conf sys/dev/kbd

2016-05-18 Thread Bruce Evans

On Wed, 18 May 2016, Bruce Evans wrote:


On Tue, 17 May 2016, Bryan Drewery wrote:


On 5/17/16 4:07 PM, Gleb Smirnoff wrote:

On Tue, May 17, 2016 at 03:59:26PM -0700, Bryan Drewery wrote:
B> > Author: glebius
B> > Date: Tue May 17 22:28:36 2016
B> > New Revision: 300088
B> > URL: https://svnweb.freebsd.org/changeset/base/300088
B> >
B> > Log:
B> >   - Use unsigned version of min() when handling arguments of SETFKEY 
ioctl.

B> >   - Validate that user supplied control message length in sendmsg(2)
B> > is not negative.
B>
B> The sendmsg(2) change is not included here (9.3) nor in the advisory 
but

B> is in the commit log.  Was it intended to be changed in 9.3?

That was my failure to mention SA-16:19 in commit message for 9.3. It 
doesn't

apply to 9.x.

B> Plus the only consumer I see is sendit() which seems to be protected
B> already from negative values when not using COMPAT_43:
B>
B> >  if (mp->msg_controllen < sizeof(struct cmsghdr)
B> >  #ifdef COMPAT_OLDSOCK
B> >  && mp->msg_flags != MSG_COMPAT
B> >  #endif
B> >  ) {
B> >  error = EINVAL;
B> >  goto bad;
B> >  }
B> >  error = sockargs(, mp->msg_control,
B> >  mp->msg_controllen, MT_CONTROL);

No, it isn't protected. In the comparison (mp->msg_controllen < 
sizeof(struct cmsghdr))

both values are unsigned. Later in sockargs() it is treated as signed.


But it is protected (except on exotic unsupported arches).  The above is
a complete bounds check for mp->msg_controllen, written in an obfuscated
way using an unsigned type botch/hack.  Negative values are normally
promoted to large unsigned values, so they fail this check and sockargs()
is never called with them.

On exotic arches, the analysis is more complicated and the hack doesn't
work.  ...


Oops.  I read this sort of backwards.  The unsign botches are somewhat
larger, and more like the one in kbd.c:
- this only checks the lower bound, so if the operands were negative then
  they would pass instead of fail the check after bogus unsign extension
- the operands are actually both unsigned, since msg_controllen already
  has unsigned poisoning.  It was poisoned even in FreeBSD-1.  It was
  u_int then.  It is still u_int in 4.4BSD-Lite*.  Now it is socklen_t,
  which is uint32_t.  POSIX has messes for this.  At least in the 2001
  version, it doesn't seem to require the poisoning, but recommends that
  applications not use values above 2**31-1 [since these values require
  the poisoning to represent, and are not very useful except for opening
  security holes like here].
- so after passing the lower bound check, msg_controllen may have a large
  unsigned 32-bit value.  Undefined behaviour occurs when we pass this
  to sockargs() which doesn't have unsign poisoning.  Except on unsupported
  exotic arches, the behaviour is to overflow to a negative value.
- sockargs() then checks the overflowed value.  This is robust enough if
  the overflow gives any value at all, but still bogus.

Correct code would do bounds checks before calling sockargs (of the
form val >= min && val <= INT_MAX), but there are several callers and
it is convenient to check only in sockargs().  For that, sockargs must
take a parameter with the same type as msg_controllen, although old
unsign botches force this to be unsigned (precisely socklen_t).  It is
too late to change socklen_t back to int.

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


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

2016-05-18 Thread Bruce Evans

On Wed, 18 May 2016, Ian Lepore wrote:


On Wed, 2016-05-18 at 17:35 +, Bjoern A. Zeeb wrote:

On 18 May 2016, at 17:32 , Ian Lepore  wrote:

On Wed, 2016-05-18 at 10:14 -0700, Nathan Whitehorn wrote:
...
It may be more complicated than that, though.  armv6 can do 64-bit
atomics even tho it's 32-bit.  armv4, also 32-bit, can do 64-bit
atomics in the kernel but not in userland.

Maybe machine/atomic.h needs a #define that says whether 64-bit ops
are
available in the current compilation unit.  (And likewise for other
bit
sizes if we have arches that have other limitations.)


Question because I didn?t follow the details, but how was this solved
for the COUNTERS framework?


Using special code that pessimizes old machines on 32-bit arches especially.

For example, incrementing a 32-bit network counter used to take 1 inlined
counter++ statement
(as little as 1 instruction on i386, but it is a read-modify-write
instruction and thus no faster than separate instructions, and if
the counter is shared this is almost as slow as a locked instruction
in some cases).
This now takes an if_inc_counter() function call which takes 33 instructions
altogether on i386 with certain nonstandard not very optimal CFLAGS, and 9
instructions on amd64.
(COUNTER64() code is inlined, and the function call is a separate
pessimization.  It costs about half of the 9 instructions on amd64
and its instructions are relatively heavyweight.)
This is when i386 has cmpxchgb.  The single cmpxchg8b instruction is
heavier weight than a 32-bit memory increment and using it takes lots
of control logic.


iirc, each platform implements counters its own way, probably the wrong
way on all of them except x86.


I think other arches just use compatiblity code which uses critical
sections.  This is not so bad.  It might be faster than using cmpxchg8b
depending on how fast critical_enter() and critical_exit() are.
Unfortunately, they are not very fast.  They are functions too, and
on i386 critical_enter() takes 20+ instructions.  critical_exit() takes
more, and debugging is broken and caused a panic when I tried to
trace through critical_exit().  That is so slow that hard-disabling
interrupts is probably faster.

Network drivers were mostly written under the assumption that they are
running on a UP system and incrementing a counter is inline and fast,
so they increment counters without worrying about the overhead for
this.  33 instructions for 2 if_inc_counter()s per packet is about a
1% pessimization for bge on my slow hardware.


For some crazy reason the docs for COUNTERS say that it does not use
atomics.  I have no idea why the docs for an API are dictating
implementation, but I suspect it's because atomics are more expensive
on x86 than other alternatives.  So the arm code slavishly avoids using
atomics in COUNTERS even though doing so would be more effecient than
the current copied-from-x86 code.


Other places just hard-code use of PCPU although that is also more
complicated and uglier than counter++.  Counters in PCPU only exist
because full atomics are probably slower on all arches and much slower
on most arches.  Most 64-bit PCPU accesses on 32-bit arches are broken
since they are not atomic even for 1 CPU.  COUNTER64() is more careful
to a fault.  arm PCPU_INC() seems to be broken even for 32-bit accesses.
In the non-SMP case, it just does pcpu->pc_ ## member++ and in the SMP
case it does the same with a register pointer instead of a global.

I wrote some alternative x86 implementations that are at least 20%
faster than the cmpxchg8b method, but the best method is clearly to
use only 32-bit low-level counters and add up the counters in a daemon.
The daemon shouldn't run very often.  There aren't many counters except
i/o byte counters that want to wrap in 32 bits more than once per hour.
Even 100 Gbps ethernet can only do 150 Mpps so it takes at least 30
seconds to wrap.

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

svn commit: r300163 - head/lib/libufs

2016-05-18 Thread Pedro F. Giffuni
Author: pfg
Date: Wed May 18 19:59:05 2016
New Revision: 300163
URL: https://svnweb.freebsd.org/changeset/base/300163

Log:
  libufs: Simplify generation number calculation.
  
  UFS generation numbers have been unsigned since 2013 (r256435).

Modified:
  head/lib/libufs/cgroup.c

Modified: head/lib/libufs/cgroup.c
==
--- head/lib/libufs/cgroup.cWed May 18 19:38:00 2016(r300162)
+++ head/lib/libufs/cgroup.cWed May 18 19:59:05 2016(r300163)
@@ -157,7 +157,7 @@ gotit:
bzero(block, (int)fs->fs_bsize);
dp2 = (struct ufs2_dinode *)
for (i = 0; i < INOPB(fs); i++) {
-   dp2->di_gen = arc4random() / 2 + 1;
+   dp2->di_gen = arc4random();
dp2++;
}
if (bwrite(disk, ino_to_fsba(fs,
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r300162 - svnadmin/conf

2016-05-18 Thread Adrian Chadd
Author: adrian
Date: Wed May 18 19:38:00 2016
New Revision: 300162
URL: https://svnweb.freebsd.org/changeset/base/300162

Log:
  Release sgalabov from mentorship.
  
  Approved by:  core (implicit)

Modified:
  svnadmin/conf/mentors

Modified: svnadmin/conf/mentors
==
--- svnadmin/conf/mentors   Wed May 18 18:35:45 2016(r300161)
+++ svnadmin/conf/mentors   Wed May 18 19:38:00 2016(r300162)
@@ -28,7 +28,6 @@ miwi  rwatson
 monthadar  adrian
 peterj jhb Co-mentor: grog
 phil   theravenCo-mentor: sjg
-sgalabov   adrian
 slmken Co-mentor: scottl, ambrisko
 snbdwmalone
 lidl   rpaulo  Co-mentor: adrian
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2016-05-18 Thread Adrian Chadd
On 18 May 2016 at 10:32, Ian Lepore  wrote:
> On Wed, 2016-05-18 at 10:14 -0700, Nathan Whitehorn wrote:
>>
>> On 05/18/16 08:50, Justin Hibbits wrote:
>> > On Wed, 18 May 2016 15:45:12 + (UTC)
>> > Scott Long  wrote:
>> >
>> > > Author: scottl
>> > > Date: Wed May 18 15:45:12 2016
>> > > New Revision: 300154
>> > > URL: https://svnweb.freebsd.org/changeset/base/300154
>> > >
>> > > Log:
>> > >Activate the NO_64BIT_ATOMICS code for mips and powerpc
>> > >
>> > > Modified:
>> > >head/sys/net/mp_ring.c
>> > >
>> > > Modified: head/sys/net/mp_ring.c
>> > > =
>> > > =
>> > > --- head/sys/net/mp_ring.cWed May 18 15:44:45 2016
>> > > (r300153) +++ head/sys/net/mp_ring.c  Wed May 18 15:45:12
>> > > 2016  (r300154) @@ -37,15 +37,17 @@ __FBSDID("$FreeBSD$");
>> > >   #include 
>> > >   #include 
>> > >
>> > > -
>> > > -
>> > > -#include 
>> > > +#if defined(__powerpc__) || defined(__mips__)
>> > > +#define NO_64BIT_ATOMICS
>> > > +#endif
>> > >
>> > >   #if defined(__i386__)
>> > >   #define atomic_cmpset_acq_64 atomic_cmpset_64
>> > >   #define atomic_cmpset_rel_64 atomic_cmpset_64
>> > >   #endif
>> > >
>> > > +#include 
>> > > +
>> > >   union ring_state {
>> > >   struct {
>> > >   uint16_t pidx_head;
>> > >
>> > powerpc64 defines both __powerpc__ and __powerpc64__, so you're
>> > killing
>> > atomics on powerpc64 with this.
>> >
>> > - Justin
>> >
>>
>> Don't all of our 64-bit platforms have 64-bit atomics? So you could
>> just
>> #if defined(__LP64__) || defined(__i386__) ||
>> defined(__whatever_the_thing_is_for_mips_n32__)
>> -Nathan
>>
>
> It may be more complicated than that, though.  armv6 can do 64-bit
> atomics even tho it's 32-bit.  armv4, also 32-bit, can do 64-bit
> atomics in the kernel but not in userland.
>
> Maybe machine/atomic.h needs a #define that says whether 64-bit ops are
> available in the current compilation unit.  (And likewise for other bit
> sizes if we have arches that have other limitations.)

Please, please do this. Don't do a list of platforms, do a list of
features. Pretty please.



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


Re: svn commit: r300149 - in head/sys: arm/allwinner arm/allwinner/a10 arm/arm arm/broadcom/bcm2835 arm/mv arm/nvidia arm/ti arm/ti/omap4 arm64/arm64 kern mips/mediatek mips/mips sys

2016-05-18 Thread Zbigniew Bodek
Hello Andrew,

Thanks for your reply. Please see my comments in-line.

Kind regards
zbb

2016-05-18 17:24 GMT+02:00 Andrew Turner :

> On Wed, 18 May 2016 17:15:10 +0200
> Zbigniew Bodek  wrote:
>
> > 2016-05-18 17:05 GMT+02:00 Andrew Turner :
> ...
> > >  #ifdef INTRNG
> > > xref = OF_xref_from_node(ofw_bus_get_node(dev));
> > > -   if (intr_pic_register(dev, xref) != 0) {
> > > +   if (intr_pic_register(dev, xref) == NULL) {
> > > device_printf(dev, "could not register PIC\n");
> > > goto error;
> > > }
> > > @@ -172,7 +172,7 @@ error:
> > > /* Failure so free resources */
> > > gic_v3_detach(dev);
> > >
> > > -   return (err);
> > > +   return (ENXIO);
> > >
> >
> >
> > Few line above we have:
> > err = gic_v3_attach(dev);
> > if (err != 0)
> > goto error;
> >
> > So now we would not return error code from gic_v3_attach() but always
> > ENXIO...
>
> The error value doesn't matter, as long as it's non-zero. This also
> fixes the return value in the intrng case if either of
> intr_pic_register or intr_pic_claim_root fail. You might get a little
> information from the return value being printed, however it would be
> more useful to have verbose logging to print an error message.
>
>
So if you wanted to fix INTRNG part why didn't you just set an error value
in case of intr_pic_register() failure before "goto error"?
Simply:

 +   if (intr_pic_register(dev, xref) == NULL) {
 device_printf(dev, "could not register PIC\n");
+   err = ENXIO;
 goto error;
}

Because now we set an error value and in case of real error (not when
gic_v3_attach() returns 0) we print ENXIO while doing nothing with the err
variable...



> In all of these failure cases there isn't much we can do as there is no
> root interrupt controller, the boot will fail later on when we enable
> interrupts.
>

I know but that is not the explanation for breaking the logic here.


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


Re: svn commit: r299830 - head/contrib/bsnmp/snmpd

2016-05-18 Thread Gleb Smirnoff
  Garrett,

On Sun, May 15, 2016 at 03:36:19AM +, Garrett Cooper wrote:
G> Author: ngie
G> Date: Sun May 15 03:36:19 2016
G> New Revision: 299830
G> URL: https://svnweb.freebsd.org/changeset/base/299830
G> 
G> Log:
G>   Fix -Wcast-align warnings
G>   
G>   Use memcpy instead of using direct assignment of void* pointers with
G>   CMSG_DATA(..), which changes alignment
G>   
G>   MFC after: 3 weeks
G>   Reported by: clang
G>   Sponsored by: EMC / Isilon Storage Division
G> 
G> Modified:
G>   head/contrib/bsnmp/snmpd/main.c
G> 
G> Modified: head/contrib/bsnmp/snmpd/main.c
G> 
==
G> --- head/contrib/bsnmp/snmpd/main.c  Sun May 15 03:22:13 2016
(r299829)
G> +++ head/contrib/bsnmp/snmpd/main.c  Sun May 15 03:36:19 2016
(r299830)
G> @@ -1169,7 +1169,7 @@ recv_dgram(struct port_input *pi, struct
G>  memcpy(laddr, CMSG_DATA(cmsg), sizeof(struct in_addr));
G>  if (cmsg->cmsg_level == SOL_SOCKET &&
G>  cmsg->cmsg_type == SCM_CREDS)
G> -cred = (struct sockcred *)CMSG_DATA(cmsg);
G> +memcpy(cred, CMSG_DATA(cmsg), sizeof(struct sockcred));

And cred is always NULL at this point, isn't it?

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


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

2016-05-18 Thread Mark Johnston
On Tue, May 17, 2016 at 10:22:18PM -0700, NGie Cooper wrote:
> 
> > On May 17, 2016, at 20:55, Mark Johnston  wrote:
> > 
> > Author: markj
> > Date: Wed May 18 03:55:54 2016
> > New Revision: 300110
> > URL: https://svnweb.freebsd.org/changeset/base/300110
> > 
> > Log:
> >  Do not acquire the thread lock in hardclock_cnt() unless needed.
> > 
> >  This function only sets thread flags if a SIGPROF or SIGVTALRM timer
> >  has fired, which is almost never the case.
> > 
> >  MFC after:2 weeks
> > 
> > Modified:
> >  head/sys/kern/kern_clock.c
> > 
> > Modified: head/sys/kern/kern_clock.c
> > ==
> > --- head/sys/kern/kern_clock.cWed May 18 03:50:21 2016(r300109)
> > +++ head/sys/kern/kern_clock.cWed May 18 03:55:54 2016(r300110)
> > @@ -570,9 +570,11 @@ hardclock_cnt(int cnt, int usermode)
> >flags |= TDF_PROFPEND | TDF_ASTPENDING;
> >PROC_ITIMUNLOCK(p);
> >}
> > -thread_lock(td);
> > -td->td_flags |= flags;
> > -thread_unlock(td);
> > +if (flags != 0) {
> > +thread_lock(td);
> > +td->td_flags |= flags;
> > +thread_unlock(td);
> > +}
> 
> Use predict_false?

I don't think that's really warranted here. A __predict_false could
become incorrect after a future change elsewhere in this function, and
this isn't enough of a hot path for such a change to make a measurable
difference on its own.

> > 
> > #ifdefHWPMC_HOOKS
> >if (PMC_CPU_HAS_SAMPLES(PCPU_GET(cpuid)))
> > 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r300137 - head

2016-05-18 Thread Bryan Drewery
On 5/18/16 3:43 AM, Andriy Voskoboinyk wrote:
> Author: avos
> Date: Wed May 18 10:43:13 2016
> New Revision: 300137
> URL: https://svnweb.freebsd.org/changeset/base/300137
> 
> Log:
>   README: remove nonexistent 'games' directory.
>   
>   Games were moved to usr.bin in r288485.
>   
>   (todo: add/describe 'targets' directory)

targets/ is only used when using the WITH_DIRDEPS_BUILD flag, which
invokes a totally different build system than buildworld.  See
src.conf(5) WITH_DIRDEPS_BUILD.

> 
> Modified:
>   head/README
> 
> Modif

-- 
Regards,
Bryan Drewery
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2016-05-18 Thread Ian Lepore
On Wed, 2016-05-18 at 17:35 +, Bjoern A. Zeeb wrote:
> > On 18 May 2016, at 17:32 , Ian Lepore  wrote:
> > 
> > On Wed, 2016-05-18 at 10:14 -0700, Nathan Whitehorn wrote:
> > > 
> > > On 05/18/16 08:50, Justin Hibbits wrote:
> > > > On Wed, 18 May 2016 15:45:12 + (UTC)
> > > > Scott Long  wrote:
> > > > 
> > > > > Author: scottl
> > > > > Date: Wed May 18 15:45:12 2016
> > > > > New Revision: 300154
> > > > > URL: https://svnweb.freebsd.org/changeset/base/300154
> > > > > 
> > > > > Log:
> > > > >   Activate the NO_64BIT_ATOMICS code for mips and powerpc
> > > > > 
> > > > > Modified:
> > > > >   head/sys/net/mp_ring.c
> > > > > 
> > > > > Modified: head/sys/net/mp_ring.c
> > > > > =
> > > > > 
> > > > > =
> > > > > --- head/sys/net/mp_ring.cWed May 18 15:44:45 2016
> > > > > (r300153) +++ head/sys/net/mp_ring.c  Wed May 18
> > > > > 15:45:12
> > > > > 2016  (r300154) @@ -37,15 +37,17 @@
> > > > > __FBSDID("$FreeBSD$");
> > > > >  #include 
> > > > >  #include 
> > > > > 
> > > > > -
> > > > > -
> > > > > -#include 
> > > > > +#if defined(__powerpc__) || defined(__mips__)
> > > > > +#define NO_64BIT_ATOMICS
> > > > > +#endif
> > > > > 
> > > > >  #if defined(__i386__)
> > > > >  #define atomic_cmpset_acq_64 atomic_cmpset_64
> > > > >  #define atomic_cmpset_rel_64 atomic_cmpset_64
> > > > >  #endif
> > > > > 
> > > > > +#include 
> > > > > +
> > > > >  union ring_state {
> > > > >   struct {
> > > > >   uint16_t pidx_head;
> > > > > 
> > > > powerpc64 defines both __powerpc__ and __powerpc64__, so you're
> > > > killing
> > > > atomics on powerpc64 with this.
> > > > 
> > > > - Justin
> > > > 
> > > 
> > > Don't all of our 64-bit platforms have 64-bit atomics? So you
> > > could
> > > just 
> > > #if defined(__LP64__) || defined(__i386__) || 
> > > defined(__whatever_the_thing_is_for_mips_n32__)
> > > -Nathan
> > > 
> > 
> > It may be more complicated than that, though.  armv6 can do 64-bit
> > atomics even tho it's 32-bit.  armv4, also 32-bit, can do 64-bit
> > atomics in the kernel but not in userland.
> > 
> > Maybe machine/atomic.h needs a #define that says whether 64-bit ops
> > are
> > available in the current compilation unit.  (And likewise for other
> > bit
> > sizes if we have arches that have other limitations.)
> 
> 
> Question because I didn’t follow the details, but how was this solved
> for the COUNTERS framework?
> 
> 
> /bz
> 

iirc, each platform implements counters its own way, probably the wrong
way on all of them except x86.

For some crazy reason the docs for COUNTERS say that it does not use
atomics.  I have no idea why the docs for an API are dictating
implementation, but I suspect it's because atomics are more expensive
on x86 than other alternatives.  So the arm code slavishly avoids using
atomics in COUNTERS even though doing so would be more effecient than
the current copied-from-x86 code.

-- Ian

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

svn commit: r300160 - head/sys/fs/nfsclient

2016-05-18 Thread Gleb Smirnoff
Author: glebius
Date: Wed May 18 17:40:53 2016
New Revision: 300160
URL: https://svnweb.freebsd.org/changeset/base/300160

Log:
  Comment fix: the getsockaddr() is actually meant here.
  
  Reviewed by:  rmacklem

Modified:
  head/sys/fs/nfsclient/nfs_clvfsops.c

Modified: head/sys/fs/nfsclient/nfs_clvfsops.c
==
--- head/sys/fs/nfsclient/nfs_clvfsops.cWed May 18 17:08:29 2016
(r300159)
+++ head/sys/fs/nfsclient/nfs_clvfsops.cWed May 18 17:40:53 2016
(r300160)
@@ -841,7 +841,7 @@ nfs_mount_parse_from(struct vfsoptlist *
  * mount system call
  * It seems a bit dumb to copyinstr() the host and path here and then
  * bcopy() them in mountnfs(), but I wanted to detect errors before
- * doing the sockargs() call because sockargs() allocates an mbuf and
+ * doing the getsockaddr() call because getsockaddr() allocates an mbuf and
  * an error after that means that I have to release the mbuf.
  */
 /* ARGSUSED */
@@ -1228,7 +1228,7 @@ nfs_mount(struct mount *mp)
goto out;
bzero([hstlen], MNAMELEN - hstlen);
args.hostname = hst;
-   /* sockargs() call must be after above copyin() calls */
+   /* getsockaddr() call must be after above copyin() calls */
error = getsockaddr(, (caddr_t)args.addr,
args.addrlen);
if (error != 0)
@@ -1332,7 +1332,7 @@ out:
  * mount system call
  * It seems a bit dumb to copyinstr() the host and path here and then
  * bcopy() them in mountnfs(), but I wanted to detect errors before
- * doing the sockargs() call because sockargs() allocates an mbuf and
+ * doing the getsockaddr() call because getsockaddr() allocates an mbuf and
  * an error after that means that I have to release the mbuf.
  */
 /* ARGSUSED */
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2016-05-18 Thread Ian Lepore
On Wed, 2016-05-18 at 10:14 -0700, Nathan Whitehorn wrote:
> 
> On 05/18/16 08:50, Justin Hibbits wrote:
> > On Wed, 18 May 2016 15:45:12 + (UTC)
> > Scott Long  wrote:
> > 
> > > Author: scottl
> > > Date: Wed May 18 15:45:12 2016
> > > New Revision: 300154
> > > URL: https://svnweb.freebsd.org/changeset/base/300154
> > > 
> > > Log:
> > >Activate the NO_64BIT_ATOMICS code for mips and powerpc
> > > 
> > > Modified:
> > >head/sys/net/mp_ring.c
> > > 
> > > Modified: head/sys/net/mp_ring.c
> > > =
> > > =
> > > --- head/sys/net/mp_ring.cWed May 18 15:44:45 2016
> > > (r300153) +++ head/sys/net/mp_ring.c  Wed May 18 15:45:12
> > > 2016  (r300154) @@ -37,15 +37,17 @@ __FBSDID("$FreeBSD$");
> > >   #include 
> > >   #include 
> > >   
> > > -
> > > -
> > > -#include 
> > > +#if defined(__powerpc__) || defined(__mips__)
> > > +#define NO_64BIT_ATOMICS
> > > +#endif
> > >   
> > >   #if defined(__i386__)
> > >   #define atomic_cmpset_acq_64 atomic_cmpset_64
> > >   #define atomic_cmpset_rel_64 atomic_cmpset_64
> > >   #endif
> > >   
> > > +#include 
> > > +
> > >   union ring_state {
> > >   struct {
> > >   uint16_t pidx_head;
> > > 
> > powerpc64 defines both __powerpc__ and __powerpc64__, so you're
> > killing
> > atomics on powerpc64 with this.
> > 
> > - Justin
> > 
> 
> Don't all of our 64-bit platforms have 64-bit atomics? So you could
> just 
> #if defined(__LP64__) || defined(__i386__) || 
> defined(__whatever_the_thing_is_for_mips_n32__)
> -Nathan
> 

It may be more complicated than that, though.  armv6 can do 64-bit
atomics even tho it's 32-bit.  armv4, also 32-bit, can do 64-bit
atomics in the kernel but not in userland.

Maybe machine/atomic.h needs a #define that says whether 64-bit ops are
available in the current compilation unit.  (And likewise for other bit
sizes if we have arches that have other limitations.)

-- Ian

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


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

2016-05-18 Thread Bjoern A. Zeeb

> On 18 May 2016, at 17:32 , Ian Lepore  wrote:
> 
> On Wed, 2016-05-18 at 10:14 -0700, Nathan Whitehorn wrote:
>> 
>> On 05/18/16 08:50, Justin Hibbits wrote:
>>> On Wed, 18 May 2016 15:45:12 + (UTC)
>>> Scott Long  wrote:
>>> 
 Author: scottl
 Date: Wed May 18 15:45:12 2016
 New Revision: 300154
 URL: https://svnweb.freebsd.org/changeset/base/300154
 
 Log:
   Activate the NO_64BIT_ATOMICS code for mips and powerpc
 
 Modified:
   head/sys/net/mp_ring.c
 
 Modified: head/sys/net/mp_ring.c
 =
 =
 --- head/sys/net/mp_ring.c Wed May 18 15:44:45 2016
 (r300153) +++ head/sys/net/mp_ring.c   Wed May 18 15:45:12
 2016   (r300154) @@ -37,15 +37,17 @@ __FBSDID("$FreeBSD$");
  #include 
  #include 
 
 -
 -
 -#include 
 +#if defined(__powerpc__) || defined(__mips__)
 +#define NO_64BIT_ATOMICS
 +#endif
 
  #if defined(__i386__)
  #define atomic_cmpset_acq_64 atomic_cmpset_64
  #define atomic_cmpset_rel_64 atomic_cmpset_64
  #endif
 
 +#include 
 +
  union ring_state {
struct {
uint16_t pidx_head;
 
>>> powerpc64 defines both __powerpc__ and __powerpc64__, so you're
>>> killing
>>> atomics on powerpc64 with this.
>>> 
>>> - Justin
>>> 
>> 
>> Don't all of our 64-bit platforms have 64-bit atomics? So you could
>> just 
>> #if defined(__LP64__) || defined(__i386__) || 
>> defined(__whatever_the_thing_is_for_mips_n32__)
>> -Nathan
>> 
> 
> It may be more complicated than that, though.  armv6 can do 64-bit
> atomics even tho it's 32-bit.  armv4, also 32-bit, can do 64-bit
> atomics in the kernel but not in userland.
> 
> Maybe machine/atomic.h needs a #define that says whether 64-bit ops are
> available in the current compilation unit.  (And likewise for other bit
> sizes if we have arches that have other limitations.)


Question because I didn’t follow the details, but how was this solved for the 
COUNTERS framework?


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

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

2016-05-18 Thread Nathan Whitehorn



On 05/18/16 08:50, Justin Hibbits wrote:

On Wed, 18 May 2016 15:45:12 + (UTC)
Scott Long  wrote:


Author: scottl
Date: Wed May 18 15:45:12 2016
New Revision: 300154
URL: https://svnweb.freebsd.org/changeset/base/300154

Log:
   Activate the NO_64BIT_ATOMICS code for mips and powerpc

Modified:
   head/sys/net/mp_ring.c

Modified: head/sys/net/mp_ring.c
==
--- head/sys/net/mp_ring.c  Wed May 18 15:44:45 2016
(r300153) +++ head/sys/net/mp_ring.cWed May 18 15:45:12
2016(r300154) @@ -37,15 +37,17 @@ __FBSDID("$FreeBSD$");
  #include 
  #include 
  
-

-
-#include 
+#if defined(__powerpc__) || defined(__mips__)
+#define NO_64BIT_ATOMICS
+#endif
  
  #if defined(__i386__)

  #define atomic_cmpset_acq_64 atomic_cmpset_64
  #define atomic_cmpset_rel_64 atomic_cmpset_64
  #endif
  
+#include 

+
  union ring_state {
struct {
uint16_t pidx_head;


powerpc64 defines both __powerpc__ and __powerpc64__, so you're killing
atomics on powerpc64 with this.

- Justin



Don't all of our 64-bit platforms have 64-bit atomics? So you could just 
#if defined(__LP64__) || defined(__i386__) || 
defined(__whatever_the_thing_is_for_mips_n32__)

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


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

2016-05-18 Thread Ed Maste
On 18 May 2016 at 13:11, Juli Mallett  wrote:
> On Wed, May 18, 2016 at 9:41 AM, Justin Hibbits  wrote:
>> #if (defined(__powerpc__) && !defined(__powerpc64__)) ||
>> (defined(__mips__) && !defined(__mips64__))
>>
>> should work.
>
> Depending on what the point of this is on MIPS, it is probably also
> inadequate.  I believe you want a MIPS ABI check, as we can support
> 64-bit atomics with n32 and n64 ABIs, so !defined(__mips_n32) &&
> !defined(__mips_n64).

I've started trying to collect these details on
https://wiki.freebsd.org/EdMaste/ArchitectureSpecifics .  (My plan is
to move it to a better location when it's reasonably complete.)

There's no information for the MIPS variants right now; I'd be happy
for someone who knows those details to update the wiki page.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2016-05-18 Thread Juli Mallett
On Wed, May 18, 2016 at 9:41 AM, Justin Hibbits  wrote:
> #if (defined(__powerpc__) && !defined(__powerpc64__)) ||
> (defined(__mips__) && !defined(__mips64__))
>
> should work.

Depending on what the point of this is on MIPS, it is probably also
inadequate.  I believe you want a MIPS ABI check, as we can support
64-bit atomics with n32 and n64 ABIs, so !defined(__mips_n32) &&
!defined(__mips_n64).
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r300159 - head

2016-05-18 Thread Bryan Drewery
Author: bdrewery
Date: Wed May 18 17:08:29 2016
New Revision: 300159
URL: https://svnweb.freebsd.org/changeset/base/300159

Log:
  Combine restage/reinstall in a safe way.
  
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/Makefile.inc1

Modified: head/Makefile.inc1
==
--- head/Makefile.inc1  Wed May 18 16:25:34 2016(r300158)
+++ head/Makefile.inc1  Wed May 18 17:08:29 2016(r300159)
@@ -975,27 +975,19 @@ packageworld: .PHONY
 # and do a 'make reinstall' on the *client* to install new binaries from the
 # most recent server build.
 #
-reinstall: .MAKE .PHONY
+restage reinstall: .MAKE .PHONY
@echo "--"
@echo ">>> Making hierarchy"
@echo "--"
${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 \
LOCAL_MTREE=${LOCAL_MTREE:Q} hierarchy
-   @echo
+.if make(restage)
@echo "--"
-   @echo ">>> Installing everything"
-   @echo "--"
-   ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install
-.if defined(LIBCOMPAT)
-   ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install${libcompat}
-.endif
-
-restage: .MAKE .PHONY
-   @echo "--"
-   @echo ">>> Making hierarchy"
+   @echo ">>> Making distribution"
@echo "--"
${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 \
-   LOCAL_MTREE=${LOCAL_MTREE:Q} hierarchy distribution
+   LOCAL_MTREE=${LOCAL_MTREE:Q} distribution
+.endif
@echo
@echo "--"
@echo ">>> Installing everything"
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2016-05-18 Thread Scott Long via svn-src-all
What should I use instead?

Scott

> On May 18, 2016, at 10:03 AM, Warner Losh  wrote:
> 
> Ditto with mips.
> 
> On Wed, May 18, 2016 at 9:50 AM, Justin Hibbits  wrote:
> On Wed, 18 May 2016 15:45:12 + (UTC)
> Scott Long  wrote:
> 
> > Author: scottl
> > Date: Wed May 18 15:45:12 2016
> > New Revision: 300154
> > URL: https://svnweb.freebsd.org/changeset/base/300154
> >
> > Log:
> >   Activate the NO_64BIT_ATOMICS code for mips and powerpc
> >
> > Modified:
> >   head/sys/net/mp_ring.c
> >
> > Modified: head/sys/net/mp_ring.c
> > ==
> > --- head/sys/net/mp_ring.cWed May 18 15:44:45 2016
> > (r300153) +++ head/sys/net/mp_ring.c  Wed May 18 15:45:12
> > 2016  (r300154) @@ -37,15 +37,17 @@ __FBSDID("$FreeBSD$");
> >  #include 
> >  #include 
> >
> > -
> > -
> > -#include 
> > +#if defined(__powerpc__) || defined(__mips__)
> > +#define NO_64BIT_ATOMICS
> > +#endif
> >
> >  #if defined(__i386__)
> >  #define atomic_cmpset_acq_64 atomic_cmpset_64
> >  #define atomic_cmpset_rel_64 atomic_cmpset_64
> >  #endif
> >
> > +#include 
> > +
> >  union ring_state {
> >   struct {
> >   uint16_t pidx_head;
> >
> 
> powerpc64 defines both __powerpc__ and __powerpc64__, so you're killing
> atomics on powerpc64 with this.
> 
> - Justin
> 
> 

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


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

2016-05-18 Thread Justin Hibbits
#if (defined(__powerpc__) && !defined(__powerpc64__)) ||
(defined(__mips__) && !defined(__mips64__))

should work.

- Justin

On Wed, 18 May 2016 10:40:27 -0600
Scott Long  wrote:

> What should I use instead?
> 
> Scott
> 
> > On May 18, 2016, at 10:03 AM, Warner Losh  wrote:
> > 
> > Ditto with mips.
> > 
> > On Wed, May 18, 2016 at 9:50 AM, Justin Hibbits
> >  wrote: On Wed, 18 May 2016 15:45:12 +
> > (UTC) Scott Long  wrote:
> >   
> > > Author: scottl
> > > Date: Wed May 18 15:45:12 2016
> > > New Revision: 300154
> > > URL: https://svnweb.freebsd.org/changeset/base/300154
> > >
> > > Log:
> > >   Activate the NO_64BIT_ATOMICS code for mips and powerpc
> > >
> > > Modified:
> > >   head/sys/net/mp_ring.c
> > >
> > > Modified: head/sys/net/mp_ring.c
> > > ==
> > > --- head/sys/net/mp_ring.cWed May 18 15:44:45 2016
> > > (r300153) +++ head/sys/net/mp_ring.c  Wed May 18 15:45:12
> > > 2016  (r300154) @@ -37,15 +37,17 @@ __FBSDID("$FreeBSD$");
> > >  #include 
> > >  #include 
> > >
> > > -
> > > -
> > > -#include 
> > > +#if defined(__powerpc__) || defined(__mips__)
> > > +#define NO_64BIT_ATOMICS
> > > +#endif
> > >
> > >  #if defined(__i386__)
> > >  #define atomic_cmpset_acq_64 atomic_cmpset_64
> > >  #define atomic_cmpset_rel_64 atomic_cmpset_64
> > >  #endif
> > >
> > > +#include 
> > > +
> > >  union ring_state {
> > >   struct {
> > >   uint16_t pidx_head;
> > >  
> > 
> > powerpc64 defines both __powerpc__ and __powerpc64__, so you're
> > killing atomics on powerpc64 with this.
> > 
> > - Justin
> > 
> >   
> 

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


svn commit: r300158 - head/sys/kern

2016-05-18 Thread Ravi Pokala
Author: rpokala
Date: Wed May 18 16:25:34 2016
New Revision: 300158
URL: https://svnweb.freebsd.org/changeset/base/300158

Log:
  Fix misleading comments in bus_if.m
  
  While looking at r300073, I noticed these incorrect comments in the context
  of the diff.
  
  Reviewed by:  imp, jhb
  Differential Revision:https://reviews.freebsd.org/D6431

Modified:
  head/sys/kern/bus_if.m

Modified: head/sys/kern/bus_if.m
==
--- head/sys/kern/bus_if.m  Wed May 18 16:15:09 2016(r300157)
+++ head/sys/kern/bus_if.m  Wed May 18 16:25:34 2016(r300158)
@@ -530,8 +530,8 @@ METHOD int child_present {
 /**
  * @brief Returns the pnp info for this device.
  *
- * Return it as a string.  If the string is insufficient for the
- * storage, then return EOVERFLOW.
+ * Return it as a string.  If the storage is insufficient for the
+ * string, then return EOVERFLOW.
  *
  * The string must be formatted as a space-separated list of
  * name=value pairs.  Names may only contain alphanumeric characters,
@@ -556,8 +556,8 @@ METHOD int child_pnpinfo_str {
 /**
  * @brief Returns the location for this device.
  *
- * Return it as a string.  If the string is insufficient for the
- * storage, then return EOVERFLOW.
+ * Return it as a string.  If the storage is insufficient for the
+ * string, then return EOVERFLOW.
  *
  * The string must be formatted as a space-separated list of
  * name=value pairs.  Names may only contain alphanumeric characters,
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r300157 - head/sys/dev/isp

2016-05-18 Thread Alexander Motin
Author: mav
Date: Wed May 18 16:15:09 2016
New Revision: 300157
URL: https://svnweb.freebsd.org/changeset/base/300157

Log:
  Unify Multi ID target code by reusing isp_find_chan_by_did().

Modified:
  head/sys/dev/isp/isp_target.c

Modified: head/sys/dev/isp/isp_target.c
==
--- head/sys/dev/isp/isp_target.c   Wed May 18 15:57:13 2016
(r300156)
+++ head/sys/dev/isp/isp_target.c   Wed May 18 16:15:09 2016
(r300157)
@@ -775,18 +775,17 @@ isp_got_tmf_24xx(ispsoftc_t *isp, at7_en
notify.nt_tagval |= (((uint64_t)(isp->isp_serno++)) << 32);
notify.nt_lreserved = aep;
sid = (aep->at_hdr.s_id[0] << 16) | (aep->at_hdr.s_id[1] <<  8) | 
(aep->at_hdr.s_id[2]);
-
-   /* Channel has to derived from D_ID */
did = (aep->at_hdr.d_id[0] << 16) | (aep->at_hdr.d_id[1] << 8) | 
aep->at_hdr.d_id[2];
-   for (chan = 0; chan < isp->isp_nchan; chan++) {
-   if (FCPARAM(isp, chan)->isp_portid == did) {
-   break;
+   if (ISP_CAP_MULTI_ID(isp) && isp->isp_nchan > 1) {
+   /* Channel has to be derived from D_ID */
+   isp_find_chan_by_did(isp, did, );
+   if (chan == ISP_NOCHAN) {
+   isp_prt(isp, ISP_LOGWARN, "%s: D_ID 0x%x not found on 
any channel", __func__, did);
+   /* just drop on the floor */
+   return;
}
-   }
-   if (chan == isp->isp_nchan) {
-   isp_prt(isp, ISP_LOGWARN, "%s: D_ID 0x%x not found on any 
channel", __func__, did);
-   /* just drop on the floor */
-   return;
+   } else {
+   chan = 0;
}
notify.nt_nphdl = NIL_HANDLE; /* unknown here */
notify.nt_sid = sid;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2016-05-18 Thread Warner Losh
Ditto with mips.

On Wed, May 18, 2016 at 9:50 AM, Justin Hibbits 
wrote:

> On Wed, 18 May 2016 15:45:12 + (UTC)
> Scott Long  wrote:
>
> > Author: scottl
> > Date: Wed May 18 15:45:12 2016
> > New Revision: 300154
> > URL: https://svnweb.freebsd.org/changeset/base/300154
> >
> > Log:
> >   Activate the NO_64BIT_ATOMICS code for mips and powerpc
> >
> > Modified:
> >   head/sys/net/mp_ring.c
> >
> > Modified: head/sys/net/mp_ring.c
> >
> ==
> > --- head/sys/net/mp_ring.cWed May 18 15:44:45 2016
> > (r300153) +++ head/sys/net/mp_ring.c  Wed May 18 15:45:12
> > 2016  (r300154) @@ -37,15 +37,17 @@ __FBSDID("$FreeBSD$");
> >  #include 
> >  #include 
> >
> > -
> > -
> > -#include 
> > +#if defined(__powerpc__) || defined(__mips__)
> > +#define NO_64BIT_ATOMICS
> > +#endif
> >
> >  #if defined(__i386__)
> >  #define atomic_cmpset_acq_64 atomic_cmpset_64
> >  #define atomic_cmpset_rel_64 atomic_cmpset_64
> >  #endif
> >
> > +#include 
> > +
> >  union ring_state {
> >   struct {
> >   uint16_t pidx_head;
> >
>
> powerpc64 defines both __powerpc__ and __powerpc64__, so you're killing
> atomics on powerpc64 with this.
>
> - Justin
>
>
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r300156 - head/sys/boot/common

2016-05-18 Thread Warner Losh
Author: imp
Date: Wed May 18 15:57:13 2016
New Revision: 300156
URL: https://svnweb.freebsd.org/changeset/base/300156

Log:
  Fix typo.
  
  Spotted by: Matteo Riondato

Modified:
  head/sys/boot/common/commands.c

Modified: head/sys/boot/common/commands.c
==
--- head/sys/boot/common/commands.c Wed May 18 15:50:52 2016
(r300155)
+++ head/sys/boot/common/commands.c Wed May 18 15:57:13 2016
(r300156)
@@ -217,7 +217,7 @@ COMMAND_SET(commandlist, "?", "list comm
  * unconditionally prints some commands. This will lead to anomalous
  * behavior. There's no 'pager_output' binding to FORTH to allow
  * things to work right, so I'm documenting the bug rather than
- * fixnig it.
+ * fixing it.
  */
 static int
 command_commandlist(int argc, char *argv[])
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2016-05-18 Thread Justin Hibbits
On Wed, 18 May 2016 15:45:12 + (UTC)
Scott Long  wrote:

> Author: scottl
> Date: Wed May 18 15:45:12 2016
> New Revision: 300154
> URL: https://svnweb.freebsd.org/changeset/base/300154
> 
> Log:
>   Activate the NO_64BIT_ATOMICS code for mips and powerpc
> 
> Modified:
>   head/sys/net/mp_ring.c
> 
> Modified: head/sys/net/mp_ring.c
> ==
> --- head/sys/net/mp_ring.cWed May 18 15:44:45 2016
> (r300153) +++ head/sys/net/mp_ring.c  Wed May 18 15:45:12
> 2016  (r300154) @@ -37,15 +37,17 @@ __FBSDID("$FreeBSD$");
>  #include 
>  #include 
>  
> -
> -
> -#include 
> +#if defined(__powerpc__) || defined(__mips__)
> +#define NO_64BIT_ATOMICS
> +#endif
>  
>  #if defined(__i386__)
>  #define atomic_cmpset_acq_64 atomic_cmpset_64
>  #define atomic_cmpset_rel_64 atomic_cmpset_64
>  #endif
>  
> +#include 
> +
>  union ring_state {
>   struct {
>   uint16_t pidx_head;
> 

powerpc64 defines both __powerpc__ and __powerpc64__, so you're killing
atomics on powerpc64 with this.

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


svn commit: r300155 - head/sys/net

2016-05-18 Thread Bjoern A. Zeeb
Author: bz
Date: Wed May 18 15:50:52 2016
New Revision: 300155
URL: https://svnweb.freebsd.org/changeset/base/300155

Log:
  Add a "vnet_state" field to struct vnet.
  This is set to the SI_SUB_* value before executing any VNET_SYSINIT
  or VNET_SYSUNINT.  While good for debugging especially VNET teardown
  problems having a chance to know at which level during teardown we are,
  it will also be used to identify to detcted a "stable state"
  (as in fully up and running) later on.
  
  Obtained from:projects/vnet
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/net/vnet.c
  head/sys/net/vnet.h

Modified: head/sys/net/vnet.c
==
--- head/sys/net/vnet.c Wed May 18 15:45:12 2016(r300154)
+++ head/sys/net/vnet.c Wed May 18 15:50:52 2016(r300155)
@@ -233,6 +233,7 @@ vnet_alloc(void)
SDT_PROBE1(vnet, functions, vnet_alloc, entry, __LINE__);
vnet = malloc(sizeof(struct vnet), M_VNET, M_WAITOK | M_ZERO);
vnet->vnet_magic_n = VNET_MAGIC_N;
+   vnet->vnet_state = 0;
SDT_PROBE2(vnet, functions, vnet_alloc, alloc, __LINE__, vnet);
 
/*
@@ -581,6 +582,7 @@ vnet_sysinit(void)
 
VNET_SYSINIT_RLOCK();
TAILQ_FOREACH(vs, _constructors, link) {
+   curvnet->vnet_state = vs->subsystem;
vs->func(vs->arg);
}
VNET_SYSINIT_RUNLOCK();
@@ -599,6 +601,7 @@ vnet_sysuninit(void)
VNET_SYSINIT_RLOCK();
TAILQ_FOREACH_REVERSE(vs, _destructors, vnet_sysuninit_head,
link) {
+   curvnet->vnet_state = vs->subsystem;
vs->func(vs->arg);
}
VNET_SYSINIT_RUNLOCK();
@@ -714,6 +717,7 @@ db_vnet_print(struct vnet *vnet)
db_printf(" vnet_data_mem  = %p\n", vnet->vnet_data_mem);
db_printf(" vnet_data_base = %#jx\n",
(uintmax_t)vnet->vnet_data_base);
+   db_printf(" vnet_state = %#08x\n", vnet->vnet_state);
db_printf("\n");
 }
 

Modified: head/sys/net/vnet.h
==
--- head/sys/net/vnet.h Wed May 18 15:45:12 2016(r300154)
+++ head/sys/net/vnet.h Wed May 18 15:50:52 2016(r300155)
@@ -70,6 +70,7 @@ struct vnet {
u_intvnet_magic_n;
u_intvnet_ifcnt;
u_intvnet_sockcnt;
+   u_intvnet_state;/* SI_SUB_* */
void*vnet_data_mem;
uintptr_tvnet_data_base;
 };
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r300154 - head/sys/net

2016-05-18 Thread Scott Long
Author: scottl
Date: Wed May 18 15:45:12 2016
New Revision: 300154
URL: https://svnweb.freebsd.org/changeset/base/300154

Log:
  Activate the NO_64BIT_ATOMICS code for mips and powerpc

Modified:
  head/sys/net/mp_ring.c

Modified: head/sys/net/mp_ring.c
==
--- head/sys/net/mp_ring.c  Wed May 18 15:44:45 2016(r300153)
+++ head/sys/net/mp_ring.c  Wed May 18 15:45:12 2016(r300154)
@@ -37,15 +37,17 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-
-
-#include 
+#if defined(__powerpc__) || defined(__mips__)
+#define NO_64BIT_ATOMICS
+#endif
 
 #if defined(__i386__)
 #define atomic_cmpset_acq_64 atomic_cmpset_64
 #define atomic_cmpset_rel_64 atomic_cmpset_64
 #endif
 
+#include 
+
 union ring_state {
struct {
uint16_t pidx_head;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r300153 - head/sys/net

2016-05-18 Thread Scott Long
Author: scottl
Date: Wed May 18 15:44:45 2016
New Revision: 300153
URL: https://svnweb.freebsd.org/changeset/base/300153

Log:
  Remove assertions that don't make sense for the data type.

Modified:
  head/sys/net/iflib.c

Modified: head/sys/net/iflib.c
==
--- head/sys/net/iflib.cWed May 18 15:25:45 2016(r300152)
+++ head/sys/net/iflib.cWed May 18 15:44:45 2016(r300153)
@@ -1534,7 +1534,6 @@ _iflib_fl_refill(if_ctx_t ctx, iflib_fl_
 
n  = count;
MPASS(n > 0);
-   MPASS(fl->ifl_credits >= 0);
MPASS(fl->ifl_credits + n <= fl->ifl_size);
 
if (pidx < fl->ifl_cidx)
@@ -1663,7 +1662,6 @@ iflib_fl_bufs_free(iflib_fl_t fl)
iflib_dma_info_t idi = fl->ifl_ifdi;
uint32_t i;
 
-   MPASS(fl->ifl_credits >= 0);
for (i = 0; i < fl->ifl_size; i++) {
iflib_rxsd_t d = >ifl_sds[i];
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r300151 - head/sys/net

2016-05-18 Thread Bjoern A. Zeeb
Author: bz
Date: Wed May 18 15:25:19 2016
New Revision: 300151
URL: https://svnweb.freebsd.org/changeset/base/300151

Log:
  Add a dummy VNET_SYSINIT that will make sure all VNETs started will
  always end on SI_SUB_VNET_DONE.
  
  Obtained from:projects/vnet
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/net/vnet.c

Modified: head/sys/net/vnet.c
==
--- head/sys/net/vnet.c Wed May 18 15:18:18 2016(r300150)
+++ head/sys/net/vnet.c Wed May 18 15:25:19 2016(r300151)
@@ -358,6 +358,16 @@ vnet_data_startup(void *dummy __unused)
 }
 SYSINIT(vnet_data, SI_SUB_KLD, SI_ORDER_FIRST, vnet_data_startup, 0);
 
+/* Dummy VNET_SYSINIT to make sure we always reach the final end state. */
+static void
+vnet_sysinit_done(void *unused __unused)
+{
+
+   return;
+}
+VNET_SYSINIT(vnet_sysinit_done, SI_SUB_VNET_DONE, SI_ORDER_ANY,
+vnet_sysinit_done, NULL);
+
 /*
  * When a module is loaded and requires storage for a virtualized global
  * variable, allocate space from the modspace free list.  This interface
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r300152 - head/lib/libutil

2016-05-18 Thread Pedro F. Giffuni
Author: pfg
Date: Wed May 18 15:25:45 2016
New Revision: 300152
URL: https://svnweb.freebsd.org/changeset/base/300152

Log:
  libutil: minor spelling fixes.

Modified:
  head/lib/libutil/login_auth.c
  head/lib/libutil/login_cap.c
  head/lib/libutil/pidfile.3
  head/lib/libutil/pidfile.c

Modified: head/lib/libutil/login_auth.c
==
--- head/lib/libutil/login_auth.c   Wed May 18 15:25:19 2016
(r300151)
+++ head/lib/libutil/login_auth.c   Wed May 18 15:25:45 2016
(r300152)
@@ -55,7 +55,7 @@ __FBSDID("$FreeBSD$");
 
 /*
  * auth_checknologin()
- * Checks for the existance of a nologin file in the login_cap
+ * Checks for the existence of a nologin file in the login_cap
  * capability .  If there isn't one specified, then it checks
  * to see if this class should just ignore nologin files.  Lastly,
  * it tries to print out the default nologin file, and, if such

Modified: head/lib/libutil/login_cap.c
==
--- head/lib/libutil/login_cap.cWed May 18 15:25:19 2016
(r300151)
+++ head/lib/libutil/login_cap.cWed May 18 15:25:45 2016
(r300152)
@@ -742,7 +742,7 @@ login_getcapsize(login_cap_t *lc, const 
 
 /*
  * login_getcapbool()
- * From the login_cap_t , check for the existance of the capability
+ * From the login_cap_t , check for the existence of the capability
  * of .  Return  if ->lc_cap is NULL, otherwise return
  * the whether or not  exists there.
  */

Modified: head/lib/libutil/pidfile.3
==
--- head/lib/libutil/pidfile.3  Wed May 18 15:25:19 2016(r300151)
+++ head/lib/libutil/pidfile.3  Wed May 18 15:25:45 2016(r300152)
@@ -151,7 +151,7 @@ if (pfh == NULL) {
/* If we cannot create pidfile from other reasons, only warn. */
warn("Cannot open or create pidfile");
/*
-* Eventhough pfh is NULL we can continue, as the other pidfile_*
+* Even though pfh is NULL we can continue, as the other pidfile_*
 * function can handle such situation by doing nothing except setting
 * errno to EDOOFUS.
 */

Modified: head/lib/libutil/pidfile.c
==
--- head/lib/libutil/pidfile.c  Wed May 18 15:25:19 2016(r300151)
+++ head/lib/libutil/pidfile.c  Wed May 18 15:25:45 2016(r300152)
@@ -119,7 +119,7 @@ pidfile_open(const char *path, mode_t mo
 
/*
 * Open the PID file and obtain exclusive lock.
-* We truncate PID file here only to remove old PID immediatelly,
+* We truncate PID file here only to remove old PID immediately,
 * PID file will be truncated again in pidfile_write(), so
 * pidfile_write() can be called multiple times.
 */
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r300149 - in head/sys: arm/allwinner arm/allwinner/a10 arm/arm arm/broadcom/bcm2835 arm/mv arm/nvidia arm/ti arm/ti/omap4 arm64/arm64 kern mips/mediatek mips/mips sys

2016-05-18 Thread Andrew Turner
On Wed, 18 May 2016 17:15:10 +0200
Zbigniew Bodek  wrote:

> 2016-05-18 17:05 GMT+02:00 Andrew Turner :
...
> >  #ifdef INTRNG
> > xref = OF_xref_from_node(ofw_bus_get_node(dev));
> > -   if (intr_pic_register(dev, xref) != 0) {
> > +   if (intr_pic_register(dev, xref) == NULL) {
> > device_printf(dev, "could not register PIC\n");
> > goto error;
> > }
> > @@ -172,7 +172,7 @@ error:
> > /* Failure so free resources */
> > gic_v3_detach(dev);
> >
> > -   return (err);
> > +   return (ENXIO);
> >  
> 
> 
> Few line above we have:
> err = gic_v3_attach(dev);
> if (err != 0)
> goto error;
> 
> So now we would not return error code from gic_v3_attach() but always
> ENXIO...

The error value doesn't matter, as long as it's non-zero. This also
fixes the return value in the intrng case if either of
intr_pic_register or intr_pic_claim_root fail. You might get a little
information from the return value being printed, however it would be
more useful to have verbose logging to print an error message.

In all of these failure cases there isn't much we can do as there is no
root interrupt controller, the boot will fail later on when we enable
interrupts.

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


Re: svn commit: r300149 - in head/sys: arm/allwinner arm/allwinner/a10 arm/arm arm/broadcom/bcm2835 arm/mv arm/nvidia arm/ti arm/ti/omap4 arm64/arm64 kern mips/mediatek mips/mips sys

2016-05-18 Thread Zbigniew Bodek
2016-05-18 17:05 GMT+02:00 Andrew Turner :

> Author: andrew
> Date: Wed May 18 15:05:44 2016
> New Revision: 300149
> URL: https://svnweb.freebsd.org/changeset/base/300149
>
> Log:
>   Return the struct intr_pic pointer from intr_pic_register. This will be
>   needed in later changes where we may not be able to lock the pic list
> lock
>   to perform a lookup, e.g. from within interrupt context.
>
>   Obtained from:ABT Systems Ltd
>   Sponsored by: The FreeBSD Foundation
>
> Modified:
>   head/sys/arm/allwinner/a10/a10_intc.c
>   head/sys/arm/allwinner/aw_nmi.c
>   head/sys/arm/arm/gic.c
>   head/sys/arm/broadcom/bcm2835/bcm2835_gpio.c
>   head/sys/arm/broadcom/bcm2835/bcm2835_intr.c
>   head/sys/arm/broadcom/bcm2835/bcm2836.c
>   head/sys/arm/mv/mpic.c
>   head/sys/arm/nvidia/tegra_gpio.c
>   head/sys/arm/nvidia/tegra_lic.c
>   head/sys/arm/ti/aintc.c
>   head/sys/arm/ti/omap4/omap4_wugen.c
>   head/sys/arm/ti/ti_gpio.c
>   head/sys/arm64/arm64/gic_v3_fdt.c
>   head/sys/kern/subr_intr.c
>   head/sys/mips/mediatek/mtk_gpio_v1.c
>   head/sys/mips/mediatek/mtk_gpio_v2.c
>   head/sys/mips/mediatek/mtk_intr_gic.c
>   head/sys/mips/mediatek/mtk_intr_v1.c
>   head/sys/mips/mediatek/mtk_intr_v2.c
>   head/sys/mips/mediatek/mtk_pcie.c
>   head/sys/mips/mips/mips_pic.c
>   head/sys/sys/intr.h
>
> Modified: head/sys/arm/allwinner/a10/a10_intc.c
>
> ==
> --- head/sys/arm/allwinner/a10/a10_intc.c   Wed May 18 14:43:17 2016
>   (r300148)
> +++ head/sys/arm/allwinner/a10/a10_intc.c   Wed May 18 15:05:44 2016
>   (r300149)
> @@ -250,6 +250,7 @@ a10_intr(void *arg)
>  static int
>  a10_intr_pic_attach(struct a10_aintc_softc *sc)
>  {
> +   struct intr_pic *pic;
> int error;
> uint32_t irq;
> const char *name;
> @@ -266,9 +267,9 @@ a10_intr_pic_attach(struct a10_aintc_sof
> }
>
> xref = OF_xref_from_node(ofw_bus_get_node(sc->sc_dev));
> -   error = intr_pic_register(sc->sc_dev, xref);
> -   if (error != 0)
> -   return (error);
> +   pic = intr_pic_register(sc->sc_dev, xref);
> +   if (pic == NULL)
> +   return (ENXIO);
>
> return (intr_pic_claim_root(sc->sc_dev, xref, a10_intr, sc, 0));
>  }
>
> Modified: head/sys/arm/allwinner/aw_nmi.c
>
> ==
> --- head/sys/arm/allwinner/aw_nmi.c Wed May 18 14:43:17 2016
> (r300148)
> +++ head/sys/arm/allwinner/aw_nmi.c Wed May 18 15:05:44 2016
> (r300149)
> @@ -362,7 +362,7 @@ aw_nmi_attach(device_t dev)
>   device_get_nameunit(sc->dev), sc->intr.irq) != 0)
> goto error;
>
> -   if (intr_pic_register(dev, (intptr_t)xref) != 0) {
> +   if (intr_pic_register(dev, (intptr_t)xref) == NULL) {
> device_printf(dev, "could not register pic\n");
> goto error;
> }
>
> Modified: head/sys/arm/arm/gic.c
>
> ==
> --- head/sys/arm/arm/gic.c  Wed May 18 14:43:17 2016(r300148)
> +++ head/sys/arm/arm/gic.c  Wed May 18 15:05:44 2016(r300149)
> @@ -711,7 +711,7 @@ arm_gic_attach(device_t dev)
>  * Now, when everything is initialized, it's right time to
>  * register interrupt controller to interrupt framefork.
>  */
> -   if (intr_pic_register(dev, xref) != 0) {
> +   if (intr_pic_register(dev, xref) == NULL) {
> device_printf(dev, "could not register PIC\n");
> goto cleanup;
> }
>
> Modified: head/sys/arm/broadcom/bcm2835/bcm2835_gpio.c
>
> ==
> --- head/sys/arm/broadcom/bcm2835/bcm2835_gpio.cWed May 18
> 14:43:17 2016(r300148)
> +++ head/sys/arm/broadcom/bcm2835/bcm2835_gpio.cWed May 18
> 15:05:44 2016(r300149)
> @@ -1045,8 +1045,11 @@ bcm_gpio_pic_attach(struct bcm_gpio_soft
> if (error != 0)
> return (error); /* XXX deregister ISRCs */
> }
> -   return (intr_pic_register(sc->sc_dev,
> -   OF_xref_from_node(ofw_bus_get_node(sc->sc_dev;
> +   if (intr_pic_register(sc->sc_dev,
> +   OF_xref_from_node(ofw_bus_get_node(sc->sc_dev))) == NULL)
> +   return (ENXIO);
> +
> +   return (0);
>  }
>
>  static int
>
> Modified: head/sys/arm/broadcom/bcm2835/bcm2835_intr.c
>
> ==
> --- head/sys/arm/broadcom/bcm2835/bcm2835_intr.cWed May 18
> 14:43:17 2016(r300148)
> +++ head/sys/arm/broadcom/bcm2835/bcm2835_intr.cWed May 18
> 15:05:44 2016(r300149)
> @@ -341,7 +341,10 @@ bcm_intc_pic_register(struct bcm_intc_so
> if (error != 0)
> return 

svn commit: r300150 - head/sys/boot/efi/loader

2016-05-18 Thread Pedro F. Giffuni
Author: pfg
Date: Wed May 18 15:18:18 2016
New Revision: 300150
URL: https://svnweb.freebsd.org/changeset/base/300150

Log:
  Minor spelling fixes.

Modified:
  head/sys/boot/efi/loader/Makefile

Modified: head/sys/boot/efi/loader/Makefile
==
--- head/sys/boot/efi/loader/Makefile   Wed May 18 15:05:44 2016
(r300149)
+++ head/sys/boot/efi/loader/Makefile   Wed May 18 15:18:18 2016
(r300150)
@@ -35,10 +35,10 @@ CWARNFLAGS.zfs.c+=  -Wno-missing-prototyp
 # The printf in libstand implements CHAR16 strings always.
 CWARNFLAGS.main.c+=-Wno-format
 
-# We implement a slightly non-stadard %S in that it always takes a
-# CHAR16 that's common in UEFI-land instaed of a wchar_t. This only
-# seems to matter on arm64 where wchar_t defaults to a int instead of
-# a short. There's no good cast to use here, so just ignore the
+# We implement a slightly non-standard %S in that it always takes a
+# CHAR16 that's common in UEFI-land instead of a wchar_t. This only
+# seems to matter on arm64 where wchar_t defaults to an int instead
+# of a short. There's no good cast to use here so just ignore the
 # warnings for now.
 CWARNFLAGS.main.c+=-Wno-format
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r300098 - head/usr.sbin/makefs

2016-05-18 Thread Pedro Giffuni


On 05/17/16 20:12, Ed Maste wrote:

On 18 May 2016 at 00:22, Pedro F. Giffuni  wrote:

Author: pfg
Date: Wed May 18 00:22:52 2016
New Revision: 300098
URL: https://svnweb.freebsd.org/changeset/base/300098

Log:
  makefs(8): Clarify the comment concerning seeding.

  Avoid giving the impression makefs currently supports reproduceable
  builds.


Thanks!

It might make sense to seed based on SOURCE_DATE_EPOCH
(https://reproducible-builds.org/specs/source-date-epoch/) if set, and
later on we ought to add an option to set the seed on the command
line.



Interesting. FWIW, NetBSD did some other changes but they basically
removed the seeding which may be mildly dangerous in this case
(makefs uses random() in other places without seeding).


But, there are a lot of other reproducible build tasks that are
probably more important to tackle before this.



Yes, I am not really very interested in reproducible builds but this
is one of the cases where we cannot go blindly replacing random()
with arc4random().

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


svn commit: r300149 - in head/sys: arm/allwinner arm/allwinner/a10 arm/arm arm/broadcom/bcm2835 arm/mv arm/nvidia arm/ti arm/ti/omap4 arm64/arm64 kern mips/mediatek mips/mips sys

2016-05-18 Thread Andrew Turner
Author: andrew
Date: Wed May 18 15:05:44 2016
New Revision: 300149
URL: https://svnweb.freebsd.org/changeset/base/300149

Log:
  Return the struct intr_pic pointer from intr_pic_register. This will be
  needed in later changes where we may not be able to lock the pic list lock
  to perform a lookup, e.g. from within interrupt context.
  
  Obtained from:ABT Systems Ltd
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/arm/allwinner/a10/a10_intc.c
  head/sys/arm/allwinner/aw_nmi.c
  head/sys/arm/arm/gic.c
  head/sys/arm/broadcom/bcm2835/bcm2835_gpio.c
  head/sys/arm/broadcom/bcm2835/bcm2835_intr.c
  head/sys/arm/broadcom/bcm2835/bcm2836.c
  head/sys/arm/mv/mpic.c
  head/sys/arm/nvidia/tegra_gpio.c
  head/sys/arm/nvidia/tegra_lic.c
  head/sys/arm/ti/aintc.c
  head/sys/arm/ti/omap4/omap4_wugen.c
  head/sys/arm/ti/ti_gpio.c
  head/sys/arm64/arm64/gic_v3_fdt.c
  head/sys/kern/subr_intr.c
  head/sys/mips/mediatek/mtk_gpio_v1.c
  head/sys/mips/mediatek/mtk_gpio_v2.c
  head/sys/mips/mediatek/mtk_intr_gic.c
  head/sys/mips/mediatek/mtk_intr_v1.c
  head/sys/mips/mediatek/mtk_intr_v2.c
  head/sys/mips/mediatek/mtk_pcie.c
  head/sys/mips/mips/mips_pic.c
  head/sys/sys/intr.h

Modified: head/sys/arm/allwinner/a10/a10_intc.c
==
--- head/sys/arm/allwinner/a10/a10_intc.c   Wed May 18 14:43:17 2016
(r300148)
+++ head/sys/arm/allwinner/a10/a10_intc.c   Wed May 18 15:05:44 2016
(r300149)
@@ -250,6 +250,7 @@ a10_intr(void *arg)
 static int
 a10_intr_pic_attach(struct a10_aintc_softc *sc)
 {
+   struct intr_pic *pic;
int error;
uint32_t irq;
const char *name;
@@ -266,9 +267,9 @@ a10_intr_pic_attach(struct a10_aintc_sof
}
 
xref = OF_xref_from_node(ofw_bus_get_node(sc->sc_dev));
-   error = intr_pic_register(sc->sc_dev, xref);
-   if (error != 0)
-   return (error);
+   pic = intr_pic_register(sc->sc_dev, xref);
+   if (pic == NULL)
+   return (ENXIO);
 
return (intr_pic_claim_root(sc->sc_dev, xref, a10_intr, sc, 0));
 }

Modified: head/sys/arm/allwinner/aw_nmi.c
==
--- head/sys/arm/allwinner/aw_nmi.c Wed May 18 14:43:17 2016
(r300148)
+++ head/sys/arm/allwinner/aw_nmi.c Wed May 18 15:05:44 2016
(r300149)
@@ -362,7 +362,7 @@ aw_nmi_attach(device_t dev)
  device_get_nameunit(sc->dev), sc->intr.irq) != 0)
goto error;
 
-   if (intr_pic_register(dev, (intptr_t)xref) != 0) {
+   if (intr_pic_register(dev, (intptr_t)xref) == NULL) {
device_printf(dev, "could not register pic\n");
goto error;
}

Modified: head/sys/arm/arm/gic.c
==
--- head/sys/arm/arm/gic.c  Wed May 18 14:43:17 2016(r300148)
+++ head/sys/arm/arm/gic.c  Wed May 18 15:05:44 2016(r300149)
@@ -711,7 +711,7 @@ arm_gic_attach(device_t dev)
 * Now, when everything is initialized, it's right time to
 * register interrupt controller to interrupt framefork.
 */
-   if (intr_pic_register(dev, xref) != 0) {
+   if (intr_pic_register(dev, xref) == NULL) {
device_printf(dev, "could not register PIC\n");
goto cleanup;
}

Modified: head/sys/arm/broadcom/bcm2835/bcm2835_gpio.c
==
--- head/sys/arm/broadcom/bcm2835/bcm2835_gpio.cWed May 18 14:43:17 
2016(r300148)
+++ head/sys/arm/broadcom/bcm2835/bcm2835_gpio.cWed May 18 15:05:44 
2016(r300149)
@@ -1045,8 +1045,11 @@ bcm_gpio_pic_attach(struct bcm_gpio_soft
if (error != 0)
return (error); /* XXX deregister ISRCs */
}
-   return (intr_pic_register(sc->sc_dev,
-   OF_xref_from_node(ofw_bus_get_node(sc->sc_dev;
+   if (intr_pic_register(sc->sc_dev,
+   OF_xref_from_node(ofw_bus_get_node(sc->sc_dev))) == NULL)
+   return (ENXIO);
+
+   return (0);
 }
 
 static int

Modified: head/sys/arm/broadcom/bcm2835/bcm2835_intr.c
==
--- head/sys/arm/broadcom/bcm2835/bcm2835_intr.cWed May 18 14:43:17 
2016(r300148)
+++ head/sys/arm/broadcom/bcm2835/bcm2835_intr.cWed May 18 15:05:44 
2016(r300149)
@@ -341,7 +341,10 @@ bcm_intc_pic_register(struct bcm_intc_so
if (error != 0)
return (error);
}
-   return (intr_pic_register(sc->sc_dev, xref));
+   if (intr_pic_register(sc->sc_dev, xref) == NULL)
+   return (ENXIO);
+
+   return (0);
 }
 #endif
 

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

svn commit: r300148 - in head: share/man/man4 sys/net

2016-05-18 Thread Bjoern A. Zeeb
Author: bz
Date: Wed May 18 14:43:17 2016
New Revision: 300148
URL: https://svnweb.freebsd.org/changeset/base/300148

Log:
  Split 'show vnets' into 'show vnet' and 'show all vnets'.
  While here adjust some db_printf format string.
  
  Document the two show commands in ddb.4.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  head/share/man/man4/ddb.4
  head/sys/net/vnet.c

Modified: head/share/man/man4/ddb.4
==
--- head/share/man/man4/ddb.4   Wed May 18 14:18:03 2016(r300147)
+++ head/share/man/man4/ddb.4   Wed May 18 14:43:17 2016(r300148)
@@ -60,7 +60,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd January 15, 2016
+.Dd May 18, 2016
 .Dt DDB 4
 .Os
 .Sh NAME
@@ -542,6 +542,11 @@ Output is similar to
 but also includes the address of the TTY structure.
 .\"
 .Pp
+.It Ic show Cm all vnets
+Show the same output as "show vnet" does, but lists all
+virtualized network stacks within the system.
+.\"
+.Pp
 .It Ic show Cm allchains
 Show the same information like "show lockchain" does, but
 for every thread in the system.
@@ -1060,6 +1065,13 @@ Currently, it is not possible to use thi
 is compiled in the kernel.
 .\"
 .Pp
+.It Ic show Cm vnet Ar addr
+Prints virtualized network stack
+.Vt struct vnet
+structure present at the address
+.Ar addr .
+.\"
+.Pp
 .It Ic show Cm vnode Op Ar addr
 Prints vnode
 .Vt struct vnode

Modified: head/sys/net/vnet.c
==
--- head/sys/net/vnet.c Wed May 18 14:18:03 2016(r300147)
+++ head/sys/net/vnet.c Wed May 18 14:43:17 2016(r300148)
@@ -690,27 +690,45 @@ vnet_log_recursion(struct vnet *old_vnet
  * DDB(4).
  */
 #ifdef DDB
-DB_SHOW_COMMAND(vnets, db_show_vnets)
+static void
+db_vnet_print(struct vnet *vnet)
+{
+
+   db_printf("vnet= %p\n", vnet);
+   db_printf(" vnet_magic_n   = %#08x (%s, orig %#08x)\n",
+   vnet->vnet_magic_n,
+   (vnet->vnet_magic_n == VNET_MAGIC_N) ?
+   "ok" : "mismatch", VNET_MAGIC_N);
+   db_printf(" vnet_ifcnt = %u\n", vnet->vnet_ifcnt);
+   db_printf(" vnet_sockcnt   = %u\n", vnet->vnet_sockcnt);
+   db_printf(" vnet_data_mem  = %p\n", vnet->vnet_data_mem);
+   db_printf(" vnet_data_base = %#jx\n",
+   (uintmax_t)vnet->vnet_data_base);
+   db_printf("\n");
+}
+
+DB_SHOW_ALL_COMMAND(vnets, db_show_all_vnets)
 {
VNET_ITERATOR_DECL(vnet_iter);
 
VNET_FOREACH(vnet_iter) {
-   db_printf("vnet= %p\n", vnet_iter);
-   db_printf(" vnet_magic_n   = 0x%x (%s, orig 0x%x)\n",
-   vnet_iter->vnet_magic_n,
-   (vnet_iter->vnet_magic_n == VNET_MAGIC_N) ?
-   "ok" : "mismatch", VNET_MAGIC_N);
-   db_printf(" vnet_ifcnt = %u\n", vnet_iter->vnet_ifcnt);
-   db_printf(" vnet_sockcnt   = %u\n", vnet_iter->vnet_sockcnt);
-   db_printf(" vnet_data_mem  = %p\n", vnet_iter->vnet_data_mem);
-   db_printf(" vnet_data_base = 0x%jx\n",
-   (uintmax_t)vnet_iter->vnet_data_base);
-   db_printf("\n");
+   db_vnet_print(vnet_iter);
if (db_pager_quit)
break;
}
 }
 
+DB_SHOW_COMMAND(vnet, db_show_vnet)
+{
+
+   if (!have_addr) {
+   db_printf("usage: show vnet \n");
+   return;
+   }
+
+   db_vnet_print((struct vnet *)addr);
+}
+
 static void
 db_show_vnet_print_vs(struct vnet_sysinit *vs, int ddb)
 {
@@ -734,7 +752,7 @@ db_show_vnet_print_vs(struct vnet_sysini
sym = db_search_symbol((vm_offset_t)vs->func, DB_STGY_PROC, );
db_symbol_values(sym, , NULL);
xprint("%s(%p)\n", (vsname != NULL) ? vsname : "", vs);
-   xprint("  0x%08x 0x%08x\n", vs->subsystem, vs->order);
+   xprint("  %#08x %#08x\n", vs->subsystem, vs->order);
xprint("  %p(%s)(%p)\n",
vs->func, (funcname != NULL) ? funcname : "", vs->arg);
 #undef xprint
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r300147 - head/sys/net

2016-05-18 Thread Bjoern A. Zeeb
Author: bz
Date: Wed May 18 14:18:03 2016
New Revision: 300147
URL: https://svnweb.freebsd.org/changeset/base/300147

Log:
  Make compile without INET or without IP support in the kernel by hiding
  variables and lro function calls behind approriate #ifdefs.
  
  Also move the #includes for "opt_*" to the place where they should be.

Modified:
  head/sys/net/iflib.c

Modified: head/sys/net/iflib.c
==
--- head/sys/net/iflib.cWed May 18 14:09:56 2016(r300146)
+++ head/sys/net/iflib.cWed May 18 14:18:03 2016(r300147)
@@ -28,6 +28,10 @@
 #include 
 __FBSDID("$FreeBSD$");
 
+#include "opt_inet.h"
+#include "opt_inet6.h"
+#include "opt_acpi.h"
+
 #include 
 #include 
 #include 
@@ -77,11 +81,6 @@ __FBSDID("$FreeBSD$");
 
 #include 
 
-
-#include "opt_inet.h"
-#include "opt_inet6.h"
-#include "opt_acpi.h"
-
 #include "ifdi_if.h"
 
 #if defined(__i386__) || defined(__amd64__)
@@ -2158,8 +2157,10 @@ iflib_rxeof(iflib_rxq_t rxq, int budget)
m->m_nextpkt = NULL;
rx_bytes += m->m_pkthdr.len;
rx_pkts++;
+#if defined(INET6) || defined(INET)
if (lro_enabled && tcp_lro_rx(>ifr_lc, m, 0) == 0)
continue;
+#endif
DBG_COUNTER_INC(rx_if_input);
ifp->if_input(ifp, m);
}
@@ -2171,7 +2172,9 @@ iflib_rxeof(iflib_rxq_t rxq, int budget)
 */
while ((queued = LIST_FIRST(>ifr_lc.lro_active)) != NULL) {
LIST_REMOVE(queued, next);
+#if defined(INET6) || defined(INET)
tcp_lro_flush(>ifr_lc, queued);
+#endif
}
return (iflib_rxd_avail(ctx, rxq, *cidxp));
 }
@@ -2232,7 +2235,7 @@ static int
 iflib_parse_header(iflib_txq_t txq, if_pkt_info_t pi, struct mbuf **mp)
 {
struct ether_vlan_header *eh;
-   struct mbuf *m, *n;
+   struct mbuf *m;
 
m = *mp;
/*
@@ -2260,6 +2263,7 @@ iflib_parse_header(iflib_txq_t txq, if_p
{
struct ip *ip = NULL;
struct tcphdr *th = NULL;
+   struct mbuf *n;
int minthlen;
 
minthlen = min(m->m_pkthdr.len, pi->ipi_ehdrlen + sizeof(*ip) + 
sizeof(*th));
@@ -4085,9 +4089,13 @@ static int
 iflib_rx_structures_setup(if_ctx_t ctx)
 {
iflib_rxq_t rxq = ctx->ifc_rxqs;
-   int i,  q, err;
+   int q;
+#if defined(INET6) || defined(INET)
+   int i, err;
+#endif
 
for (q = 0; q < ctx->ifc_softc_ctx.isc_nrxqsets; q++, rxq++) {
+#if defined(INET6) || defined(INET)
tcp_lro_free(>ifr_lc);
if ((err = tcp_lro_init(>ifr_lc)) != 0) {
device_printf(ctx->ifc_dev, "LRO Initialization 
failed!\n");
@@ -4095,9 +4103,11 @@ iflib_rx_structures_setup(if_ctx_t ctx)
}
rxq->ifr_lro_enabled = TRUE;
rxq->ifr_lc.ifp = ctx->ifc_ifp;
+#endif
IFDI_RXQ_SETUP(ctx, rxq->ifr_id);
}
return (0);
+#if defined(INET6) || defined(INET)
 fail:
/*
 * Free RX software descriptors allocated so far, we will only handle
@@ -4110,6 +4120,7 @@ fail:
rxq->ifr_cq_gen = rxq->ifr_cq_cidx = rxq->ifr_cq_pidx = 0;
}
return (err);
+#endif
 }
 
 /*
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r300146 - head/sys/boot/common

2016-05-18 Thread Warner Losh
Author: imp
Date: Wed May 18 14:09:56 2016
New Revision: 300146
URL: https://svnweb.freebsd.org/changeset/base/300146

Log:
  Also add comment about the bug I comments in the forth.

Modified:
  head/sys/boot/common/commands.c

Modified: head/sys/boot/common/commands.c
==
--- head/sys/boot/common/commands.c Wed May 18 13:21:29 2016
(r300145)
+++ head/sys/boot/common/commands.c Wed May 18 14:09:56 2016
(r300146)
@@ -211,6 +211,14 @@ command_help(int argc, char *argv[]) 
 
 COMMAND_SET(commandlist, "?", "list commands", command_commandlist);
 
+/*
+ * Please note: although we use the pager for the list of commands,
+ * this routine is called from the ? FORTH function which then
+ * unconditionally prints some commands. This will lead to anomalous
+ * behavior. There's no 'pager_output' binding to FORTH to allow
+ * things to work right, so I'm documenting the bug rather than
+ * fixnig it.
+ */
 static int
 command_commandlist(int argc, char *argv[])
 {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r300145 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2016-05-18 Thread Andriy Gapon
Author: avg
Date: Wed May 18 13:21:29 2016
New Revision: 300145
URL: https://svnweb.freebsd.org/changeset/base/300145

Log:
  add vop_print methods to vnode operatios of various zfsctl node types
  
  This should help with diagnostics of zfsctl problems.
  
  MFC after:2 weeks

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.cWed May 
18 13:09:52 2016(r300144)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.cWed May 
18 13:21:29 2016(r300145)
@@ -294,6 +294,22 @@ zfsctl_root(znode_t *zp)
return (zp->z_zfsvfs->z_ctldir);
 }
 
+static int
+zfsctl_common_print(ap)
+   struct vop_print_args /* {
+   struct vnode *a_vp;
+   } */ *ap;
+{
+   vnode_t *vp = ap->a_vp;
+   gfs_file_t *fp = vp->v_data;
+
+   printf("parent = %p\n", fp->gfs_parent);
+   printf("type = %d\n", fp->gfs_type);
+   printf("index = %d\n", fp->gfs_index);
+   printf("ino = %ju\n", (uintmax_t)fp->gfs_ino);
+   return (0);
+}
+
 /*
  * Common open routine.  Disallow any write access.
  */
@@ -584,6 +600,17 @@ relookup:
return (err);
 }
 
+static int
+zfsctl_root_print(ap)
+   struct vop_print_args /* {
+   struct vnode *a_vp;
+   } */ *ap;
+{
+   printf(".zfs node\n");
+   zfsctl_common_print(ap);
+   return (0);
+}
+
 #ifdef illumos
 static int
 zfsctl_pathconf(vnode_t *vp, int cmd, ulong_t *valp, cred_t *cr,
@@ -634,6 +661,7 @@ static struct vop_vector zfsctl_ops_root
.vop_pathconf = zfsctl_pathconf,
 #endif
.vop_fid =  zfsctl_common_fid,
+   .vop_print =zfsctl_root_print,
 };
 
 /*
@@ -1376,6 +1404,32 @@ zfsctl_snapdir_reclaim(ap)
return (0);
 }
 
+static int
+zfsctl_shares_print(ap)
+   struct vop_print_args /* {
+   struct vnode *a_vp;
+   } */ *ap;
+{
+   printf(".zfs/shares node\n");
+   zfsctl_common_print(ap);
+   return (0);
+}
+
+static int
+zfsctl_snapdir_print(ap)
+   struct vop_print_args /* {
+   struct vnode *a_vp;
+   } */ *ap;
+{
+   vnode_t *vp = ap->a_vp;
+   zfsctl_snapdir_t *sdp = vp->v_data;
+
+   printf(".zfs/snapshot node\n");
+   printf("number of children = %lu\n", avl_numnodes(>sd_snaps));
+   zfsctl_common_print(ap);
+   return (0);
+}
+
 #ifdef illumos
 static const fs_operation_def_t zfsctl_tops_snapdir[] = {
{ VOPNAME_OPEN, { .vop_open = zfsctl_common_open }  },
@@ -1421,6 +1475,7 @@ static struct vop_vector zfsctl_ops_snap
.vop_inactive = VOP_NULL,
.vop_reclaim =  zfsctl_snapdir_reclaim,
.vop_fid =  zfsctl_common_fid,
+   .vop_print =zfsctl_snapdir_print,
 };
 
 static struct vop_vector zfsctl_ops_shares = {
@@ -1435,6 +1490,7 @@ static struct vop_vector zfsctl_ops_shar
.vop_inactive = VOP_NULL,
.vop_reclaim =  gfs_vop_reclaim,
.vop_fid =  zfsctl_shares_fid,
+   .vop_print =zfsctl_shares_print,
 };
 #endif /* illumos */
 
@@ -1571,6 +1627,21 @@ zfsctl_snapshot_vptocnp(struct vop_vptoc
return (error);
 }
 
+static int
+zfsctl_snaphot_print(ap)
+   struct vop_print_args /* {
+   struct vnode *a_vp;
+   } */ *ap;
+{
+   vnode_t *vp = ap->a_vp;
+   zfsctl_node_t *zcp = vp->v_data;
+
+   printf(".zfs/snapshot/ node\n");
+   printf("id = %ju\n", (uintmax_t)zcp->zc_id);
+   zfsctl_common_print(ap);
+   return (0);
+}
+
 /*
  * These VP's should never see the light of day.  They should always
  * be covered.
@@ -1580,6 +1651,7 @@ static struct vop_vector zfsctl_ops_snap
.vop_inactive = zfsctl_snapshot_inactive,
.vop_reclaim =  zfsctl_snapshot_reclaim,
.vop_vptocnp =  zfsctl_snapshot_vptocnp,
+   .vop_print =zfsctl_snaphot_print,
 };
 
 int
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r299371 - in head: sbin/camcontrol sys/cam sys/cam/scsi

2016-05-18 Thread Alan Somers
On Wed, May 18, 2016 at 3:56 AM, Edward Tomasz Napierała 
wrote:

> On 0517T1158, Warner Losh wrote:
> > On Tue, May 10, 2016 at 11:33 AM, Edward Tomasz Napierala <
> tr...@freebsd.org
> > > wrote:
> >
> > > On 0510T1020, Alan Somers wrote:
> > > > On Tue, May 10, 2016 at 9:46 AM, Edward Tomasz Napierala <
> > > tr...@freebsd.org>
> > > > wrote:
> > > >
> > > > > Author: trasz
> > > > > Date: Tue May 10 15:46:33 2016
> > > > > New Revision: 299371
> > > > > URL: https://svnweb.freebsd.org/changeset/base/299371
> > > > >
> > > > > Log:
> > > > >   Add "camcontrol reprobe" subcommand, and implement it for da(4).
> > > > >   This makes it possible to manually force updating capacity data
> > > > >   after the disk got resized. Without it it might be neccessary to
> > > > >   reboot before FreeBSD notices updated disk size under eg VMWare.
> > > > >
> > > > >   Discussed with:   imp@
> > > > >   MFC after:1 month
> > > > >   Sponsored by: The FreeBSD Foundation
> > > > >   Differential Revision:https://reviews.freebsd.org/D6108
> > > > >
> > > > > Modified:
> > > > >   head/sbin/camcontrol/camcontrol.8
> > > > >   head/sbin/camcontrol/camcontrol.c
> > > > >   head/sys/cam/cam_ccb.h
> > > > >   head/sys/cam/cam_xpt.c
> > > > >   head/sys/cam/scsi/scsi_da.c
> > > > >
> > > > >
> > > >
> > > > I too have been annoyed that "camcontrol rescan" won't update
> capacity
> > > > data.  But could we solve the problem by simply adding logic to
> > > "camcontrol
> > > > rescan" instead of adding an entirely new command?  Would a user ever
> > > want
> > > > to rescan a device without reprobing it too?
> > >
> > > Two reasons.  First, I want to be able to pass the device name (like
> > > 'da0') and not the CAM path (like 1:0:0) for usability reasons - it
> seems
> > > easy to figure out the latter from the former, using "camcontrol
> devlist",
> > > but it suddenly becomes complicated when you try to explain it in a man
> > > page.
> >
> >
> > You can look up one or the other. fwdownload uses the daX name.
>
> Indeed.  But it would mean fixing "camcontrol rescan" first.
>
> > > Second - I don't understand the "camcontrol rescan" logic well
> > > enough, and "camcontrol rescan all" sometimes fails for me anyway,
> > > in a way I'm not sure how to debug.
> > >
> >
> > That's a cop-out. CAM is hard, but if you aren't willing to figure itout,
> > adding hacks that the other CAM maintainers have to cope with doesn't
> > help.
>
> That's true.  However, this hack is pretty non-intrusive - it only adds
> a trivial amount of code, and the "reprobe" command could be replaced
> with a simple alias to "rescan" if someone steps up to reimplement it.
>
> > Also, to be honest I'm not sure those two are actually that related.
> > > Rescanning is about discovering new devices on the bus.  "Reprobe"
> > > is about updating... well, mostly updating the capacity.  The former
> > > requires enumerating the bus using a mechanism built into XPT; the
> > > latter is just notifying the periph driver (in this case da(4)) that
> > > it needs to query the capacity and call disk_resize(4).
> > >
> >
> > The two are very related. Now we have two stupid paths in CAM instead of
> > one.
>
> We have two clearly separated code paths, doing completely different
> things - one scanning the bus, and only notifying periph drivers if
> new device is discovered, and the other one to notify existing periph
> driver instances, without scanning anything.  I just don't see how
> entangling them with each other would improve things.
>
> > and you didn't do ada like I asked.
>
> As I said in review, the ada(4) driver seems to lack resizing
> capability.  It doesn't contain a call to disk_resize(9).  It's been
> a few years since I've added resizing to da(4), but it took quite
> some time to make sure it interfaces with existing code in exactly
> the right way.  I just don't have time for this kind of side quest
> right now.  And I'm not even sure how to test it.  With da(4) it
> was easy - I've just added LUN resizing to CTL.
>


You can test ada(4) resize by using "camcontrol hpa".  Most SATA disks
allow you to reduce the disk's capacity through the hpa command.



>
> > Not happy with this at all, but not asking for a back out.
>
> Thanks.
>
>
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

svn commit: r300144 - head/sys/arm/include

2016-05-18 Thread Andrew Turner
Author: andrew
Date: Wed May 18 13:09:52 2016
New Revision: 300144
URL: https://svnweb.freebsd.org/changeset/base/300144

Log:
  Implement atomic_cmpset_acq_64 and atomic_cmpset_rel_64 on arm and armeb.
  This should allow r300113 to build there.
  
  Sponsored by: ABT Systems Ltd

Modified:
  head/sys/arm/include/atomic-v4.h

Modified: head/sys/arm/include/atomic-v4.h
==
--- head/sys/arm/include/atomic-v4.hWed May 18 12:53:21 2016
(r300143)
+++ head/sys/arm/include/atomic-v4.hWed May 18 13:09:52 2016
(r300144)
@@ -372,6 +372,8 @@ atomic_swap_32(volatile u_int32_t *p, u_
 
 #define atomic_cmpset_rel_32   atomic_cmpset_32
 #define atomic_cmpset_acq_32   atomic_cmpset_32
+#define atomic_cmpset_rel_64   atomic_cmpset_64
+#define atomic_cmpset_acq_64   atomic_cmpset_64
 #define atomic_set_rel_32  atomic_set_32
 #define atomic_set_acq_32  atomic_set_32
 #define atomic_clear_rel_32atomic_clear_32
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r300143 - head/sys/netpfil/ipfw

2016-05-18 Thread Andrey V. Elsukov
Author: ae
Date: Wed May 18 12:53:21 2016
New Revision: 300143
URL: https://svnweb.freebsd.org/changeset/base/300143

Log:
  Move protocol state handling code from lookup_dyn_rule_locked() function
  into dyn_update_proto_state(). This allows eliminate the second state
  lookup in the ipfw_install_state().
  Also remove MATCH_* macros, they are defined in ip_fw_private.h as enum.
  
  Obtained from:Yandex LLC
  Sponsored by: Yandex LLC

Modified:
  head/sys/netpfil/ipfw/ip_fw_dynamic.c

Modified: head/sys/netpfil/ipfw/ip_fw_dynamic.c
==
--- head/sys/netpfil/ipfw/ip_fw_dynamic.c   Wed May 18 12:03:57 2016
(r300142)
+++ head/sys/netpfil/ipfw/ip_fw_dynamic.c   Wed May 18 12:53:21 2016
(r300143)
@@ -319,77 +319,15 @@ print_dyn_rule_flags(struct ipfw_flow_id
 #define TIME_LEQ(a,b)   ((int)((a)-(b)) <= 0)
 #define TIME_LE(a,b)   ((int)((a)-(b)) < 0)
 
-/*
- * Lookup a dynamic rule, locked version.
- */
-static ipfw_dyn_rule *
-lookup_dyn_rule_locked(struct ipfw_flow_id *pkt, int i, int *match_direction,
-struct tcphdr *tcp)
+static void
+dyn_update_proto_state(ipfw_dyn_rule *q, const struct ipfw_flow_id *id,
+const struct tcphdr *tcp, int dir)
 {
-   /*
-* Stateful ipfw extensions.
-* Lookup into dynamic session queue.
-*/
-#define MATCH_REVERSE  0
-#define MATCH_FORWARD  1
-#define MATCH_NONE 2
-#define MATCH_UNKNOWN  3
-   int dir = MATCH_NONE;
-   ipfw_dyn_rule *prev, *q = NULL;
-
-   IPFW_BUCK_ASSERT(i);
-
-   for (prev = NULL, q = V_ipfw_dyn_v[i].head; q; prev = q, q = q->next) {
-   if (q->dyn_type == O_LIMIT_PARENT && q->count)
-   continue;
-
-   if (pkt->proto != q->id.proto || q->dyn_type == O_LIMIT_PARENT)
-   continue;
-
-   if (IS_IP6_FLOW_ID(pkt)) {
-   if (IN6_ARE_ADDR_EQUAL(>src_ip6, >id.src_ip6) &&
-   IN6_ARE_ADDR_EQUAL(>dst_ip6, >id.dst_ip6) &&
-   pkt->src_port == q->id.src_port &&
-   pkt->dst_port == q->id.dst_port) {
-   dir = MATCH_FORWARD;
-   break;
-   }
-   if (IN6_ARE_ADDR_EQUAL(>src_ip6, >id.dst_ip6) &&
-   IN6_ARE_ADDR_EQUAL(>dst_ip6, >id.src_ip6) &&
-   pkt->src_port == q->id.dst_port &&
-   pkt->dst_port == q->id.src_port) {
-   dir = MATCH_REVERSE;
-   break;
-   }
-   } else {
-   if (pkt->src_ip == q->id.src_ip &&
-   pkt->dst_ip == q->id.dst_ip &&
-   pkt->src_port == q->id.src_port &&
-   pkt->dst_port == q->id.dst_port) {
-   dir = MATCH_FORWARD;
-   break;
-   }
-   if (pkt->src_ip == q->id.dst_ip &&
-   pkt->dst_ip == q->id.src_ip &&
-   pkt->src_port == q->id.dst_port &&
-   pkt->dst_port == q->id.src_port) {
-   dir = MATCH_REVERSE;
-   break;
-   }
-   }
-   }
-   if (q == NULL)
-   goto done;  /* q = NULL, not found */
-
-   if (prev != NULL) { /* found and not in front */
-   prev->next = q->next;
-   q->next = V_ipfw_dyn_v[i].head;
-   V_ipfw_dyn_v[i].head = q;
-   }
-   if (pkt->proto == IPPROTO_TCP) { /* update state according to flags */
-   uint32_t ack;
-   u_char flags = pkt->_flags & (TH_FIN | TH_SYN | TH_RST);
+   uint32_t ack;
+   u_char flags;
 
+   if (id->proto == IPPROTO_TCP) {
+   flags = id->_flags & (TH_FIN | TH_SYN | TH_RST);
 #define BOTH_SYN   (TH_SYN | (TH_SYN << 8))
 #define BOTH_FIN   (TH_FIN | (TH_FIN << 8))
 #defineTCP_FLAGS   (TH_FLAGS | (TH_FLAGS << 8))
@@ -432,7 +370,8 @@ lookup_dyn_rule_locked(struct ipfw_flow_
 
case BOTH_SYN | BOTH_FIN:   /* both sides closed */
if (V_dyn_fin_lifetime >= V_dyn_keepalive_period)
-   V_dyn_fin_lifetime = V_dyn_keepalive_period - 1;
+   V_dyn_fin_lifetime =
+   V_dyn_keepalive_period - 1;
q->expire = time_uptime + V_dyn_fin_lifetime;
break;
 
@@ -446,16 +385,86 @@ lookup_dyn_rule_locked(struct ipfw_flow_
printf("invalid state: 0x%x\n", q->state);
 #endif
if (V_dyn_rst_lifetime >= V_dyn_keepalive_period)
-   

svn commit: r300142 - in head/sys: kern sys ufs/ufs

2016-05-18 Thread Konstantin Belousov
Author: kib
Date: Wed May 18 12:03:57 2016
New Revision: 300142
URL: https://svnweb.freebsd.org/changeset/base/300142

Log:
  Ensure that ftruncate(2) is performed synchronously when file is
  opened in O_SYNC mode, at least for UFS.  This also handles
  truncation, done due to the O_SYNC | O_TRUNC flags combination to
  open(2), in synchronous way.
  
  Noted by: bde
  Sponsored by: The FreeBSD Foundation
  MFC after:2 weeks

Modified:
  head/sys/kern/vfs_vnops.c
  head/sys/sys/vnode.h
  head/sys/ufs/ufs/ufs_vnops.c

Modified: head/sys/kern/vfs_vnops.c
==
--- head/sys/kern/vfs_vnops.c   Wed May 18 12:02:05 2016(r300141)
+++ head/sys/kern/vfs_vnops.c   Wed May 18 12:03:57 2016(r300142)
@@ -1314,6 +1314,8 @@ vn_truncate(struct file *fp, off_t lengt
if (error == 0) {
VATTR_NULL();
vattr.va_size = length;
+   if ((fp->f_flag & O_FSYNC) != 0)
+   vattr.va_vaflags |= VA_SYNC;
error = VOP_SETATTR(vp, , fp->f_cred);
}
 out:

Modified: head/sys/sys/vnode.h
==
--- head/sys/sys/vnode.hWed May 18 12:02:05 2016(r300141)
+++ head/sys/sys/vnode.hWed May 18 12:03:57 2016(r300142)
@@ -286,6 +286,7 @@ struct vattr {
  */
 #defineVA_UTIMES_NULL  0x01/* utimes argument was NULL */
 #defineVA_EXCLUSIVE0x02/* exclusive create request */
+#defineVA_SYNC 0x04/* O_SYNC truncation */
 
 /*
  * Flags for ioflag. (high 16 bits used to ask for read-ahead and

Modified: head/sys/ufs/ufs/ufs_vnops.c
==
--- head/sys/ufs/ufs/ufs_vnops.cWed May 18 12:02:05 2016
(r300141)
+++ head/sys/ufs/ufs/ufs_vnops.cWed May 18 12:03:57 2016
(r300142)
@@ -625,7 +625,8 @@ ufs_setattr(ap)
 */
return (0);
}
-   if ((error = UFS_TRUNCATE(vp, vap->va_size, IO_NORMAL,
+   if ((error = UFS_TRUNCATE(vp, vap->va_size, IO_NORMAL |
+   ((vap->va_vaflags & VA_SYNC) != 0 ? IO_SYNC : 0),
cred)) != 0)
return (error);
}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r300141 - stable/10/sys/fs/nfsclient

2016-05-18 Thread Konstantin Belousov
Author: kib
Date: Wed May 18 12:02:05 2016
New Revision: 300141
URL: https://svnweb.freebsd.org/changeset/base/300141

Log:
  MFC r299413:
  Use vfs_hash_ref(9) to eliminate LK_EXCLOTHER kludge.

Modified:
  stable/10/sys/fs/nfsclient/nfs_clport.c
  stable/10/sys/fs/nfsclient/nfs_clvnops.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/fs/nfsclient/nfs_clport.c
==
--- stable/10/sys/fs/nfsclient/nfs_clport.c Wed May 18 11:58:16 2016
(r300140)
+++ stable/10/sys/fs/nfsclient/nfs_clport.c Wed May 18 12:02:05 2016
(r300141)
@@ -279,7 +279,7 @@ nfscl_nget(struct mount *mntp, struct vn
 }
 
 /*
- * Anothe variant of nfs_nget(). This one is only used by reopen. It
+ * Another variant of nfs_nget(). This one is only used by reopen. It
  * takes almost the same args as nfs_nget(), but only succeeds if an entry
  * exists in the cache. (Since files should already be "open" with a
  * vnode ref cnt on the node when reopen calls this, it should always
@@ -318,21 +318,24 @@ nfscl_ngetreopen(struct mount *mntp, u_i
NFSVOPUNLOCK(nvp, 0);
} else if (error == EBUSY) {
/*
-* The LK_EXCLOTHER lock type tells nfs_lock1() to not try
-* and lock the vnode, but just get a v_usecount on it.
-* LK_NOWAIT is set so that when vget() returns ENOENT,
-* vfs_hash_get() fails instead of looping.
-* If this succeeds, it is safe so long as a vflush() with
+* It is safe so long as a vflush() with
 * FORCECLOSE has not been done. Since the Renew thread is
 * stopped and the MNTK_UNMOUNTF flag is set before doing
 * a vflush() with FORCECLOSE, we should be ok here.
 */
if ((mntp->mnt_kern_flag & MNTK_UNMOUNTF))
error = EINTR;
-   else
-   error = vfs_hash_get(mntp, hash,
-   (LK_EXCLOTHER | LK_NOWAIT), td, ,
-   newnfs_vncmpf, nfhp);
+   else {
+   vfs_hash_ref(mntp, hash, td, , newnfs_vncmpf, nfhp);
+   if (nvp == NULL) {
+   error = ENOENT;
+   } else if ((nvp->v_iflag & VI_DOOMED) != 0) {
+   error = ENOENT;
+   vrele(nvp);
+   } else {
+   error = 0;
+   }
+   }
}
FREE(nfhp, M_NFSFH);
if (error)

Modified: stable/10/sys/fs/nfsclient/nfs_clvnops.c
==
--- stable/10/sys/fs/nfsclient/nfs_clvnops.cWed May 18 11:58:16 2016
(r300140)
+++ stable/10/sys/fs/nfsclient/nfs_clvnops.cWed May 18 12:02:05 2016
(r300141)
@@ -139,7 +139,6 @@ static vop_rmdir_t  nfs_rmdir;
 static vop_symlink_t   nfs_symlink;
 static vop_readdir_t   nfs_readdir;
 static vop_strategy_t  nfs_strategy;
-static vop_lock1_t nfs_lock1;
 static int nfs_lookitup(struct vnode *, char *, int,
struct ucred *, struct thread *, struct nfsnode **);
 static int nfs_sillyrename(struct vnode *, struct vnode *,
@@ -168,7 +167,6 @@ struct vop_vector newnfs_vnodeops = {
.vop_putpages = ncl_putpages,
.vop_inactive = ncl_inactive,
.vop_link = nfs_link,
-   .vop_lock1 =nfs_lock1,
.vop_lookup =   nfs_lookup,
.vop_mkdir =nfs_mkdir,
.vop_mknod =nfs_mknod,
@@ -3350,37 +3348,6 @@ struct buf_ops buf_ops_newnfs = {
.bop_bdflush=   bufbdflush,
 };
 
-/*
- * Cloned from vop_stdlock(), and then the ugly hack added.
- */
-static int
-nfs_lock1(struct vop_lock1_args *ap)
-{
-   struct vnode *vp = ap->a_vp;
-   int error = 0;
-
-   /*
-* Since vfs_hash_get() calls vget() and it will no longer work
-* for FreeBSD8 with flags == 0, I can only think of this horrible
-* hack to work around it. I call vfs_hash_get() with LK_EXCLOTHER
-* and then handle it here. All I want for this case is a v_usecount
-* on the vnode to use for recovery, while another thread might
-* hold a lock on the vnode. I have the other threads blocked, so
-* there isn't any race problem.
-*/
-   if ((ap->a_flags & LK_TYPE_MASK) == LK_EXCLOTHER) {
-   if ((ap->a_flags & LK_INTERLOCK) == 0)
-   panic("ncllock1");
-   if ((vp->v_iflag & VI_DOOMED))
-   error = ENOENT;
-   VI_UNLOCK(vp);
-   return (error);
-   }
-   return (_lockmgr_args(vp->v_vnlock, ap->a_flags, VI_MTX(vp),
-   LK_WMESG_DEFAULT, 

svn commit: r300140 - in stable/10/sys: kern sys

2016-05-18 Thread Konstantin Belousov
Author: kib
Date: Wed May 18 11:58:16 2016
New Revision: 300140
URL: https://svnweb.freebsd.org/changeset/base/300140

Log:
  MFC r299412:
  Add vfs_hash_ref(9) function, which finds a vnode by the hash value
  and returns it referenced.

Modified:
  stable/10/sys/kern/vfs_hash.c
  stable/10/sys/sys/vnode.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/kern/vfs_hash.c
==
--- stable/10/sys/kern/vfs_hash.c   Wed May 18 11:51:17 2016
(r300139)
+++ stable/10/sys/kern/vfs_hash.c   Wed May 18 11:58:16 2016
(r300140)
@@ -103,6 +103,36 @@ vfs_hash_get(const struct mount *mp, u_i
 }
 
 void
+vfs_hash_ref(const struct mount *mp, u_int hash, struct thread *td,
+struct vnode **vpp, vfs_hash_cmp_t *fn, void *arg)
+{
+   struct vnode *vp;
+
+   while (1) {
+   mtx_lock(_hash_mtx);
+   LIST_FOREACH(vp, vfs_hash_bucket(mp, hash), v_hashlist) {
+   if (vp->v_hash != hash)
+   continue;
+   if (vp->v_mount != mp)
+   continue;
+   if (fn != NULL && fn(vp, arg))
+   continue;
+   vhold(vp);
+   mtx_unlock(_hash_mtx);
+   vref(vp);
+   vdrop(vp);
+   *vpp = vp;
+   return;
+   }
+   if (vp == NULL) {
+   mtx_unlock(_hash_mtx);
+   *vpp = NULL;
+   return;
+   }
+   }
+}
+
+void
 vfs_hash_remove(struct vnode *vp)
 {
 

Modified: stable/10/sys/sys/vnode.h
==
--- stable/10/sys/sys/vnode.h   Wed May 18 11:51:17 2016(r300139)
+++ stable/10/sys/sys/vnode.h   Wed May 18 11:58:16 2016(r300140)
@@ -849,6 +849,8 @@ int vfs_hash_get(const struct mount *mp,
 u_int vfs_hash_index(struct vnode *vp);
 int vfs_hash_insert(struct vnode *vp, u_int hash, int flags, struct thread *td,
 struct vnode **vpp, vfs_hash_cmp_t *fn, void *arg);
+void vfs_hash_ref(const struct mount *mp, u_int hash, struct thread *td,
+struct vnode **vpp, vfs_hash_cmp_t *fn, void *arg);
 void vfs_hash_rehash(struct vnode *vp, u_int hash);
 void vfs_hash_remove(struct vnode *vp);
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r300139 - in stable/10/sys: kern sys

2016-05-18 Thread Konstantin Belousov
Author: kib
Date: Wed May 18 11:51:17 2016
New Revision: 300139
URL: https://svnweb.freebsd.org/changeset/base/300139

Log:
  MFC r299408:
  Style: wrap long lines.

Modified:
  stable/10/sys/kern/vfs_hash.c
  stable/10/sys/sys/vnode.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/kern/vfs_hash.c
==
--- stable/10/sys/kern/vfs_hash.c   Wed May 18 10:59:16 2016
(r300138)
+++ stable/10/sys/kern/vfs_hash.c   Wed May 18 11:51:17 2016
(r300139)
@@ -69,7 +69,8 @@ vfs_hash_bucket(const struct mount *mp, 
 }
 
 int
-vfs_hash_get(const struct mount *mp, u_int hash, int flags, struct thread *td, 
struct vnode **vpp, vfs_hash_cmp_t *fn, void *arg)
+vfs_hash_get(const struct mount *mp, u_int hash, int flags, struct thread *td,
+struct vnode **vpp, vfs_hash_cmp_t *fn, void *arg)
 {
struct vnode *vp;
int error;
@@ -111,7 +112,8 @@ vfs_hash_remove(struct vnode *vp)
 }
 
 int
-vfs_hash_insert(struct vnode *vp, u_int hash, int flags, struct thread *td, 
struct vnode **vpp, vfs_hash_cmp_t *fn, void *arg)
+vfs_hash_insert(struct vnode *vp, u_int hash, int flags, struct thread *td,
+struct vnode **vpp, vfs_hash_cmp_t *fn, void *arg)
 {
struct vnode *vp2;
int error;

Modified: stable/10/sys/sys/vnode.h
==
--- stable/10/sys/sys/vnode.h   Wed May 18 10:59:16 2016(r300138)
+++ stable/10/sys/sys/vnode.h   Wed May 18 11:51:17 2016(r300139)
@@ -844,9 +844,11 @@ intfifo_printinfo(struct vnode *);
 typedef int vfs_hash_cmp_t(struct vnode *vp, void *arg);
 
 void vfs_hash_changesize(int newhashsize);
-int vfs_hash_get(const struct mount *mp, u_int hash, int flags, struct thread 
*td, struct vnode **vpp, vfs_hash_cmp_t *fn, void *arg);
+int vfs_hash_get(const struct mount *mp, u_int hash, int flags,
+struct thread *td, struct vnode **vpp, vfs_hash_cmp_t *fn, void *arg);
 u_int vfs_hash_index(struct vnode *vp);
-int vfs_hash_insert(struct vnode *vp, u_int hash, int flags, struct thread 
*td, struct vnode **vpp, vfs_hash_cmp_t *fn, void *arg);
+int vfs_hash_insert(struct vnode *vp, u_int hash, int flags, struct thread *td,
+struct vnode **vpp, vfs_hash_cmp_t *fn, void *arg);
 void vfs_hash_rehash(struct vnode *vp, u_int hash);
 void vfs_hash_remove(struct vnode *vp);
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r300113 - in head/sys: conf kern net sys

2016-05-18 Thread Bjoern A. Zeeb

> On 18 May 2016, at 04:35 , Scott Long  wrote:
> 
> Author: scottl
> Date: Wed May 18 04:35:58 2016
> New Revision: 300113
> URL: https://svnweb.freebsd.org/changeset/base/300113
> 
> Log:
>  Import the 'iflib' API library for network drivers.  From the author:
> 
>  "iflib is a library to eliminate the need for frequently duplicated device
>  independent logic propagated (poorly) across many network drivers."
> 
>  Participation is purely optional.  The IFLIB kernel config option is
>  provided for drivers that want to transition between legacy and iflib
>  modes of operation.  ixl and ixgbe driver conversions will be committed
>  shortly.  We hope to see participation from the Broadcom and maybe
>  Chelsio drivers in the near future.
> 
>  Submitted by:   mm...@nextbsd.org
>  Reviewed by:gallatin
>  Differential Revision:  D5211
> 
> Added:
>  head/sys/net/ifdi_if.m   (contents, props changed)
>  head/sys/net/iflib.c   (contents, props changed)
>  head/sys/net/iflib.h   (contents, props changed)
>  head/sys/net/mp_ring.c   (contents, props changed)
>  head/sys/net/mp_ring.h   (contents, props changed)
> Modified:
>  head/sys/conf/files
>  head/sys/conf/options
>  head/sys/kern/device_if.m
>  head/sys/kern/kern_mbuf.c
>  head/sys/kern/subr_taskqueue.c
>  head/sys/net/if.c
>  head/sys/net/if_var.h
>  head/sys/sys/_task.h
>  head/sys/sys/mbuf.h
>  head/sys/sys/taskqueue.h

Ignoring style for a moment, this broke builds;

just as examples:  mips XLP

cc1: warnings being treated as errors
/scratch/tmp/bz/head.svn/sys/net/mp_ring.c: In function 'drain_ring_lockless':
/scratch/tmp/bz/head.svn/sys/net/mp_ring.c:204: warning: implicit declaration 
of function 'atomic_cmpset_64'
/scratch/tmp/bz/head.svn/sys/net/mp_ring.c:204: warning: nested extern 
declaration of 'atomic_cmpset_64' [-Wnested-externs]
/scratch/tmp/bz/head.svn/sys/net/mp_ring.c:231: warning: implicit declaration 
of function 'atomic_cmpset_acq_64'
/scratch/tmp/bz/head.svn/sys/net/mp_ring.c:231: warning: nested extern 
declaration of 'atomic_cmpset_acq_64' [-Wnested-externs]
/scratch/tmp/bz/head.svn/sys/net/mp_ring.c: In function 'ifmp_ring_enqueue':
/scratch/tmp/bz/head.svn/sys/net/mp_ring.c:456: warning: implicit declaration 
of function 'atomic_cmpset_rel_64'
/scratch/tmp/bz/head.svn/sys/net/mp_ring.c:456: warning: nested extern 
declaration of 'atomic_cmpset_rel_64' [-Wnested-externs]
--- mp_ring.o ---
*** [mp_ring.o] Error code 1

bmake[5]: stopped in /storage/head/obj/mips.mips/scratch/tmp/bz/head.svn/sys/XLP


powerpc LINT:

cc1: warnings being treated as errors
/scratch/tmp/bz/head.svn/sys/net/iflib.c: In function '_iflib_fl_refill':
/scratch/tmp/bz/head.svn/sys/net/iflib.c:1538: warning: comparison is always 
true due to limited range of data type
/scratch/tmp/bz/head.svn/sys/net/iflib.c: In function 'iflib_fl_bufs_free':
/scratch/tmp/bz/head.svn/sys/net/iflib.c:1667: warning: comparison is always 
true due to limited range of data type
--- iflib.o ---
*** [iflib.o] Error code 1

bmake[5]: stopped in 
/storage/head/obj/powerpc.powerpc/scratch/tmp/bz/head.svn/sys/LINT
cc1: warnings being treated as errors
/scratch/tmp/bz/head.svn/sys/net/mp_ring.c: In function 'drain_ring_lockless':
/scratch/tmp/bz/head.svn/sys/net/mp_ring.c:204: warning: implicit declaration 
of function 'atomic_cmpset_64'
/scratch/tmp/bz/head.svn/sys/net/mp_ring.c:204: warning: nested extern 
declaration of 'atomic_cmpset_64' [-Wnested-externs]
/scratch/tmp/bz/head.svn/sys/net/mp_ring.c:231: warning: implicit declaration 
of function 'atomic_cmpset_acq_64'
/scratch/tmp/bz/head.svn/sys/net/mp_ring.c:231: warning: nested extern 
declaration of 'atomic_cmpset_acq_64' [-Wnested-externs]
/scratch/tmp/bz/head.svn/sys/net/mp_ring.c: In function 'ifmp_ring_enqueue':
/scratch/tmp/bz/head.svn/sys/net/mp_ring.c:456: warning: implicit declaration 
of function 'atomic_cmpset_rel_64'
/scratch/tmp/bz/head.svn/sys/net/mp_ring.c:456: warning: nested extern 
declaration of 'atomic_cmpset_rel_64' [-Wnested-externs]
--- mp_ring.o ---
*** [mp_ring.o] Error code 1

…




— 
Bjoern A. Zeeb  Charles Haddon Spurgeon:
"Friendship is one of the sweetest joys of life.  Many might have failed
 beneath the bitterness of their trial  had they not found a friend."

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

svn commit: r300138 - head/targets

2016-05-18 Thread Andriy Voskoboinyk
Author: avos
Date: Wed May 18 10:59:16 2016
New Revision: 300138
URL: https://svnweb.freebsd.org/changeset/base/300138

Log:
  targets/Makefile: fix a typo (derrived -> derived).

Modified:
  head/targets/Makefile

Modified: head/targets/Makefile
==
--- head/targets/Makefile   Wed May 18 10:43:13 2016(r300137)
+++ head/targets/Makefile   Wed May 18 10:59:16 2016(r300138)
@@ -1,6 +1,6 @@
 # $FreeBSD$
 
-# This is the top-level makefile - derrived from the Junos version
+# This is the top-level makefile - derived from the Junos version
 #
 # If a subdir that matches the requested target exists, we assume
 # a build target and initialize DIRDEPS, dirdeps.mk does the rest.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r300137 - head

2016-05-18 Thread Andriy Voskoboinyk
Author: avos
Date: Wed May 18 10:43:13 2016
New Revision: 300137
URL: https://svnweb.freebsd.org/changeset/base/300137

Log:
  README: remove nonexistent 'games' directory.
  
  Games were moved to usr.bin in r288485.
  
  (todo: add/describe 'targets' directory)

Modified:
  head/README

Modified: head/README
==
--- head/README Wed May 18 10:09:07 2016(r300136)
+++ head/README Wed May 18 10:43:13 2016(r300137)
@@ -45,8 +45,6 @@ cryptoCryptography stuff (see crypto/R
 
 etcTemplate files for /etc.
 
-games  Amusements.
-
 gnuVarious commands and libraries under the GNU Public License.
Please see gnu/COPYING* for more information.
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r300136 - head/sys/arm64/arm64

2016-05-18 Thread Zbigniew Bodek
Author: zbb
Date: Wed May 18 10:09:07 2016
New Revision: 300136
URL: https://svnweb.freebsd.org/changeset/base/300136

Log:
  Add support for MSI/MSIX deallocation on GICv3-ITS
  
  Allow to deallocate previously allocated ITS device along with
  its interrupts. Interrupt numbers are being freed when the last
  LPI number is no longer busy.
  
  Reviewed by:  wma
  Obtained from:Semihalf
  Sponsored by: Cavium
  Differential Revision:https://reviews.freebsd.org/D6351

Modified:
  head/sys/arm64/arm64/gic_v3_its.c
  head/sys/arm64/arm64/gic_v3_var.h

Modified: head/sys/arm64/arm64/gic_v3_its.c
==
--- head/sys/arm64/arm64/gic_v3_its.c   Wed May 18 09:57:11 2016
(r300135)
+++ head/sys/arm64/arm64/gic_v3_its.c   Wed May 18 10:09:07 2016
(r300136)
@@ -75,8 +75,10 @@ static device_method_t gic_v3_its_method
 */
/* MSI-X */
DEVMETHOD(pic_alloc_msix,   gic_v3_its_alloc_msix),
+   DEVMETHOD(pic_release_msix, gic_v3_its_release_msix),
/* MSI */
DEVMETHOD(pic_alloc_msi,gic_v3_its_alloc_msi),
+   DEVMETHOD(pic_release_msi,  gic_v3_its_release_msi),
DEVMETHOD(pic_map_msi,  gic_v3_its_map_msi),
 
/* End */
@@ -882,6 +884,7 @@ retry:
bit_nset(bitmap, fclr, fclr + nvecs - 1);
lpic->lpi_base = fclr + GIC_FIRST_LPI;
lpic->lpi_num = nvecs;
+   lpic->lpi_busy = 0;
lpic->lpi_free = lpic->lpi_num;
lpic->lpi_col_ids = col_ids;
for (i = 0; i < lpic->lpi_num; i++) {
@@ -901,10 +904,9 @@ lpi_free_chunk(struct gic_v3_its_softc *
 {
int start, end;
 
-   KASSERT((lpic->lpi_free == lpic->lpi_num),
-   ("Trying to free LPI chunk that is still in use.\n"));
-
mtx_lock_spin(>its_dev_lock);
+   KASSERT((lpic->lpi_busy == 0),
+   ("Trying to free LPI chunk that is still in use.\n"));
/* First bit of this chunk in a global bitmap */
start = lpic->lpi_base - GIC_FIRST_LPI;
/* and last bit of this chunk... */
@@ -1493,6 +1495,7 @@ its_device_alloc(struct gic_v3_its_softc
 u_int nvecs)
 {
struct its_dev *newdev;
+   vm_offset_t itt_addr;
uint64_t typer;
uint32_t devid;
size_t esize;
@@ -1528,16 +1531,18 @@ its_device_alloc(struct gic_v3_its_softc
 * Allocate ITT for this device.
 * PA has to be 256 B aligned. At least two entries for device.
 */
-   newdev->itt = (vm_offset_t)contigmalloc(
-   roundup2(roundup2(nvecs, 2) * esize, 0x100), M_GIC_V3_ITS,
-   (M_NOWAIT | M_ZERO), 0, ~0UL, 0x100, 0);
-   if (newdev->itt == 0) {
+   newdev->itt_size = roundup2(roundup2(nvecs, 2) * esize, 0x100);
+   itt_addr = (vm_offset_t)contigmalloc(
+   newdev->itt_size, M_GIC_V3_ITS, (M_NOWAIT | M_ZERO),
+   0, ~0UL, 0x100, 0);
+   if (itt_addr == 0) {
lpi_free_chunk(sc, >lpis);
free(newdev, M_GIC_V3_ITS);
return (NULL);
}
 
mtx_lock_spin(>its_dev_lock);
+   newdev->itt = itt_addr;
TAILQ_INSERT_TAIL(>its_dev_list, newdev, entry);
mtx_unlock_spin(>its_dev_lock);
 
@@ -1547,6 +1552,50 @@ its_device_alloc(struct gic_v3_its_softc
return (newdev);
 }
 
+static void
+its_device_free(struct gic_v3_its_softc *sc, device_t pci_dev,
+u_int nvecs)
+{
+   struct its_dev *odev;
+
+   mtx_lock_spin(>its_dev_lock);
+   /* Find existing device if any */
+   odev = its_device_find_locked(sc, pci_dev, 0);
+   if (odev == NULL) {
+   mtx_unlock_spin(>its_dev_lock);
+   return;
+   }
+
+   KASSERT((nvecs <= odev->lpis.lpi_num) && (nvecs <= odev->lpis.lpi_busy),
+   ("Invalid number of LPI vectors to free %d (total %d) (busy %d)",
+   nvecs, odev->lpis.lpi_num, odev->lpis.lpi_busy));
+   /* Just decrement number of busy LPIs in chunk */
+   odev->lpis.lpi_busy -= nvecs;
+   if (odev->lpis.lpi_busy != 0) {
+   mtx_unlock_spin(>its_dev_lock);
+   return;
+   }
+
+   /*
+* At that point we know that there are no busy LPIs for this device.
+* Entire ITS device can now be removed.
+*/
+   mtx_unlock_spin(>its_dev_lock);
+   /* Unmap device in ITS */
+   its_cmd_mapd(sc, odev, 0);
+   /* Free ITT */
+   KASSERT(odev->itt != 0, ("Invalid ITT in valid ITS device"));
+   contigfree((void *)odev->itt, odev->itt_size, M_GIC_V3_ITS);
+   /* Free chunk */
+   lpi_free_chunk(sc, >lpis);
+   /* Free device */
+   mtx_lock_spin(>its_dev_lock);
+   TAILQ_REMOVE(>its_dev_list, odev, entry);
+   mtx_unlock_spin(>its_dev_lock);
+   free((void *)odev, M_GIC_V3_ITS);
+
+}
+
 static __inline void
 its_device_asign_lpi_locked(struct gic_v3_its_softc *sc,
 struct its_dev *its_dev, u_int *irq)
@@ 

Re: svn commit: r299944 - in head/sys: arm64/arm64 conf

2016-05-18 Thread Zbigniew Bodek
Hello Andrew,

Thanks for the comments. Please check in-line below.

Kind regards
zbb

2016-05-17 14:19 GMT+02:00 Andrew Turner :

> On Mon, 16 May 2016 18:08:49 +0200
> Zbigniew Bodek  wrote:
>
> > Hello Andrew,
> >
> > I think committing this code should be preceded by at least brief
> > review. Few remarks to the code found on the first glance below.
>
> See below for comments.
>
> >
> > Kind regards
> > zbb
> >
> > 2016-05-16 16:07 GMT+02:00 Andrew Turner :
> >
> > > Author: andrew
> > > Date: Mon May 16 14:07:43 2016
> > > New Revision: 299944
> > > URL: https://svnweb.freebsd.org/changeset/base/299944
> > >
> > > Log:
> > >   Add intrng support to the GICv3 driver. It lacks ITS support so
> > > won't handle
> > >   MSI or MSI-X interrupts, however this is enought to boot FreeBSD
> > > under the
> > >   ARM Foundation Model with a GICv3 interrupt controller.
> > >
> > >   Approved by:  ABT Systems Ltd
> > >   Relnotes: yes
> > >   Sponsored by: The FreeBSD Foundation
> ...
> > > +#ifdef INTRNG
> > > +int
> > > +arm_gic_v3_intr(void *arg)
> > > +{
> > > +   struct gic_v3_softc *sc = arg;
> > > +   struct gic_v3_irqsrc *gi;
> > > +   uint64_t active_irq;
> > > +   struct trapframe *tf;
> > > +   bool first;
> > > +
> > > +   first = true;
> > > +
> > > +   while (1) {
> > > +   if (CPU_MATCH_ERRATA_CAVIUM_THUNDER_1_1) {
> > > +   /*
> > > +* Hardware:Cavium ThunderX
> > > +* Chip revision:   Pass 1.0 (early
> > > version)
> > > +*  Pass 1.1
> > > (production)
> > > +* ERRATUM: 22978, 23154
> > > +*/
> > > +   __asm __volatile(
> > > +   "nop;nop;nop;nop;nop;nop;nop;nop;   \n"
> > > +   "mrs %0, ICC_IAR1_EL1   \n"
> > > +   "nop;nop;nop;nop;   \n"
> > > +   "dsb sy \n"
> > > +   : "=" (active_irq));
> > > +   } else {
> > > +   active_irq = gic_icc_read(IAR1);
> > > +   }
> > > +
> > > +   if (__predict_false(active_irq >= sc->gic_nirqs))
> > > +   return (FILTER_HANDLED);
> > >
> >
> > IMHO this is not true. Active IRQ could be much bigger than number of
> > supported IRQs. We are asking for debugging in the future when we
> > enable ITS.
>
> It is correct, the ITS change to this file is missing so we are unable
> to enable ITS interrupts.
>
>
In general it is not correct in terms of GICv3 but in that particular case.
So it would be good to have a "ARM64TODO" comment here.


> ...
> > > +
> > > +#ifdef FDT
> > > +static int
> > > +gic_map_fdt(device_t dev, u_int ncells, pcell_t *cells, u_int
> > > *irqp,
> > > +enum intr_polarity *polp, enum intr_trigger *trigp)
> > >
> >
> > All other functions are called gic_v3 and this one is just gic_
> > Why can't we move as much FDT code to the dedicated file which is
> > gic_v3_fdt.c?
>
> Unfortunately due to the current code in subr_intr.c this is needed for
> simplicity. It it my understanding there is work to fix this, so for
> now I would prefer to keep this.
>

OK.


>
> ...
> > > +   /* Set the trigger and polarity */
> > > +   if (irq <= GIC_LAST_PPI)
> > > +   reg = gic_r_read(sc, 4,
> > > +   GICR_SGI_BASE_SIZE + GICD_ICFGR(irq));
> > > +   else
> > > +   reg = gic_d_read(sc, 4, GICD_ICFGR(irq));
> > > +   if (trig == INTR_TRIGGER_LEVEL)
> > > +   reg &= ~(2 << ((irq % 16) * 2));
> > > +   else
> > > +   reg |= 2 << ((irq % 16) * 2);
> > >
> >
> > The rule of not using magic numbers does not apply here ;-) ?
>
> This is partially why this is still disabled by default, the code still
> needs a little polish, however it will be needed to help with a future
> review for changes to subr_intr.c.
>

So why do we integrate this WIP code now? Is there anyone else using INTRNG
on ARM64 beside you who need to test it?
I guess this is a matter of opinion but it would be much more convenient
(at least for us) if we get INTRNG in a single patch, review it, test it
and then change the existing code.


> ...
> > > +static void
> > > +gic_v3_disable_intr(device_t dev, struct intr_irqsrc *isrc)
> > > +{
> > > +   struct gic_v3_softc *sc;
> > > +   struct gic_v3_irqsrc *gi;
> > > +   u_int irq;
> > > +
> > > +   sc = device_get_softc(dev);
> > > +   gi = (struct gic_v3_irqsrc *)isrc;
> > > +   irq = gi->gi_irq;
> > > +
> > > +   if (irq <= GIC_LAST_PPI) {
> > > +   /* SGIs and PPIs in corresponding Re-Distributor 

svn commit: r300135 - head/sys/dev/sfxge

2016-05-18 Thread Andrew Rybchenko
Author: arybchik
Date: Wed May 18 09:57:11 2016
New Revision: 300135
URL: https://svnweb.freebsd.org/changeset/base/300135

Log:
  sfxge(4): cleanup: remove trailing whitespaces
  
  Sponsored by:   Solarflare Communications, Inc.
  MFC after:  1 week

Modified:
  head/sys/dev/sfxge/sfxge_rx.c

Modified: head/sys/dev/sfxge/sfxge_rx.c
==
--- head/sys/dev/sfxge/sfxge_rx.c   Wed May 18 08:29:39 2016
(r300134)
+++ head/sys/dev/sfxge/sfxge_rx.c   Wed May 18 09:57:11 2016
(r300135)
@@ -833,7 +833,7 @@ sfxge_rx_qcomplete(struct sfxge_rxq *rxq
if (rx_desc->flags & EFX_PKT_PREFIX_LEN) {
uint16_t tmp_size;
int rc;
-   rc = efx_psuedo_hdr_pkt_length_get(sc->enp, 
+   rc = efx_psuedo_hdr_pkt_length_get(sc->enp,
   mtod(m, uint8_t *),
   _size);
KASSERT(rc == 0, ("cannot get packet length: %d", rc));
@@ -1100,7 +1100,7 @@ sfxge_rx_start(struct sfxge_softc *sc)
EFSYS_ASSERT(ISP2(align));
sc->rx_buffer_size = P2ROUNDUP(sc->rx_buffer_size, align);
 
-   /* 
+   /*
 * Standard mbuf zones only guarantee pointer-size alignment;
 * we need extra space to align to the cache line
 */
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r299371 - in head: sbin/camcontrol sys/cam sys/cam/scsi

2016-05-18 Thread Edward Tomasz Napierała
On 0517T1158, Warner Losh wrote:
> On Tue, May 10, 2016 at 11:33 AM, Edward Tomasz Napierala  > wrote:
> 
> > On 0510T1020, Alan Somers wrote:
> > > On Tue, May 10, 2016 at 9:46 AM, Edward Tomasz Napierala <
> > tr...@freebsd.org>
> > > wrote:
> > >
> > > > Author: trasz
> > > > Date: Tue May 10 15:46:33 2016
> > > > New Revision: 299371
> > > > URL: https://svnweb.freebsd.org/changeset/base/299371
> > > >
> > > > Log:
> > > >   Add "camcontrol reprobe" subcommand, and implement it for da(4).
> > > >   This makes it possible to manually force updating capacity data
> > > >   after the disk got resized. Without it it might be neccessary to
> > > >   reboot before FreeBSD notices updated disk size under eg VMWare.
> > > >
> > > >   Discussed with:   imp@
> > > >   MFC after:1 month
> > > >   Sponsored by: The FreeBSD Foundation
> > > >   Differential Revision:https://reviews.freebsd.org/D6108
> > > >
> > > > Modified:
> > > >   head/sbin/camcontrol/camcontrol.8
> > > >   head/sbin/camcontrol/camcontrol.c
> > > >   head/sys/cam/cam_ccb.h
> > > >   head/sys/cam/cam_xpt.c
> > > >   head/sys/cam/scsi/scsi_da.c
> > > >
> > > >
> > >
> > > I too have been annoyed that "camcontrol rescan" won't update capacity
> > > data.  But could we solve the problem by simply adding logic to
> > "camcontrol
> > > rescan" instead of adding an entirely new command?  Would a user ever
> > want
> > > to rescan a device without reprobing it too?
> >
> > Two reasons.  First, I want to be able to pass the device name (like
> > 'da0') and not the CAM path (like 1:0:0) for usability reasons - it seems
> > easy to figure out the latter from the former, using "camcontrol devlist",
> > but it suddenly becomes complicated when you try to explain it in a man
> > page.
> 
> 
> You can look up one or the other. fwdownload uses the daX name.

Indeed.  But it would mean fixing "camcontrol rescan" first.

> > Second - I don't understand the "camcontrol rescan" logic well
> > enough, and "camcontrol rescan all" sometimes fails for me anyway,
> > in a way I'm not sure how to debug.
> >
> 
> That's a cop-out. CAM is hard, but if you aren't willing to figure itout,
> adding hacks that the other CAM maintainers have to cope with doesn't
> help.

That's true.  However, this hack is pretty non-intrusive - it only adds
a trivial amount of code, and the "reprobe" command could be replaced
with a simple alias to "rescan" if someone steps up to reimplement it.

> Also, to be honest I'm not sure those two are actually that related.
> > Rescanning is about discovering new devices on the bus.  "Reprobe"
> > is about updating... well, mostly updating the capacity.  The former
> > requires enumerating the bus using a mechanism built into XPT; the
> > latter is just notifying the periph driver (in this case da(4)) that
> > it needs to query the capacity and call disk_resize(4).
> >
> 
> The two are very related. Now we have two stupid paths in CAM instead of
> one.

We have two clearly separated code paths, doing completely different
things - one scanning the bus, and only notifying periph drivers if
new device is discovered, and the other one to notify existing periph
driver instances, without scanning anything.  I just don't see how
entangling them with each other would improve things.

> and you didn't do ada like I asked.

As I said in review, the ada(4) driver seems to lack resizing
capability.  It doesn't contain a call to disk_resize(9).  It's been
a few years since I've added resizing to da(4), but it took quite 
some time to make sure it interfaces with existing code in exactly
the right way.  I just don't have time for this kind of side quest
right now.  And I'm not even sure how to test it.  With da(4) it
was easy - I've just added LUN resizing to CTL.

> Not happy with this at all, but not asking for a back out.

Thanks.

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


svn commit: r300134 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2016-05-18 Thread Andriy Gapon
Author: avg
Date: Wed May 18 08:29:39 2016
New Revision: 300134
URL: https://svnweb.freebsd.org/changeset/base/300134

Log:
  move zfsctl_freebsd_root_lookup right next to zfsctl_root_lookup
  
  That makes it easier to reason about the code.
  
  MFC after:5 weeks

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.cWed May 
18 08:26:09 2016(r300133)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.cWed May 
18 08:29:39 2016(r300134)
@@ -540,46 +540,7 @@ zfsctl_root_lookup(vnode_t *dvp, char *n
return (err);
 }
 
-#ifdef illumos
 static int
-zfsctl_pathconf(vnode_t *vp, int cmd, ulong_t *valp, cred_t *cr,
-caller_context_t *ct)
-{
-   /*
-* We only care about ACL_ENABLED so that libsec can
-* display ACL correctly and not default to POSIX draft.
-*/
-   if (cmd == _PC_ACL_ENABLED) {
-   *valp = _ACL_ACE_ENABLED;
-   return (0);
-   }
-
-   return (fs_pathconf(vp, cmd, valp, cr, ct));
-}
-#endif /* illumos */
-
-#ifdef illumos
-static const fs_operation_def_t zfsctl_tops_root[] = {
-   { VOPNAME_OPEN, { .vop_open = zfsctl_common_open }  },
-   { VOPNAME_CLOSE,{ .vop_close = zfsctl_common_close }},
-   { VOPNAME_IOCTL,{ .error = fs_inval }   },
-   { VOPNAME_GETATTR,  { .vop_getattr = zfsctl_root_getattr }  },
-   { VOPNAME_ACCESS,   { .vop_access = zfsctl_common_access }  },
-   { VOPNAME_READDIR,  { .vop_readdir = gfs_vop_readdir }  },
-   { VOPNAME_LOOKUP,   { .vop_lookup = zfsctl_root_lookup }},
-   { VOPNAME_SEEK, { .vop_seek = fs_seek } },
-   { VOPNAME_INACTIVE, { .vop_inactive = gfs_vop_inactive }},
-   { VOPNAME_PATHCONF, { .vop_pathconf = zfsctl_pathconf } },
-   { VOPNAME_FID,  { .vop_fid = zfsctl_common_fid  }   },
-   { NULL }
-};
-#endif /* illumos */
-
-/*
- * Special case the handling of "..".
- */
-/* ARGSUSED */
-int
 zfsctl_freebsd_root_lookup(ap)
struct vop_lookup_args /* {
struct vnode *a_dvp;
@@ -623,6 +584,41 @@ relookup:
return (err);
 }
 
+#ifdef illumos
+static int
+zfsctl_pathconf(vnode_t *vp, int cmd, ulong_t *valp, cred_t *cr,
+caller_context_t *ct)
+{
+   /*
+* We only care about ACL_ENABLED so that libsec can
+* display ACL correctly and not default to POSIX draft.
+*/
+   if (cmd == _PC_ACL_ENABLED) {
+   *valp = _ACL_ACE_ENABLED;
+   return (0);
+   }
+
+   return (fs_pathconf(vp, cmd, valp, cr, ct));
+}
+#endif /* illumos */
+
+#ifdef illumos
+static const fs_operation_def_t zfsctl_tops_root[] = {
+   { VOPNAME_OPEN, { .vop_open = zfsctl_common_open }  },
+   { VOPNAME_CLOSE,{ .vop_close = zfsctl_common_close }},
+   { VOPNAME_IOCTL,{ .error = fs_inval }   },
+   { VOPNAME_GETATTR,  { .vop_getattr = zfsctl_root_getattr }  },
+   { VOPNAME_ACCESS,   { .vop_access = zfsctl_common_access }  },
+   { VOPNAME_READDIR,  { .vop_readdir = gfs_vop_readdir }  },
+   { VOPNAME_LOOKUP,   { .vop_lookup = zfsctl_root_lookup }},
+   { VOPNAME_SEEK, { .vop_seek = fs_seek } },
+   { VOPNAME_INACTIVE, { .vop_inactive = gfs_vop_inactive }},
+   { VOPNAME_PATHCONF, { .vop_pathconf = zfsctl_pathconf } },
+   { VOPNAME_FID,  { .vop_fid = zfsctl_common_fid  }   },
+   { NULL }
+};
+#endif /* illumos */
+
 static struct vop_vector zfsctl_ops_root = {
.vop_default =  _vnodeops,
.vop_open = zfsctl_common_open,
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r300133 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2016-05-18 Thread Andriy Gapon
Author: avg
Date: Wed May 18 08:26:09 2016
New Revision: 300133
URL: https://svnweb.freebsd.org/changeset/base/300133

Log:
  zfsctl_common_fid: remove redundant assignment
  
  "Reinterpret cast" to zfid_short_t and assignment of zf_len
  do the job already.
  
  MFC after:1 week

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.cWed May 
18 08:23:39 2016(r300132)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.cWed May 
18 08:26:09 2016(r300133)
@@ -404,8 +404,6 @@ zfsctl_common_fid(ap)
ZFS_EXIT(zfsvfs);
return (SET_ERROR(ENOSPC));
}
-#else
-   fidp->fid_len = SHORT_FID_LEN;
 #endif
 
zfid = (zfid_short_t *)fidp;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r300132 - in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys

2016-05-18 Thread Andriy Gapon
Author: avg
Date: Wed May 18 08:23:39 2016
New Revision: 300132
URL: https://svnweb.freebsd.org/changeset/base/300132

Log:
  zfsctl: tighten an assertion and remove an unused definition
  
  There are only two entries under .zfs and 'shares' has an ID of a
  special persistent object in its filesystem.
  
  MFC after:1 week

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_ctldir.h
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_ctldir.h
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_ctldir.h
Wed May 18 08:19:41 2016(r300131)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_ctldir.h
Wed May 18 08:23:39 2016(r300132)
@@ -61,7 +61,6 @@ int zfsctl_lookup_objset(vfs_t *vfsp, ui
 
 #defineZFSCTL_INO_ROOT 0x1
 #defineZFSCTL_INO_SNAPDIR  0x2
-#defineZFSCTL_INO_SHARES   0x3
 
 #ifdef __cplusplus
 }

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.cWed May 
18 08:19:41 2016(r300131)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.cWed May 
18 08:23:39 2016(r300132)
@@ -223,7 +223,7 @@ zfsctl_root_inode_cb(vnode_t *vp, int in
 {
zfsvfs_t *zfsvfs = vp->v_vfsp->vfs_data;
 
-   ASSERT(index <= 2);
+   ASSERT(index < 2);
 
if (index == 0)
return (ZFSCTL_INO_SNAPDIR);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r300131 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2016-05-18 Thread Andriy Gapon
Author: avg
Date: Wed May 18 08:19:41 2016
New Revision: 300131
URL: https://svnweb.freebsd.org/changeset/base/300131

Log:
  zfs_root: no need to set the root flag here
  
  That was both redundant as zfs_znode_sa_init() already does the job and
  insufficient as the root vnode can be reached via other means.
  
  MFC after:1 weeks

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.cWed May 
18 08:02:49 2016(r300130)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.cWed May 
18 08:19:41 2016(r300131)
@@ -1780,11 +1780,8 @@ zfs_root(vfs_t *vfsp, int flags, vnode_t
 
ZFS_EXIT(zfsvfs);
 
-   if (error == 0) {
+   if (error == 0)
error = vn_lock(*vpp, flags);
-   if (error == 0)
-   (*vpp)->v_vflag |= VV_ROOT;
-   }
if (error != 0)
*vpp = NULL;
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


  1   2   >