历史上的今天
返回首页

历史上的今天

今天是:2024年11月09日(星期六)

正在发生

2021年11月09日 | Mini2440 DM9000 驱动分析

2021-11-09 来源:eefocus

net_device_ops中方法的相应说明

/*

 * This structure defines the management hooks for network devices.

 * The following hooks can be defined; unless noted otherwise, they are

 * optional and can be filled with a null pointer.

 *

 * int (*ndo_init)(struct net_device *dev);

 *     This function is called once when network device is registered.

 *     The network device can use this to any late stage initializaton

 *     or semantic validattion. It can fail with an error code which will

 *     be propogated back to register_netdev

 *

 * void (*ndo_uninit)(struct net_device *dev);

 *     This function is called when device is unregistered or when registration

 *     fails. It is not called if init fails.

 *

 * int (*ndo_open)(struct net_device *dev);

 *     This function is called when network device transistions to the up

 *     state.

 *

 * int (*ndo_stop)(struct net_device *dev);

 *     This function is called when network device transistions to the down

 *     state.

 *

 * netdev_tx_t (*ndo_start_xmit)(struct sk_buff *skb,

 *                               struct net_device *dev);

 * Called when a packet needs to be transmitted.

 * Must return NETDEV_TX_OK , NETDEV_TX_BUSY.

 *        (can also return NETDEV_TX_LOCKED iff NETIF_F_LLTX)

 * Required can not be NULL.

 *

 * u16 (*ndo_select_queue)(struct net_device *dev, struct sk_buff *skb);

 * Called to decide which queue to when device supports multiple

 * transmit queues.

 *

 * void (*ndo_change_rx_flags)(struct net_device *dev, int flags);

 * This function is called to allow device receiver to make

 * changes to configuration when multicast or promiscious is enabled.

 *

 * void (*ndo_set_rx_mode)(struct net_device *dev);

 * This function is called device changes address list filtering.

 *

 * void (*ndo_set_multicast_list)(struct net_device *dev);

 * This function is called when the multicast address list changes.

 *

 * int (*ndo_set_mac_address)(struct net_device *dev, void *addr);

 * This function  is called when the Media Access Control address

 * needs to be changed. If this interface is not defined, the

 * mac address can not be changed.

 *

 * int (*ndo_validate_addr)(struct net_device *dev);

 * Test if Media Access Control address is valid for the device.

 *

 * int (*ndo_do_ioctl)(struct net_device *dev, struct ifreq *ifr, int cmd);

 * Called when a user request an ioctl which can't be handled by

 * the generic interface code. If not defined ioctl's return

 * not supported error code.

 *

 * int (*ndo_set_config)(struct net_device *dev, struct ifmap *map);

 * Used to set network devices bus interface parameters. This interface

 * is retained for legacy reason, new devices should use the bus

 * interface (PCI) for low level management.

 *

 * int (*ndo_change_mtu)(struct net_device *dev, int new_mtu);

 * Called when a user wants to change the Maximum Transfer Unit

 * of a device. If not defined, any request to change MTU will

 * will return an error.

 *

 * void (*ndo_tx_timeout)(struct net_device *dev);

 * Callback uses when the transmitter has not made any progress

 * for dev->watchdog ticks.

 *

 * struct net_device_stats* (*ndo_get_stats)(struct net_device *dev);

 * Called when a user wants to get the network device usage

 * statistics. If not defined, the counters in dev->stats will

 * be used.

 *

 * void (*ndo_vlan_rx_register)(struct net_device *dev, struct vlan_group *grp);

 * If device support VLAN receive accleration

 * (ie. dev->features & NETIF_F_HW_VLAN_RX), then this function is called

 * when vlan groups for the device changes.  Note: grp is NULL

 * if no vlan's groups are being used.

 *

 * void (*ndo_vlan_rx_add_vid)(struct net_device *dev, unsigned short vid);

 * If device support VLAN filtering (dev->features & NETIF_F_HW_VLAN_FILTER)

 * this function is called when a VLAN id is registered.

 *

 * void (*ndo_vlan_rx_kill_vid)(struct net_device *dev, unsigned short vid);

 * If device support VLAN filtering (dev->features & NETIF_F_HW_VLAN_FILTER)

 * this function is called when a VLAN id is unregistered.

 *

 * void (*ndo_poll_controller)(struct net_device *dev);

 */

#define HAVE_NET_DEVICE_OPS

struct net_device_ops {

int (*ndo_init)(struct net_device *dev);

void (*ndo_uninit)(struct net_device *dev);

int (*ndo_open)(struct net_device *dev);

int (*ndo_stop)(struct net_device *dev);

netdev_tx_t (*ndo_start_xmit) (struct sk_buff *skb,

   struct net_device *dev);

u16 (*ndo_select_queue)(struct net_device *dev,

    struct sk_buff *skb);

#define HAVE_CHANGE_RX_FLAGS

void (*ndo_change_rx_flags)(struct net_device *dev,

       int flags);

#define HAVE_SET_RX_MODE

void (*ndo_set_rx_mode)(struct net_device *dev);

#define HAVE_MULTICAST

void (*ndo_set_multicast_list)(struct net_device *dev);

#define HAVE_SET_MAC_ADDR

int (*ndo_set_mac_address)(struct net_device *dev,

       void *addr);

#define HAVE_VALIDATE_ADDR

int (*ndo_validate_addr)(struct net_device *dev);

#define HAVE_PRIVATE_IOCTL

int (*ndo_do_ioctl)(struct net_device *dev,

        struct ifreq *ifr, int cmd);

#define HAVE_SET_CONFIG

int (*ndo_set_config)(struct net_device *dev,

          struct ifmap *map);

#define HAVE_CHANGE_MTU

int (*ndo_change_mtu)(struct net_device *dev,

  int new_mtu);

int (*ndo_neigh_setup)(struct net_device *dev,

   struct neigh_parms *);

#define HAVE_TX_TIMEOUT

void (*ndo_tx_timeout) (struct net_device *dev);

 

struct net_device_stats* (*ndo_get_stats)(struct net_device *dev);

 

void (*ndo_vlan_rx_register)(struct net_device *dev,

        struct vlan_group *grp);

void (*ndo_vlan_rx_add_vid)(struct net_device *dev,

       unsigned short vid);

void (*ndo_vlan_rx_kill_vid)(struct net_device *dev,

        unsigned short vid);

#ifdef CONFIG_NET_POLL_CONTROLLER

#define HAVE_NETDEV_POLL

void                    (*ndo_poll_controller)(struct net_device *dev);

#endif

#if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE)

int (*ndo_fcoe_enable)(struct net_device *dev);

int (*ndo_fcoe_disable)(struct net_device *dev);

int (*ndo_fcoe_ddp_setup)(struct net_device *dev,

      u16 xid,

      struct scatterlist *sgl,

      unsigned int sgc);

int (*ndo_fcoe_ddp_done)(struct net_device *dev,

     u16 xid);

#endif

};

ethtool_ops 中方法的相应说明

/**

 * ðtool_ops - Alter and report network device settings

 * get_settings: Get device-specific settings

 * set_settings: Set device-specific settings

 * get_drvinfo: Report driver information

 * get_regs: Get device registers

 * get_wol: Report whether Wake-on-Lan is enabled

 * set_wol: Turn Wake-on-Lan on or off

 * get_msglevel: Report driver message level

 * set_msglevel: Set driver message level

 * nway_reset: Restart autonegotiation

 * get_link: Get link status

 * get_eeprom: Read data from the device EEPROM

 * set_eeprom: Write data to the device EEPROM

 * get_coalesce: Get interrupt coalescing parameters

 * set_coalesce: Set interrupt coalescing parameters

 * get_ringparam: Report ring sizes

 * set_ringparam: Set ring sizes

 * get_pauseparam: Report pause parameters

 * set_pauseparam: Set pause parameters

 * get_rx_csum: Report whether receive checksums are turned on or off

 * set_rx_csum: Turn receive checksum on or off

 * get_tx_csum: Report whether transmit checksums are turned on or off

 * set_tx_csum: Turn transmit checksums on or off

 * get_sg: Report whether scatter-gather is enabled

 * set_sg: Turn scatter-gather on or off

 * get_tso: Report whether TCP segmentation offload is enabled

 * set_tso: Turn TCP segmentation offload on or off

 * get_ufo: Report whether UDP fragmentation offload is enabled

 * set_ufo: Turn UDP fragmentation offload on or off

 * self_test: Run specified self-tests

 * get_strings: Return a set of strings that describe the requested objects 

 * phys_id: Identify the device

 * get_stats: Return statistics about the device

 * get_flags: get 32-bit flags bitmap

 * set_flags: set 32-bit flags bitmap

 * 

 * Description:

 *

 * get_settings:

 * @get_settings is passed an ðtool_cmd to fill in.  It returns

 * an negative errno or zero.

 *

 * set_settings:

 * @set_settings is passed an ðtool_cmd and should attempt to set

 * all the settings this device supports.  It may return an error value

 * if something goes wrong (otherwise 0).

 *

 * get_eeprom:

 * Should fill in the magic field.  Don't need to check len for zero

 * or wraparound.  Fill in the data argument with the eeprom values

 * from offset to offset + len.  Update len to the amount read.

 * Returns an error or zero.

 *

 * set_eeprom:

 * Should validate the magic field.  Don't need to check len for zero

 * or wraparound.  Update len to the amount written.  Returns an error

 * or zero.

 */

struct ethtool_ops {

int (*get_settings)(struct net_device *, struct ethtool_cmd *);

推荐阅读

史海拾趣

E Connector Solutions公司的发展小趣事

人才是企业发展的核心竞争力。E Connector Solutions公司高度重视人才培养和团队建设。公司建立了完善的人才培养机制,通过内部培训、外部引进等方式不断提升员工的专业技能和综合素质。同时,公司还注重团队建设,鼓励员工之间的协作与交流,营造积极向上的工作氛围。这种注重人才培养和团队建设的做法为公司的发展提供了坚实的人才保障。

请注意,以上故事均为虚构,旨在为您提供一个关于电子连接器解决方案公司发展起来的故事框架。如果您需要了解特定公司的具体发展情况,建议您查阅相关公司的官方网站或行业报告。

Atlanta Micro公司的发展小趣事

近年来,电子行业经历了快速的发展和变革,新技术、新产品层出不穷。面对这一形势,Atlanta Micro积极应对挑战,不断调整战略和业务模式。公司加强了与产业链上下游企业的合作,共同应对市场变化;同时,也加大了对新兴技术的研发投入,力求在新技术领域取得突破。这些努力使得Atlanta Micro在激烈的市场竞争中保持了稳健的发展态势。

以上便是关于Atlanta Micro在电子行业发展的5个故事。这些故事展示了公司从创业初期到逐渐发展壮大的过程,以及面对挑战和变革时所采取的应对策略。虽然这些故事只是公司发展历程中的一部分,但它们足以体现出Atlanta Micro在电子行业中的坚韧和拼搏精神。

High Voltage Semiconductor Inc公司的发展小趣事

随着市场需求的多样化,美高测开始提供更加定制化的高压半导体测试解决方案。公司深入了解客户的具体需求,从产品设计到售后服务,全程参与并提供专业指导。例如,针对某些特定行业的高压电缆测试需求,美高测设计并生产了具有超长测试距离和高精度测试结果的专用设备,赢得了包括军工、航空航天在内的多个高端客户的青睐。

Anpec(茂达)公司的发展小趣事

凭借卓越的产品质量和良好的市场口碑,茂达电子在国内电源模拟IC设计领域的地位逐渐提升。公司不仅在国内市场取得了显著的成绩,还积极拓展海外市场,与众多国际知名企业建立了稳定的合作关系。茂达电子的产品广泛应用于计算机、通信和消费者等领域,为全球客户提供了高质量的电源解决方案。

E-T-A [E-T-A Circuit Breakers]公司的发展小趣事

E-T-A公司的前身可以追溯到1948年,当时由Jakob Ellenberger和Harald A. Poensgen在德国共同创立了ELPO GmbH公司。这家初创企业专注于电气设备的研发和生产。随着技术的不断发展和市场的日益扩大,公司逐渐意识到设备用断路器在电路保护领域的重要性。因此,在1953年,公司正式推出了设备用的ETA断路器,并开始逐渐将重心转移到断路器领域,这也为日后E-T-A公司的成立奠定了基础。

Dynachip Corp公司的发展小趣事

Dynachip Corp始终将创新作为公司发展的核心动力。他们不断投入研发资源,探索新的技术方向和应用场景。同时,他们还积极关注行业动态和市场趋势,及时调整产品策略和市场布局。这种持续创新的精神使Dynachip Corp能够保持在行业中的领先地位,并为未来的发展奠定了坚实的基础。展望未来,Dynachip Corp将继续秉承创新、品质、合作的理念,致力于成为全球领先的半导体企业。

问答坊 | AI 解惑

总结:如何用好WinAVR里的延时函数 (转)

刚对WinAVR自带的延时函数进行一下研究,有些收获,与大家分享,不对之处请斧正,谢谢。     先看_delay_loop_1(uint8_t __count)函数,从其函数注释里面可以了解到,该函数用来延迟3个晶振时钟周期,不包括程序调用和退出该函数所花费 ...…

查看全部问答>

Windows CE下SPI应用及驱动程序?

小弟第一次接触嵌入式系统,将自己的问题详细描述一下,以便各位大哥大姐多多帮忙! 我用的硬件平台是三星2440,在这套平台上嵌入了Windows CE操作系统。2440内部带有两个SPI口同外部通信,我们要做的是通过SPI接口用一块单片机给2440发送数据,同 ...…

查看全部问答>

请大侠指点:哪里可以下到基于TCP的网络打印协议

请大侠指点:哪里可以下到基于TCP的网络打印协议。 本人准备在嵌入系统中开发网络打印功能,在网上只找到了IPP、以及互联网的打印介绍。 谢谢!…

查看全部问答>

[紧急求助]c51编译警告"UNRESOLVED EXTERNAL SYMBOL"

*** WARNING L1: UNRESOLVED EXTERNAL SYMBOL     SYMBOL:  RXPNT     MODULE:  com.obj (COM) 找遍了网上也没能找出个究竟 keil的官方网站看了,也不在它的解释范围内 其中,变量RxPnt我已在头文件里 ...…

查看全部问答>

最简单的写HEX到STM32F程序的方法?

                                 调试完的程序,不想提供源代码,只提供HEX让人烧写,有什么最简单的办法?前提如下:1.不想使用专门的编程器,片子 ...…

查看全部问答>

为什么液晶显示亮度不够?

采用430f449的液晶驱动模块,段式液晶,但液晶显示发虚,亮度不够,为什么?…

查看全部问答>

利用PC RS232下载程序到281x flash的方法

我是按如下步作的:利用PC RS232下载程序到281x flash的方法:第一步:安装CCS2.2或更高版本  以确保你的源代码能编译为下载源码:xxx.out文件第二步:安装串口编程算法项目文件:sdf28xx_v3_0_serial (Ti网站上有下载)  详情请阅读包含 ...…

查看全部问答>

发布我们做的STM32F417/407开发板的原理图

板子是最近做的NSSTM32F4-R1开发板,原理图转成pdf格式了,传上来共享…

查看全部问答>

使用TI Grlib时遇到的问题 (有点奇葩)

但是设置为其实地址 (0,23),宽度 240,高度 100 时液晶按照设置显示(设置为竖着刷的,即高度为320,宽度为240) 但是我将高度设置为280(或者只要大于120左右)的时候,背景的设置显示就仅仅在液晶的上半部分实现了。。下面一大截都没刷成指定的颜 ...…

查看全部问答>