summaryrefslogtreecommitdiffstats
path: root/sys/dev/fxp
diff options
context:
space:
mode:
authoryar <yar@FreeBSD.org>2004-05-25 14:49:46 +0000
committeryar <yar@FreeBSD.org>2004-05-25 14:49:46 +0000
commite12c97ac070c61c56e9e4b8e850ae984120726c9 (patch)
treee802fab9ea0f17521038e2fb8610578ba624d231 /sys/dev/fxp
parentbd82e3f62a435a5344e625c8f159c51f44e6a16c (diff)
downloadFreeBSD-src-e12c97ac070c61c56e9e4b8e850ae984120726c9.zip
FreeBSD-src-e12c97ac070c61c56e9e4b8e850ae984120726c9.tar.gz
Teach fxp(4) to control VLAN_MTU in the hardware.
Now reception of extended frames can be toggled through ioctl(SIOCSIFCAP). The card will also receive extended frames when in promiscuous mode.
Diffstat (limited to 'sys/dev/fxp')
-rw-r--r--sys/dev/fxp/if_fxp.c24
-rw-r--r--sys/dev/fxp/if_fxpvar.h1
2 files changed, 17 insertions, 8 deletions
diff --git a/sys/dev/fxp/if_fxp.c b/sys/dev/fxp/if_fxp.c
index 1f04d3a..17abcb0 100644
--- a/sys/dev/fxp/if_fxp.c
+++ b/sys/dev/fxp/if_fxp.c
@@ -595,9 +595,6 @@ fxp_attach(device_t dev)
/* turn on the extended TxCB feature */
sc->flags |= FXP_FLAG_EXT_TXCB;
-
- /* enable reception of long frames for VLAN */
- sc->flags |= FXP_FLAG_LONG_PKT_EN;
}
/*
@@ -823,7 +820,7 @@ fxp_attach(device_t dev)
*/
ifp->if_data.ifi_hdrlen = sizeof(struct ether_vlan_header);
ifp->if_capabilities |= IFCAP_VLAN_MTU;
- ifp->if_capenable |= IFCAP_VLAN_MTU;
+ /* this driver lets vlan(4) control the bit in if_capenable via ioctl */
/*
* Let the system queue as many packets as we have available
@@ -2086,7 +2083,7 @@ fxp_init_body(struct fxp_softc *sc)
cbp->ext_txcb_dis = sc->flags & FXP_FLAG_EXT_TXCB ? 0 : 1;
cbp->ext_stats_dis = 1; /* disable extended counters */
cbp->keep_overrun_rx = 0; /* don't pass overrun frames to host */
- cbp->save_bf = sc->revision == FXP_REV_82557 ? 1 : prm;
+ cbp->save_bf = sc->flags & FXP_FLAG_SAVE_BAD ? 1 : prm;
cbp->disc_short_rx = !prm; /* discard short packets */
cbp->underrun_retry = 1; /* retry mode (once) on DMA underrun */
cbp->two_frames = 0; /* do not limit FIFO to 2 frames */
@@ -2430,7 +2427,7 @@ fxp_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
struct fxp_softc *sc = ifp->if_softc;
struct ifreq *ifr = (struct ifreq *)data;
struct mii_data *mii;
- int s, error = 0;
+ int flag, mask, s, error = 0;
/*
* Detaching causes us to call ioctl with the mutex owned. Preclude
@@ -2496,8 +2493,19 @@ fxp_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
break;
case SIOCSIFCAP:
- ifp->if_capenable &= ~IFCAP_POLLING;
- ifp->if_capenable |= ifr->ifr_reqcap & IFCAP_POLLING;
+ mask = ifp->if_capenable ^ ifr->ifr_reqcap;
+ if (mask & IFCAP_POLLING)
+ ifp->if_capenable ^= IFCAP_POLLING;
+ if (mask & IFCAP_VLAN_MTU) {
+ ifp->if_capenable ^= IFCAP_VLAN_MTU;
+ if (sc->revision != FXP_REV_82557)
+ flag = FXP_FLAG_LONG_PKT_EN;
+ else /* a hack to get long frames on the old chip */
+ flag = FXP_FLAG_SAVE_BAD;
+ sc->flags ^= flag;
+ if (ifp->if_flags & IFF_UP)
+ fxp_init_body(sc);
+ }
break;
default:
diff --git a/sys/dev/fxp/if_fxpvar.h b/sys/dev/fxp/if_fxpvar.h
index afe7c48..7515861 100644
--- a/sys/dev/fxp/if_fxpvar.h
+++ b/sys/dev/fxp/if_fxpvar.h
@@ -209,6 +209,7 @@ struct fxp_softc {
#define FXP_FLAG_UCODE 0x0100 /* ucode is loaded */
#define FXP_FLAG_DEFERRED_RNR 0x0200 /* DEVICE_POLLING deferred RNR */
#define FXP_FLAG_EXT_RFA 0x0400 /* extended RFDs for csum offload */
+#define FXP_FLAG_SAVE_BAD 0x0800 /* save bad pkts: bad size, CRC, etc */
/* Macros to ease CSR access. */
#define CSR_READ_1(sc, reg) \
OpenPOWER on IntegriCloud