Re: bge: don't use autopoll on anything above BCM5705

2013-05-29 Thread David Gwynne
ive tested this on:

bge0 at pci4 dev 0 function 0 Broadcom BCM5721 rev 0x21, BCM5750 C1 (0x4201): 
apic 0 int 16, address 00:18:f3:d1:80:64
brgphy0 at bge0 phy 1: BCM5750 10/100/1000baseT PHY, rev. 0

bge1 at pci5 dev 0 function 0 Broadcom BCM5720 rev 0x00, BCM5720 A0 
(0x572), APE firmware NCSI 1.0.85.0: apic 0 int 16, address 
d4:ae:52:a7:05:38
brgphy1 at bge1 phy 1: BCM5720C 10/100/1000baseT PHY, rev. 0
bge2 at pci5 dev 0 function 1 Broadcom BCM5720 rev 0x00, BCM5720 A0 
(0x572), APE firmware NCSI 1.0.85.0: apic 0 int 17, address 
d4:ae:52:a7:05:39
brgphy2 at bge2 phy 2: BCM5720C 10/100/1000baseT PHY, rev. 0

bge0 at pci3 dev 4 function 0 Broadcom BCM5714 rev 0xa3, BCM5715 A3 (0x9003): 
ivec 0x795, address 00:14:4f:a9:34:90
brgphy0 at bge0 phy 1: BCM5714 10/100/1000baseT/SX PHY, rev. 0
bge1 at pci3 dev 4 function 1 Broadcom BCM5714 rev 0xa3, BCM5715 A3 (0x9003): 
ivec 0x796, address 00:14:4f:a9:34:91
brgphy1 at bge1 phy 1: BCM5714 10/100/1000baseT/SX PHY, rev. 0

bge2 at pci7 dev 0 function 0 Broadcom BCM5719 rev 0x01, unknown BCM5719 
(0x5719001), APE firmware NCSI 1.0.60.0: ivec 0x795, address 00:10:18:e5:e1:b8
brgphy2 at bge2 phy 1: BCM5719C 10/100/1000baseT PHY, rev. 0
bge3 at pci7 dev 0 function 1 Broadcom BCM5719 rev 0x01, unknown BCM5719 
(0x5719001), APE firmware NCSI 1.0.60.0: ivec 0x796, address 00:10:18:e5:e1:b9
brgphy3 at bge3 phy 2: BCM5719C 10/100/1000baseT PHY, rev. 0
bge4 at pci7 dev 0 function 2 Broadcom BCM5719 rev 0x01, unknown BCM5719 
(0x5719001), APE firmware NCSI 1.0.60.0: ivec 0x795, address 00:10:18:e5:e1:ba
brgphy4 at bge4 phy 3: BCM5719C 10/100/1000baseT PHY, rev. 0
bge5 at pci7 dev 0 function 3 Broadcom BCM5719 rev 0x01, unknown BCM5719 
(0x5719001), APE firmware NCSI 1.0.60.0: ivec 0x796, address 00:10:18:e5:e1:bb
brgphy5 at bge5 phy 4: BCM5719C 10/100/1000baseT PHY, rev. 0
bge6 at pci13 dev 4 function 0 Broadcom BCM5714 rev 0xa3, BCM5715 A3 
(0x9003): ivec 0x7d6, address 00:14:4f:a9:34:92

working fine on each of them.

makes sense to me. ok.

