Re: if_bridge FreeBSD 6.0 on a Broadcom interface not working

2006-01-13 Thread Andrew Thompson
On Thu, Jan 12, 2006 at 09:30:32PM -0500, Bruce Walker wrote:
> Andrew Thompson wrote:
> > 
> >if_bridge doesnt handle interfaces with TXCSUM at the moment, you can
> >work around this by clearing this with 'ifconfig xxx -txcsum', where xxx
> >is your em or bge card.
> >
> >Im testing a patch to fix this.
> 
> W00t!  :-)  That's it; perfect. No checksum errors, and bridging works 
> great.
> 
> I'll watch for your patch and test it asap.
> 

Can you give this patch a test. Im a bit concerned that the conditional
grabbing of Giant may cause a LOR, witness didnt complain with
debug.mpsafenet=0


cheers,
Andrew
Index: if_bridge.c
===
RCS file: /home/ncvs/src/sys/net/if_bridge.c,v
retrieving revision 1.49
diff -u -p -r1.49 if_bridge.c
--- if_bridge.c 2 Jan 2006 23:02:43 -   1.49
+++ if_bridge.c 13 Jan 2006 10:01:02 -
@@ -170,6 +170,11 @@ __FBSDID("$FreeBSD: src/sys/net/if_bridg
 #defineBRIDGE_RTABLE_PRUNE_PERIOD  (5 * 60)
 #endif
 
+/*
+ * List of capabilities to mask on the member interface.
+ */
+#defineBRIDGE_IFCAPS_MASK  IFCAP_TXCSUM
+
 static struct mtx  bridge_list_mtx;
 eventhandler_tag   bridge_detach_cookie = NULL;
 
@@ -181,6 +186,7 @@ static int  bridge_clone_create(struct if
 static voidbridge_clone_destroy(struct ifnet *);
 
 static int bridge_ioctl(struct ifnet *, u_long, caddr_t);
+static voidbridge_mutecaps(struct bridge_iflist *, int);
 static voidbridge_ifdetach(void *arg __unused, struct ifnet *);
 static voidbridge_init(void *);
 static voidbridge_dummynet(struct mbuf *, struct ifnet *);
@@ -665,6 +671,42 @@ bridge_ioctl(struct ifnet *ifp, u_long c
 }
 
 /*
+ * bridge_mutecaps:
+ *
+ * Clear or restore unwanted capabilities on the member interface
+ */
+static void
+bridge_mutecaps(struct bridge_iflist *bif, int mute)
+{
+   struct ifnet *ifp = bif->bif_ifp;
+   struct ifreq ifr;
+   int error;
+
+   if (ifp->if_ioctl == NULL)
+   return;
+
+   bzero(&ifr, sizeof ifr);
+   ifr.ifr_reqcap = ifp->if_capenable;
+
+   if (mute) {
+   /* mask off and save capabilities */
+   bif->bif_mutecap = ifr.ifr_reqcap & BRIDGE_IFCAPS_MASK;
+   if (bif->bif_mutecap != 0)
+   ifr.ifr_reqcap &= ~BRIDGE_IFCAPS_MASK;
+   } else
+   /* restore muted capabilities */
+   ifr.ifr_reqcap |= bif->bif_mutecap;
+
+
+   if (bif->bif_mutecap != 0) {
+   IFF_LOCKGIANT(ifp);
+   error = (*ifp->if_ioctl)(ifp, SIOCSIFCAP, (caddr_t)&ifr);
+   IFF_UNLOCKGIANT(ifp);
+   }
+}
+   
+
+/*
  * bridge_lookup_member:
  *
  * Lookup a bridge member interface.
@@ -727,6 +769,7 @@ bridge_delete_member(struct bridge_softc
 * Take the interface out of promiscuous mode.
 */
(void) ifpromisc(ifs, 0);
+   bridge_mutecaps(bif, 0);
break;
 
case IFT_GIF:
@@ -810,6 +853,11 @@ bridge_ioctl_add(struct bridge_softc *sc
if (bif == NULL)
return (ENOMEM);
 
+   bif->bif_ifp = ifs;
+   bif->bif_flags = IFBIF_LEARNING | IFBIF_DISCOVER;
+   bif->bif_priority = BSTP_DEFAULT_PORT_PRIORITY;
+   bif->bif_path_cost = BSTP_DEFAULT_PATH_COST;
+
switch (ifs->if_type) {
case IFT_ETHER:
case IFT_L2VLAN:
@@ -819,6 +867,8 @@ bridge_ioctl_add(struct bridge_softc *sc
error = ifpromisc(ifs, 1);
if (error)
goto out;
+
+   bridge_mutecaps(bif, 1);
break;
 
case IFT_GIF:
@@ -829,11 +879,6 @@ bridge_ioctl_add(struct bridge_softc *sc
goto out;
}
 
-   bif->bif_ifp = ifs;
-   bif->bif_flags = IFBIF_LEARNING | IFBIF_DISCOVER;
-   bif->bif_priority = BSTP_DEFAULT_PORT_PRIORITY;
-   bif->bif_path_cost = BSTP_DEFAULT_PATH_COST;
-
ifs->if_bridge = sc;
/*
 * XXX: XLOCK HERE!?!
@@ -1436,11 +1481,6 @@ bridge_enqueue(struct bridge_softc *sc, 
int len, err;
short mflags;
 
-   /*
-* Clear any in-bound checksum flags for this packet.
-*/
-   m->m_pkthdr.csum_flags = 0;
-
len = m->m_pkthdr.len;
mflags = m->m_flags;
 
Index: if_bridgevar.h
===
RCS file: /home/ncvs/src/sys/net/if_bridgevar.h,v
retrieving revision 1.9
diff -u -p -r1.9 if_bridgevar.h
--- if_bridgevar.h  2 Jan 2006 09:50:34 -   1.9
+++ if_bridgevar.h  13 Jan 2006 04:02:10 -
@@ -248,6 +248,7 @@ struct bridge_iflist {
uint8_t bif_priority;
struct ifnet*bif_ifp;   /* member if */
uint32_tbif_flags;  /* member if flags */
+   int bi

problems installing zebra on FreeBSD 5.3

2006-01-13 Thread homayoun
Hi guys

I have FreeBSD 5.3 installed. I wanted to install zebra. I tried to install
using the ports colection however i started to get errors. The errors were
that pam_misc.h and a few other files were missing. I then found these files
and put them where they were supposed to be. Thinking there would be no
problems after this i made a make command. However i now am getting the
followine error:

===>  Building for zebra-0.95_2
make  all-recursive
Making all in lib
Making all in zebra
Making all in bgpd
Making all in ripd
Making all in ripngd
Making all in ospfd
Making all in ospf6d
Making all in vtysh
cc  -O -pipe  -I/usr/local/include -I/usr/local/include/ucd-snmp   -o vtysh
vtysh_main.o vtysh.o  vtysh_cmd.o vtysh_user.o vtysh_config.o
../lib/libzebra.a -lm -lcrypt  -lreadline -ltinfo  -L/usr/local/lib -lcrypto
 -lsnmp  -lpam -lpam_misc
/usr/bin/ld: cannot find -lpam_misc
*** Error code 1

Stop in /usr/ports/net/zebra/work/zebra-0.95/vtysh.
*** Error code 1

Stop in /usr/ports/net/zebra/work/zebra-0.95.
*** Error code 1

Stop in /usr/ports/net/zebra/work/zebra-0.95.
*** Error code 1

Stop in /usr/ports/net/zebra.
*** Error code 1

Stop in /usr/ports/net/zebra.

A search on google only turned out 1 useful comment about the error. This
was if pam authentiaction was not needed then to disable it but this had no
bearings on the outcome and i was left with the same error message.

Can anyone help me?

Homayoun

___
freebsd-net@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-net
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: problems installing zebra on FreeBSD 5.3

2006-01-13 Thread Marcin Jessa
On Fri, 13 Jan 2006 15:15:40 -
"homayoun" <[EMAIL PROTECTED]> wrote:

> Hi guys
> 
> I have FreeBSD 5.3 installed. I wanted to install zebra. I tried to
> install using the ports colection however i started to get errors.

Email the port maintainer and/or ports@
freebsd-net@ is not appropriate for debugging of ports.


Marcin
___
freebsd-net@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-net
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: bge BCM5721/BCM5750 fixes to work with IPMI

2006-01-13 Thread Doug Ambrisko
Doug Ambrisko writes:
| Here are some first pass patches to make the bge driver not break IPMI.
| This was tested on a Dell PE850:
|   bge0:  mem 
0xfe6f-0xfe6f irq 16 at device 0.0 on pci4
|   miibus1:  on bge0
|   brgphy0:  on miibus1
|   brgphy0:  10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseTX, 
1000baseTX-FDX, auto
| 
| It shouldn't break other bge cards and it might work with other Broadcom
| IPMI capable chips (they seem to have different usages).  Please let me know 
| how this goes.
| 
| I gleaned this info. from the Linux drivers.  YMMV. 

I have an updated patch for -current as of today and fixed some issues.
It's getting closer to something that is final.  The only issues are 
"sharing" access to the PHY since both the device driver and the ASF/IPMI 
internal firmware stack also talks to the PHY.  If this is not done 
carefully it can take the chip off the net.  It can also return bogus 
values randomly due to contention.  Broadcom's Linux driver just skips 
talking to it at times and returns the expected values.  I've tried my 
best at dealing with this.  I need to get some doc's that might explain 
how we can share talking to the PHY rather then guessing.  This now works 
after PXE and non PXE boots and with chips not running the internal 
ASF/IPMI stack.

Let me know if it causes problems or works.

Doug A.

Index: if_bge.c
===
RCS file: /usr/local/cvsroot/freebsd/src/sys/dev/bge/if_bge.c,v
retrieving revision 1.113
diff -u -p -r1.113 if_bge.c
--- if_bge.c13 Jan 2006 08:59:40 -  1.113
+++ if_bge.c13 Jan 2006 21:52:53 -
@@ -271,7 +271,12 @@ static void bge_poll_locked(struct ifne
int count);
 #endif
 
-static void bge_reset  (struct bge_softc *);
+#define BGE_RESET_START 1
+#define BGE_RESET_STOP  2
+static void bge_sig_post_reset(struct bge_softc *, int);
+static void bge_sig_legacy(struct bge_softc *, int);
+static void bge_sig_pre_reset(struct bge_softc *, int);
+static int bge_reset   (struct bge_softc *);
 static void bge_link_upd   (struct bge_softc *);
 
 static device_method_t bge_methods[] = {
@@ -579,6 +584,15 @@ bge_miibus_readreg(dev, phy, reg)
if (phy != 1)
return(0);
 
+   if (sc->bge_asf_mode & ASF_STACKUP) {
+   BGE_CLRBIT(sc, BGE_MODE_CTL, BGE_MODECTL_STACKUP);
+   for (i = 0; i < BGE_TIMEOUT; i++) {
+   val = CSR_READ_4(sc, BGE_MI_COMM);
+   if (!(val & BGE_MICOMM_BUSY))
+   break;
+   }
+   }
+
/* Reading with autopolling on may trigger PCI errors */
autopoll = CSR_READ_4(sc, BGE_MI_MODE);
if (autopoll & BGE_MIMODE_AUTOPOLL) {
@@ -609,6 +623,26 @@ done:
DELAY(40);
}
 
+   if (sc->bge_asf_mode & ASF_STACKUP)
+   BGE_SETBIT(sc, BGE_MODE_CTL, BGE_MODECTL_STACKUP);
+if (sc->bge_asf_mode & ASF_STACKUP
+   && pci_get_device(sc->bge_dev) == BCOM_DEVICEID_BCM5721) {
+   switch (reg) {
+case MII_PHYIDR1:
+val = 0x0020;
+   break;
+case MII_PHYIDR2:
+val = 0x6180;
+   break; 
+case MII_BMSR:
+   val |= BMSR_100TXFDX | BMSR_100TXHDX | BMSR_10TFDX
+   | BMSR_10THDX | BMSR_EXTSTAT
+   | BMSR_MFPS
+   | BMSR_ANEG | BMSR_EXTCAP;
+   break;
+   }
+}
+
if (val & BGE_MICOMM_READFAIL)
return(0);
 
@@ -626,6 +660,15 @@ bge_miibus_writereg(dev, phy, reg, val)
 
sc = device_get_softc(dev);
 
+   if (sc->bge_asf_mode & ASF_STACKUP) {
+   BGE_CLRBIT(sc, BGE_MODE_CTL, BGE_MODECTL_STACKUP);
+   for (i = 0; i < BGE_TIMEOUT; i++) {
+   val = CSR_READ_4(sc, BGE_MI_COMM);
+   if (!(val & BGE_MICOMM_BUSY))
+   break;
+   }
+   }
+
/* Reading with autopolling on may trigger PCI errors */
autopoll = CSR_READ_4(sc, BGE_MI_MODE);
if (autopoll & BGE_MIMODE_AUTOPOLL) {
@@ -646,6 +689,9 @@ bge_miibus_writereg(dev, phy, reg, val)
DELAY(40);
}
 
+   if (sc->bge_asf_mode & ASF_STACKUP)
+   BGE_SETBIT(sc, BGE_MODE_CTL, BGE_MODECTL_STACKUP);
+
if (i == BGE_TIMEOUT) {
if_printf(sc->bge_ifp, "PHY read timed out\n");
return(0);
@@ -660,10 +706,21 @@ bge_miibus_statchg(dev)
 {
struct bge_softc *sc;
struct mii_data *mii;
+   int i, val;
 
sc = device_get_softc(dev);
mii = device_get_softc(sc->bge_miibus);
 
+
+   if (sc->bge_asf_mode & ASF_STACKUP) {
+   BGE_CLRBIT