免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
12
最近访问板块 发新帖
楼主: finalfantasy000
打印 上一主题 下一主题

无线网卡编译的问题 [复制链接]

论坛徽章:
3
金牛座
日期:2014-06-14 22:04:062015年辞旧岁徽章
日期:2015-03-03 16:54:152015年迎新春徽章
日期:2015-03-04 09:49:45
11 [报告]
发表于 2008-11-04 22:05 |只看该作者
原帖由 finalfantasy000 于 2008-11-4 21:55 发表
正在找 内核的代码量比较大 还没有定位出来  我还是第一做驱动程序的调整



仔细对照一下net_device这个结构体就好了,然后查一查相关的文档说明。

论坛徽章:
0
12 [报告]
发表于 2008-11-04 22:47 |只看该作者
/*
* INET        An implementation of the TCP/IP protocol suite for the LINUX
*        operating system.  INET is implemented using the  BSD Socket
*        interface as the means of communication with the user level.
*
*        Definitions for the Interfaces handler.
*
* Version:    @(#)dev.h    1.0.10    08/12/93
*
* Authors:    Ross Biro
*        Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
*        Corey Minyard <wf-rch!minyard@relay.EU.net>
*        Donald J. Becker, <becker@cesdis.gsfc.nasa.gov>
*        Alan Cox, <Alan.Cox@linux.org>
*        Bjorn Ekwall. <bj0rn@blox.se>
*              Pekka Riikonen <priikone@poseidon.pspt.fi>
*
*        This program is free software; you can redistribute it and/or
*        modify it under the terms of the GNU General Public License
*        as published by the Free Software Foundation; either version
*        2 of the License, or (at your option) any later version.
*
*        Moved to /usr/include/linux for NET3
*/

#ifndef _LINUX_NETDEVICE_H
#define _LINUX_NETDEVICE_H

#include <linux/if.h>
#include <linux/if_ether.h>
#include <linux/if_packet.h>


#define MAX_ADDR_LEN    32        /* Largest hardware address length */

/* Driver transmit return codes */
#define NETDEV_TX_OK 0        /* driver took care of packet */
#define NETDEV_TX_BUSY 1    /* driver tx path was busy*/
#define NETDEV_TX_LOCKED -1    /* driver tx lock was already taken */

/*
*    Compute the worst case header length according to the protocols
*    used.
*/


#if !defined(CONFIG_AX25) && !defined(CONFIG_AX25_MODULE) && !defined(CONFIG_TR)
#define LL_MAX_HEADER    32
#else
#if defined(CONFIG_AX25) || defined(CONFIG_AX25_MODULE)
#define LL_MAX_HEADER    96
#else
#define LL_MAX_HEADER    48
#endif
#endif

#if !defined(CONFIG_NET_IPIP) && \
    !defined(CONFIG_IPV6) && !defined(CONFIG_IPV6_MODULE)
#define MAX_HEADER LL_MAX_HEADER
#else
#define MAX_HEADER (LL_MAX_HEADER + 48)
#endif

/*
*    Network device statistics. Akin to the 2.0 ether stats but
*    with byte counters.
*/


struct net_device_stats
{
    unsigned long    rx_packets;        /* total packets received    */
    unsigned long    tx_packets;        /* total packets transmitted    */
    unsigned long    rx_bytes;        /* total bytes received     */
    unsigned long    tx_bytes;        /* total bytes transmitted    */
    unsigned long    rx_errors;        /* bad packets received        */
    unsigned long    tx_errors;        /* packet transmit problems    */
    unsigned long    rx_dropped;        /* no space in linux buffers    */
    unsigned long    tx_dropped;        /* no space available in linux    */
    unsigned long    multicast;        /* multicast packets received    */
    unsigned long    collisions;

    /* detailed rx_errors: */
    unsigned long    rx_length_errors;
    unsigned long    rx_over_errors;        /* receiver ring buff overflow    */
    unsigned long    rx_crc_errors;        /* recved pkt with crc error    */
    unsigned long    rx_frame_errors;    /* recv'd frame alignment error */
    unsigned long    rx_fifo_errors;        /* recv'r fifo overrun        */
    unsigned long    rx_missed_errors;    /* receiver missed packet    */

    /* detailed tx_errors */
    unsigned long    tx_aborted_errors;
    unsigned long    tx_carrier_errors;
    unsigned long    tx_fifo_errors;
    unsigned long    tx_heartbeat_errors;
    unsigned long    tx_window_errors;
   
    /* for cslip etc */
    unsigned long    rx_compressed;
    unsigned long    tx_compressed;
};


/* Media selection options. */
enum {
        IF_PORT_UNKNOWN = 0,
        IF_PORT_10BASE2,
        IF_PORT_10BASET,
        IF_PORT_AUI,
        IF_PORT_100BASET,
        IF_PORT_100BASETX,
        IF_PORT_100BASEFX
};


#endif    /* _LINUX_DEV_H */