On 28/05/2013, at 12:53 AM, Mike Belopuhov m...@belopuhov.com wrote:

 Hi,
 
 While trying to fix the link state bug on BCM5719, David Imhoff
 has arrived at conclusion that the chip won't generate proper
 link state interrupts which renders auto-polling mode useless.
 
 As it turns out neither Linux nor FreeBSD use auto-polling mode
 for anything newer than BCM5705 and recent Broadcom documentation
 is not describing this method at all.
 
 This diff brings us in line with others, but requires heavy
 testing on currently supported hardware.
 
 OK's are welcome as well.
 
 diff --git sys/dev/pci/if_bge.c sys/dev/pci/if_bge.c
 index 1d37192..8007108 100644
 --- sys/dev/pci/if_bge.c
 +++ sys/dev/pci/if_bge.c
 @@ -1055,10 +1055,22 @@ bge_miibus_statchg(struct device *dev)
   (mii-mii_media_active  IFM_ETH_FMASK) != sc-bge_flowflags) {
   sc-bge_flowflags = mii-mii_media_active  IFM_ETH_FMASK;
   mii-mii_media_active = ~IFM_ETH_FMASK;
   }
 
 + if (!BGE_STS_BIT(sc, BGE_STS_LINK) 
 + mii-mii_media_status  IFM_ACTIVE 
 + IFM_SUBTYPE(mii-mii_media_active) != IFM_NONE)
 + BGE_STS_SETBIT(sc, BGE_STS_LINK);
 + else if (BGE_STS_BIT(sc, BGE_STS_LINK) 
 + (!(mii-mii_media_status  IFM_ACTIVE) ||
 + IFM_SUBTYPE(mii-mii_media_active) == IFM_NONE))
 + BGE_STS_CLRBIT(sc, BGE_STS_LINK);
 +
 + if (!BGE_STS_BIT(sc, BGE_STS_LINK))
 + return;
 +
   /* Set the port mode (MII/GMII) to match the link speed. */
   mac_mode = CSR_READ_4(sc, BGE_MAC_MODE) 
   ~(BGE_MACMODE_PORTMODE | BGE_MACMODE_HALF_DUPLEX);
   tx_mode = CSR_READ_4(sc, BGE_TX_MODE);
   rx_mode = CSR_READ_4(sc, BGE_RX_MODE);
 @@ -1773,11 +1785,11 @@ int
 bge_blockinit(struct bge_softc *sc)
 {
   volatile struct bge_rcb *rcb;
   vaddr_t rcb_addr;
   bge_hostaddrtaddr;
 - u_int32_t   dmactl, val;
 + u_int32_t   dmactl, mimode, val;
   int i, limit;
 
   /*
* Initialize the memory window pointer register so that
* we can access the first 32K of internal NIC RAM. This will
 @@ -2369,13 +2381,23 @@ bge_blockinit(struct bge_softc *sc)
 
   /* Enable PHY auto polling (for MII/GMII only) */
   if (sc-bge_flags  BGE_PHY_FIBER_TBI) {
   CSR_WRITE_4(sc, BGE_MI_STS, BGE_MISTS_LINK);
   } else {
 - BGE_STS_SETBIT(sc, BGE_STS_AUTOPOLL);
 - BGE_SETBIT(sc, BGE_MI_MODE, BGE_MIMODE_AUTOPOLL|1016);
 - if (BGE_ASICREV(sc-bge_chipid) == BGE_ASICREV_BCM5700)
 + if ((sc-bge_flags  BGE_CPMU_PRESENT) != 0)
 + mimode = BGE_MIMODE_500KHZ_CONST;
 + else
 + mimode = BGE_MIMODE_BASE;
 + if (BGE_IS_5700_FAMILY(sc) ||
 + BGE_ASICREV(sc-bge_chipid) == BGE_ASICREV_BCM5705) {
 + mimode |= 

Re: bge: don't use autopoll on anything above BCM5705

2013-05-29 Thread Mike Belopuhov
On 29 May 2013 09:35, David Gwynne d...@openbsd.org wrote:
 ive tested this on:

 bge0 at pci4 dev 0 function 0 Broadcom BCM5721 rev 0x21, BCM5750 C1 
 (0x4201): apic 0 int 16, address 00:18:f3:d1:80:64
 brgphy0 at bge0 phy 1: BCM5750 10/100/1000baseT PHY, rev. 0

 bge1 at pci5 dev 0 function 0 Broadcom BCM5720 rev 0x00, BCM5720 A0 
 (0x572), APE firmware NCSI 1.0.85.0: apic 0 int 16, address 
 d4:ae:52:a7:05:38
 brgphy1 at bge1 phy 1: BCM5720C 10/100/1000baseT PHY, rev. 0
 bge2 at pci5 dev 0 function 1 Broadcom BCM5720 rev 0x00, BCM5720 A0 
 (0x572), APE firmware NCSI 1.0.85.0: apic 0 int 17, address 
 d4:ae:52:a7:05:39
 brgphy2 at bge2 phy 2: BCM5720C 10/100/1000baseT PHY, rev. 0

 bge0 at pci3 dev 4 function 0 Broadcom BCM5714 rev 0xa3, BCM5715 A3 
 (0x9003): ivec 0x795, address 00:14:4f:a9:34:90
 brgphy0 at bge0 phy 1: BCM5714 10/100/1000baseT/SX PHY, rev. 0
 bge1 at pci3 dev 4 function 1 Broadcom BCM5714 rev 0xa3, BCM5715 A3 
 (0x9003): ivec 0x796, address 00:14:4f:a9:34:91
 brgphy1 at bge1 phy 1: BCM5714 10/100/1000baseT/SX PHY, rev. 0

 bge2 at pci7 dev 0 function 0 Broadcom BCM5719 rev 0x01, unknown BCM5719 
 (0x5719001), APE firmware NCSI 1.0.60.0: ivec 0x795, address 00:10:18:e5:e1:b8
 brgphy2 at bge2 phy 1: BCM5719C 10/100/1000baseT PHY, rev. 0
 bge3 at pci7 dev 0 function 1 Broadcom BCM5719 rev 0x01, unknown BCM5719 
 (0x5719001), APE firmware NCSI 1.0.60.0: ivec 0x796, address 00:10:18:e5:e1:b9
 brgphy3 at bge3 phy 2: BCM5719C 10/100/1000baseT PHY, rev. 0
 bge4 at pci7 dev 0 function 2 Broadcom BCM5719 rev 0x01, unknown BCM5719 
 (0x5719001), APE firmware NCSI 1.0.60.0: ivec 0x795, address 00:10:18:e5:e1:ba
 brgphy4 at bge4 phy 3: BCM5719C 10/100/1000baseT PHY, rev. 0
 bge5 at pci7 dev 0 function 3 Broadcom BCM5719 rev 0x01, unknown BCM5719 
 (0x5719001), APE firmware NCSI 1.0.60.0: ivec 0x796, address 00:10:18:e5:e1:bb
 brgphy5 at bge5 phy 4: BCM5719C 10/100/1000baseT PHY, rev. 0
 bge6 at pci13 dev 4 function 0 Broadcom BCM5714 rev 0xa3, BCM5715 A3 
 (0x9003): ivec 0x7d6, address 00:14:4f:a9:34:92

 working fine on each of them.


cool, thanks! does your 5719 work w/o other diffs?

 makes sense to me. ok.




mg(1) dired opening ~/

2013-05-29 Thread Mark Lumsden
Currently dired mode doesn't use the adjustname() function early
enough when passed ~. For example typing 'M-x dired', then:

Dired: ~

Doesn't open your home directory. However, with this diff mg behaves
like emacs. 

ok?

mark

Index: dired.c
===
RCS file: /cvs/src/usr.bin/mg/dired.c,v
retrieving revision 1.56
diff -u -p -r1.56 dired.c
--- dired.c 29 May 2013 19:16:48 -  1.56
+++ dired.c 29 May 2013 19:38:33 -
@@ -754,11 +754,6 @@ dired_(char *dname)
int  i;
size_t   len;
 
-   if ((access(dname, R_OK | X_OK)) == -1) {
-   if (errno == EACCES)
-   ewprintf(Permission denied);
-   return (NULL);
-   }
if ((dname = adjustname(dname, FALSE)) == NULL) {
ewprintf(Bad directory name);
return (NULL);
@@ -768,6 +763,11 @@ dired_(char *dname)
if (dname[len - 1] != '/') {
dname[len++] = '/';
dname[len] = '\0';
+   }
+   if ((access(dname, R_OK | X_OK)) == -1) {
+   if (errno == EACCES)
+   ewprintf(Permission denied);
+   return (NULL);
}
if ((bp = findbuffer(dname)) == NULL) {
ewprintf(Could not create buffer);



pflow and NAT

2013-05-29 Thread Chris Cappuccio
I upgraded a 4.9 box to 5.3 recently and found pflow is behaving
in new ways.

Pflow used to report the source IP before NAT was performed. Today, it 
reports the translated source IP rather than the untranslated one. I was
using it to keep a record of NAT translations, which isn't possible now.

Anyone know if this was a desired, or an accidental change ?



Re: bge: don't use autopoll on anything above BCM5705

2013-05-29 Thread David Gwynne

On 30/05/2013, at 2:56 AM, Mike Belopuhov m...@belopuhov.com wrote:
 
 cool, thanks! does your 5719 work w/o other diffs?

yes, otherwise i would have fixed it :)

dlg



mg(1) - use more adjustname() in dired

2013-05-29 Thread Mark Lumsden
The dired-copy-file and dired-rename-file commands do not use
adjustname() for the new path. Hence 'M-x dired-copy-file':

Dired: ~/filename

will not work. This diff fixes that behaviour. ok?

mark

Index: dired.c
===
RCS file: /cvs/src/usr.bin/mg/dired.c,v
retrieving revision 1.58
diff -u -p -r1.58 dired.c
--- dired.c 30 May 2013 04:27:18 -  1.58
+++ dired.c 30 May 2013 04:42:38 -
@@ -398,10 +398,11 @@ d_expunge(int f, int n)
 int
 d_copy(int f, int n)
 {
-   charfrname[NFILEN], toname[NFILEN], sname[NFILEN], *bufp;
-   int ret;
-   size_t  off;
-   struct buffer *bp;
+   char frname[NFILEN], toname[NFILEN], sname[NFILEN];
+   char*topath, *bufp;
+   int  ret;
+   size_t   off;
+   struct buffer   *bp;
 
if (d_makename(curwp-w_dotp, frname, sizeof(frname)) != FALSE) {
ewprintf(Not a file);
@@ -419,7 +420,9 @@ d_copy(int f, int n)
return (ABORT);
else if (bufp[0] == '\0')
return (FALSE);
-   ret = (copy(frname, toname) = 0) ? TRUE : FALSE;
+
+   topath = adjustname(toname, TRUE);
+   ret = (copy(frname, topath) = 0) ? TRUE : FALSE;
if (ret != TRUE)
return (ret);
if ((bp = refreshbuffer(curbp)) == NULL)
@@ -431,7 +434,8 @@ d_copy(int f, int n)
 int
 d_rename(int f, int n)
 {
-   char frname[NFILEN], toname[NFILEN], *bufp;
+   char frname[NFILEN], toname[NFILEN];
+   char*topath, *bufp;
int  ret;
size_t   off;
struct buffer   *bp;
@@ -453,7 +457,9 @@ d_rename(int f, int n)
return (ABORT);
else if (bufp[0] == '\0')
return (FALSE);
-   ret = (rename(frname, toname) = 0) ? TRUE : FALSE;
+
+   topath = adjustname(toname, TRUE);
+   ret = (rename(frname, topath) = 0) ? TRUE : FALSE;
if (ret != TRUE)
return (ret);
if ((bp = refreshbuffer(curbp)) == NULL)