summaryrefslogtreecommitdiffstats
path: root/sys/dev/nge
diff options
context:
space:
mode:
authorsam <sam@FreeBSD.org>2002-11-14 23:54:55 +0000
committersam <sam@FreeBSD.org>2002-11-14 23:54:55 +0000
commit14c32b5f40c5ee3bd5649c3737f359f7e65e6944 (patch)
tree84eb7252cc6a518796c6bf88903ed6e2d12e7b91 /sys/dev/nge
parent10eb947d277840d02ef35d6c6303b64329d53806 (diff)
downloadFreeBSD-src-14c32b5f40c5ee3bd5649c3737f359f7e65e6944.zip
FreeBSD-src-14c32b5f40c5ee3bd5649c3737f359f7e65e6944.tar.gz
network interface driver changes:
o don't strip the Ethernet header from inbound packets; pass packets up the stack intact (required significant changes to some drivers) o reference common definitions in net/ethernet.h (e.g. ETHER_ALIGN) o track ether_ifattach/ether_ifdetach API changes o track bpf changes (use BPF_TAP and BPF_MTAP) o track vlan changes (ifnet capabilities, revised processing scheme, etc.) o use if_input to pass packets "up" o call ether_ioctl for default handling of ioctls Reviewed by: many Approved by: re
Diffstat (limited to 'sys/dev/nge')
-rw-r--r--sys/dev/nge/if_nge.c40
-rw-r--r--sys/dev/nge/if_ngereg.h1
2 files changed, 13 insertions, 28 deletions
diff --git a/sys/dev/nge/if_nge.c b/sys/dev/nge/if_nge.c
index b7af59a..c95aeee 100644
--- a/sys/dev/nge/if_nge.c
+++ b/sys/dev/nge/if_nge.c
@@ -977,7 +977,7 @@ nge_attach(dev)
ifp->if_baudrate = 1000000000;
ifp->if_snd.ifq_maxlen = NGE_TX_LIST_CNT - 1;
ifp->if_hwassist = NGE_CSUM_FEATURES;
- ifp->if_capabilities = IFCAP_HWCSUM;
+ ifp->if_capabilities = IFCAP_HWCSUM | IFCAP_VLAN_HWTAGGING;
ifp->if_capenable = ifp->if_capabilities;
/*
@@ -1031,7 +1031,7 @@ nge_attach(dev)
/*
* Call MI attach routine.
*/
- ether_ifattach(ifp, ETHER_BPF_SUPPORTED);
+ ether_ifattach(ifp, eaddr);
callout_handle_init(&sc->nge_stat_ch);
fail:
@@ -1056,7 +1056,7 @@ nge_detach(dev)
nge_reset(sc);
nge_stop(sc);
- ether_ifdetach(ifp, ETHER_BPF_SUPPORTED);
+ ether_ifdetach(ifp);
bus_generic_detach(dev);
if (!sc->nge_tbi) {
@@ -1326,7 +1326,6 @@ static void
nge_rxeof(sc)
struct nge_softc *sc;
{
- struct ether_header *eh;
struct mbuf *m;
struct ifnet *ifp;
struct nge_desc *cur_rx;
@@ -1402,10 +1401,6 @@ nge_rxeof(sc)
#endif
ifp->if_ipackets++;
- eh = mtod(m, struct ether_header *);
-
- /* Remove header from mbuf and pass it on. */
- m_adj(m, sizeof(struct ether_header));
/* Do IP checksum checking. */
if (extsts & NGE_RXEXTSTS_IPPKT)
@@ -1426,11 +1421,11 @@ nge_rxeof(sc)
* to vlan_input() instead of ether_input().
*/
if (extsts & NGE_RXEXTSTS_VLANPKT) {
- VLAN_INPUT_TAG(eh, m, extsts & NGE_RXEXTSTS_VTCI);
- continue;
- }
+ VLAN_INPUT_TAG(ifp, m,
+ extsts & NGE_RXEXTSTS_VTCI, continue);
+ }
- ether_input(ifp, eh, m);
+ (*ifp->if_input)(ifp, m);
}
sc->nge_cdata.nge_rx_prod = i;
@@ -1705,12 +1700,7 @@ nge_encap(sc, m_head, txidx)
struct nge_desc *f = NULL;
struct mbuf *m;
int frag, cur, cnt = 0;
- struct ifvlan *ifv = NULL;
-
- if ((m_head->m_flags & (M_PROTO1|M_PKTHDR)) == (M_PROTO1|M_PKTHDR) &&
- m_head->m_pkthdr.rcvif != NULL &&
- m_head->m_pkthdr.rcvif->if_type == IFT_L2VLAN)
- ifv = m_head->m_pkthdr.rcvif->if_softc;
+ struct m_tag *mtag;
/*
* Start packing the mbufs in this chain into
@@ -1752,9 +1742,10 @@ nge_encap(sc, m_head, txidx)
NGE_TXEXTSTS_UDPCSUM;
}
- if (ifv != NULL) {
+ mtag = VLAN_OUTPUT_TAG(&sc->arpcom.ac_if, m);
+ if (mtag != NULL) {
sc->nge_ldata->nge_tx_list[cur].nge_extsts |=
- (NGE_TXEXTSTS_VLANPKT|ifv->ifv_tag);
+ (NGE_TXEXTSTS_VLANPKT|VLAN_TAG_VALUE(mtag));
}
sc->nge_ldata->nge_tx_list[cur].nge_mbuf = m_head;
@@ -1806,8 +1797,7 @@ nge_start(ifp)
* If there's a BPF listener, bounce a copy of this frame
* to him.
*/
- if (ifp->if_bpf)
- bpf_mtap(ifp, m_head);
+ BPF_MTAP(ifp, m_head);
}
@@ -2140,10 +2130,6 @@ nge_ioctl(ifp, command, data)
s = splimp();
switch(command) {
- case SIOCSIFADDR:
- case SIOCGIFADDR:
- error = ether_ioctl(ifp, command, data);
- break;
case SIOCSIFMTU:
if (ifr->ifr_mtu > NGE_JUMBO_MTU)
error = EINVAL;
@@ -2204,7 +2190,7 @@ nge_ioctl(ifp, command, data)
}
break;
default:
- error = EINVAL;
+ error = ether_ioctl(ifp, command, data);
break;
}
diff --git a/sys/dev/nge/if_ngereg.h b/sys/dev/nge/if_ngereg.h
index 27ea49a..a5dc721 100644
--- a/sys/dev/nge/if_ngereg.h
+++ b/sys/dev/nge/if_ngereg.h
@@ -674,7 +674,6 @@ struct nge_softc {
bus_space_read_4(sc->nge_btag, sc->nge_bhandle, reg)
#define NGE_TIMEOUT 1000
-#define ETHER_ALIGN 2
#define NGE_RXLEN 1536
#define NGE_MIN_FRAMELEN 60
OpenPOWER on IntegriCloud