···3434#include <linux/types.h>3535#include <linux/mm.h>36363737-#include "tether.h"3838-3937/* max transmit or receive buffer size */4038#define CB_MAX_BUF_SIZE 2900U /* NOTE: must be multiple of 4 */4139
···11-/*22- * Copyright (c) 2003 VIA Networking, Inc. All rights reserved.33- *44- * This program is free software; you can redistribute it and/or modify55- * it under the terms of the GNU General Public License as published by66- * the Free Software Foundation; either version 2 of the License, or77- * (at your option) any later version.88- *99- * This program is distributed in the hope that it will be useful,1010- * but WITHOUT ANY WARRANTY; without even the implied warranty of1111- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1212- * GNU General Public License for more details.1313- *1414- * You should have received a copy of the GNU General Public License along1515- * with this program; if not, write to the Free Software Foundation, Inc.,1616- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.1717- *1818- *1919- * File: tether.c2020- *2121- * Purpose:2222- *2323- * Author: Tevin Chen2424- *2525- * Date: May 21, 19962626- *2727- * Functions:2828- * ETHbIsBufferCrc32Ok - Check CRC value of the buffer if Ok or not2929- *3030- * Revision History:3131- *3232- */3333-3434-#include "device.h"3535-#include "tmacro.h"3636-#include "tether.h"3737-3838-/*3939- * Description: Check CRC value of the buffer if Ok or not4040- *4141- * Parameters:4242- * In:4343- * pbyBuffer - pointer of buffer (normally is rx buffer)4444- * cbFrameLength - length of buffer, including CRC portion4545- * Out:4646- * none4747- *4848- * Return Value: true if ok; false if error.4949- *5050- */5151-bool ETHbIsBufferCrc32Ok(u8 * pbyBuffer, unsigned int cbFrameLength)5252-{5353- u32 n_crc = ~ether_crc_le(cbFrameLength - 4, pbyBuffer);5454-5555- if (le32_to_cpu(*((__le32 *)(pbyBuffer + cbFrameLength - 4))) != n_crc)5656- return false;5757-5858- return true;5959-}6060-
-101
drivers/staging/vt6656/tether.h
···11-/*22- * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.33- * All rights reserved.44- *55- * This program is free software; you can redistribute it and/or modify66- * it under the terms of the GNU General Public License as published by77- * the Free Software Foundation; either version 2 of the License, or88- * (at your option) any later version.99- *1010- * This program is distributed in the hope that it will be useful,1111- * but WITHOUT ANY WARRANTY; without even the implied warranty of1212- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1313- * GNU General Public License for more details.1414- *1515- * You should have received a copy of the GNU General Public License along1616- * with this program; if not, write to the Free Software Foundation, Inc.,1717- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.1818- *1919- * File: tether.h2020- *2121- * Purpose:2222- *2323- * Author: Tevin Chen2424- *2525- * Date: Jan. 28, 19972626- *2727- */2828-2929-#ifndef __TETHER_H__3030-#define __TETHER_H__3131-3232-#include <linux/if_ether.h>3333-3434-//3535-// constants3636-//3737-#define U_ETHER_ADDR_STR_LEN (ETH_ALEN * 2 + 1)3838- // Ethernet address string length3939-#define U_MULTI_ADDR_LEN 8 // multicast address length4040-4141-#ifdef __BIG_ENDIAN4242-4343-#define TYPE_MGMT_PROBE_RSP 0x50004444-4545-#define FC_TODS 0x00014646-#define FC_FROMDS 0x00024747-#define FC_MOREFRAG 0x00044848-#define FC_RETRY 0x00084949-#define FC_POWERMGT 0x00105050-#define FC_MOREDATA 0x00205151-#define FC_WEP 0x00405252-#define TYPE_802_11_ATIM 0x90005353-5454-#define TYPE_802_11_DATA 0x08005555-#define TYPE_802_11_CTL 0x04005656-#define TYPE_802_11_MGMT 0x00005757-#define TYPE_802_11_MASK 0x0C005858-#define TYPE_SUBTYPE_MASK 0xFC005959-#define TYPE_802_11_NODATA 0x40006060-#define TYPE_DATE_NULL 0x48006161-6262-#define TYPE_CTL_PSPOLL 0xa4006363-#define TYPE_CTL_ACK 0xd4006464-6565-#else //if LITTLE_ENDIAN6666-//6767-// wType field in the SEthernetHeader6868-//6969-// NOTE....7070-// in network byte order, high byte is going first7171-7272-#define TYPE_MGMT_PROBE_RSP 0x00507373-7474-#define FC_TODS 0x01007575-#define FC_FROMDS 0x02007676-#define FC_MOREFRAG 0x04007777-#define FC_RETRY 0x08007878-#define FC_POWERMGT 0x10007979-#define FC_MOREDATA 0x20008080-#define FC_WEP 0x40008181-#define TYPE_802_11_ATIM 0x00908282-8383-#define TYPE_802_11_DATA 0x00088484-#define TYPE_802_11_CTL 0x00048585-#define TYPE_802_11_MGMT 0x00008686-#define TYPE_802_11_MASK 0x000C8787-#define TYPE_SUBTYPE_MASK 0x00FC8888-#define TYPE_802_11_NODATA 0x00408989-#define TYPE_DATE_NULL 0x00489090-9191-#define TYPE_CTL_PSPOLL 0x00a49292-#define TYPE_CTL_ACK 0x00d49393-9494-#endif //#ifdef __BIG_ENDIAN9595-9696-#define WEP_IV_MASK 0x00FFFFFF9797-9898-//u8 ETHbyGetHashIndexByCrc(u8 * pbyMultiAddr);9999-bool ETHbIsBufferCrc32Ok(u8 * pbyBuffer, unsigned int cbFrameLength);100100-101101-#endif /* __TETHER_H__ */