.18的netdevice.h里面并没有发现next的指针定义
由它引用头文件看出比.22的要少 (为何?)难道驱动发生了重大的改变

[ 本帖最后由 finalfantasy000 于 2008-11-4 22:53 编辑 ]

论坛徽章:
0
13 [报告]
发表于 2008-11-04 22:50 |只看该作者
/* device index hash chain */
    struct hlist_node   index_hlist;
    struct net_device   *link_watch_next;

.22的文件

#include <linux/if.h>
#include <linux/if_ether.h>
#include <linux/if_packet.h>

#ifdef __KERNEL__
#include <linux/timer.h>
#include <asm/atomic.h>
#include <asm/cache.h>
#include <asm/byteorder.h>

#include <linux/device.h>
#include <linux/percpu.h>
#include <linux/dmaengine.h>


它引用的头文件

[ 本帖最后由 finalfantasy000 于 2008-11-4 22:52 编辑 ]

论坛徽章:
0
14 [报告]
发表于 2008-11-04 23:15 |只看该作者
Network Devices, the Kernel, and You!


Introduction
============
The following is a random collection of documentation regarding
network devices.

struct net_device allocation rules
==================================
Network device structures need to persist even after module is unloaded and
must be allocated with kmalloc.  If device has registered successfully,
it will be freed on last use by free_netdev.  This is required to handle the
pathologic case cleanly (example: rmmod mydriver </sys/class/net/myeth/mtu )

There are routines in net_init.c to handle the common cases of
alloc_etherdev, alloc_netdev.  These reserve extra space for driver
private data which gets freed when the network device is freed. If
separately allocated data is attached to the network device
(dev->priv) then it is up to the module exit handler to free that.


struct net_device synchronization rules
=======================================
dev->open:
        Synchronization: rtnl_lock() semaphore.
        Context: process

dev->stop:
        Synchronization: rtnl_lock() semaphore.
        Context: process
        Note1: netif_running() is guaranteed false
        Note2: dev->poll() is guaranteed to be stopped

dev->do_ioctl:
        Synchronization: rtnl_lock() semaphore.
        Context: process

dev->get_stats:
        Synchronization: dev_base_lock rwlock.
        Context: nominally process, but don't sleep inside an rwlock

dev->hard_start_xmit:
        Synchronization: netif_tx_lock spinlock.
        When the driver sets NETIF_F_LLTX in dev->features this will be
        called without holding netif_tx_lock. In this case the driver
        has to lock by itself when needed. It is recommended to use a try lock
        for this and return -1 when the spin lock fails.
        The locking there should also properly protect against
        set_multicast_list
        Context: Process with BHs disabled or BH (timer).
        Notes: netif_queue_stopped() is guaranteed false
               Interrupts must be enabled when calling hard_start_xmit.
                (Interrupts must also be enabled when enabling the BH handler.)
        Return codes:
        o NETDEV_TX_OK everything ok.
        o NETDEV_TX_BUSY Cannot transmit packet, try later
          Usually a bug, means queue start/stop flow control is broken in
          the driver. Note: the driver must NOT put the skb in its DMA ring.
        o NETDEV_TX_LOCKED Locking failed, please retry quickly.
          Only valid when NETIF_F_LLTX is set.

dev->tx_timeout:
        Synchronization: netif_tx_lock spinlock.
        Context: BHs disabled
        Notes: netif_queue_stopped() is guaranteed true

dev->set_multicast_list:
        Synchronization: netif_tx_lock spinlock.
        Context: BHs disabled

dev->poll:
        Synchronization: __LINK_STATE_RX_SCHED bit in dev->state.  See
                dev_close code and comments in net/core/dev.c for more info.
        Context: softirq

2.6.22的文档netdevice里面没有提及有用的信息
具体这两个成员的转换依然未知
继续寻找中

论坛徽章:
3
金牛座
日期:2014-06-14 22:04:062015年辞旧岁徽章
日期:2015-03-03 16:54:152015年迎新春徽章
日期:2015-03-04 09:49:45
15 [报告]
发表于 2008-11-05 09:25 |只看该作者

回复 #14 finalfantasy000 的帖子

继续努力,就快解决了,呵呵

论坛徽章:
0
16 [报告]
发表于 2009-03-17 18:51 |只看该作者
该问题现在已经解决,因为2.6.22的相关数据结构变化较大,更换驱动的版本即可解决
新的驱动大家可以去
http://rt2x00.serialmonkey.com/
找到

论坛徽章:
3
金牛座
日期:2014-06-14 22:04:062015年辞旧岁徽章
日期:2015-03-03 16:54:152015年迎新春徽章
日期:2015-03-04 09:49:45
17 [报告]
发表于 2009-03-17 19:49 |只看该作者
原帖由 finalfantasy000 于 2009-3-17 18:51 发表
该问题现在已经解决,因为2.6.22的相关数据结构变化较大,更换驱动的版本即可解决
新的驱动大家可以去
http://rt2x00.serialmonkey.com/
找到

感谢分享
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP