__be16 eth_type_trans(struct sk_buff *skb, struct net_device *dev)

网络驱动在接收到报文后,初始化skb->protocol字段,通过netif_rx(skb)传递给三层协议。eth_type_trans()函数用于以太网设备驱动,帮助确定协议实例以处理特定类型的报文。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

参考一下博客:

http://yaoyang.blog.51cto.com/7657153/1269713

http://blog.youkuaiyun.com/eric_liufeng/article/details/10475583

网络驱动接收到报文后,会初始化skb->protocol字段,再通过netif_rx(skb);传输给3层协议,3层协议根据skb->protocol字段决定使用哪个协议实例处理。

某一mac协议类型的全部网络设备都是使用相同的xx_type_trans()函数来获取protocol的:以太网设备驱动调用eth_type_trans(), FDDI网络设备驱动调用fddi_type_trans().

/**
 * eth_type_trans - determine the packet's protocol ID.
 * @skb: received socket data
 * @dev: receiving network device
 *
 * The rule here is that we
 * assume 802.3 if the type field is short enough to be a length.
 * This is normal practice and works for any 'now in use' protocol.
 */
__be16 eth_type_t
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值