Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/ic Mask off extraneous bits in the RX frame status w...



details:   https://anonhg.NetBSD.org/src/rev/0a29df5be9c2
branches:  trunk
changeset: 532107:0a29df5be9c2
user:      mycroft <mycroft%NetBSD.org@localhost>
date:      Fri May 31 15:52:55 2002 +0000

description:
Mask off extraneous bits in the RX frame status when testing it.  My cards set
bit 3 in ad hoc mode.
Also, some minor constant folding.

diffstat:

 sys/dev/ic/wi.c |  18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)

diffs (46 lines):

diff -r 6caa823bc620 -r 0a29df5be9c2 sys/dev/ic/wi.c
--- a/sys/dev/ic/wi.c   Fri May 31 15:38:55 2002 +0000
+++ b/sys/dev/ic/wi.c   Fri May 31 15:52:55 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: wi.c,v 1.72 2002/04/18 05:24:28 onoe Exp $     */
+/*     $NetBSD: wi.c,v 1.73 2002/05/31 15:52:55 mycroft Exp $  */
 
 /*
  * Copyright (c) 1997, 1998, 1999
@@ -70,7 +70,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wi.c,v 1.72 2002/04/18 05:24:28 onoe Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wi.c,v 1.73 2002/05/31 15:52:55 mycroft Exp $");
 
 #define WI_HERMES_AUTOINC_WAR  /* Work around data write autoinc bug. */
 #define WI_HERMES_STATS_WAR    /* Work around stats counter bug. */
@@ -363,9 +363,9 @@
        eh = mtod(m, struct ether_header *);
        m->m_pkthdr.rcvif = ifp;
 
-       if (le16toh(rx_frame.wi_status) == WI_STAT_1042 ||
-           le16toh(rx_frame.wi_status) == WI_STAT_TUNNEL ||
-           le16toh(rx_frame.wi_status) == WI_STAT_WMP_MSG) {
+       if ((le16toh(rx_frame.wi_status) & WI_RXSTAT_MSG_TYPE) == WI_STAT_1042 ||
+           (le16toh(rx_frame.wi_status) & WI_RXSTAT_MSG_TYPE) == WI_STAT_TUNNEL ||
+           (le16toh(rx_frame.wi_status) & WI_RXSTAT_MSG_TYPE) == WI_STAT_WMP_MSG) {
                if ((le16toh(rx_frame.wi_dat_len) + WI_SNAPHDR_LEN) > MCLBYTES) {
                        printf("%s: oversized packet received "
                            "(wi_dat_len=%d, wi_status=0x%x)\n",
@@ -1844,10 +1844,10 @@
         * Use RFC1042 encoding for IP and ARP datagrams,
         * 802.3 for anything else.
         */
-       if (ntohs(eh->ether_type) == ETHERTYPE_IP ||
-           ntohs(eh->ether_type) == ETHERTYPE_ARP ||
-           ntohs(eh->ether_type) == ETHERTYPE_REVARP ||
-           ntohs(eh->ether_type) == ETHERTYPE_IPV6) {
+       if (eh->ether_type == htons(ETHERTYPE_IP) ||
+           eh->ether_type == htons(ETHERTYPE_ARP) ||
+           eh->ether_type == htons(ETHERTYPE_REVARP) ||
+           eh->ether_type == htons(ETHERTYPE_IPV6)) {
                memcpy((char *)&tx_frame.wi_addr1, (char *)&eh->ether_dhost,
                    ETHER_ADDR_LEN);
                memcpy((char *)&tx_frame.wi_addr2, (char *)&eh->ether_shost,



Home | Main Index | Thread Index | Old Index