[OAI][Layer2]OAI nasmesh模块

for noS1 mode.

loads the nasmesh module and sets up the radio bearers (used to provide ip interface without S1 interface)

编译规则

基础知识

linux网络驱动程序

http://www.xml.com/ldd/chapter/book/ch14.html

网络设备驱动程序在连接到外部系统的硬件接口上接收和传输数据包,并提供网络协议可以访问的统一接口。在Linux中,这些驱动程序是从网络适配器本身的硬件实现中抽象出来的,其实现隐藏了底层的第1层和第2层协议。

网络驱动程序的大多数回调例程必须在内核中注册,以允许内核在数据到达网络端口时或内核需要在网络端口上发送数据时执行它们。与字符驱动程序一样,网络驱动程序不访问物理上可寻址的存储介质或支持文件系统访问。与块和字符设备驱动程序不同,网络驱动程序下没有设备文件 /dev。相反,您使用 net_device结构来定义网络接口的功能,并且当您使用诸如ip之类的命令来配置接口时,内核会更新此结构的成员。

net_device_ops定义的网络设备 的结构<linux/netdevice.h>包含一组方法指针,用于指定系统如何与设备交互。

https://elixir.bootlin.com/linux/v4.2/source/include/linux/netdevice.h#L1045

代码分析

netlink.c

net_device_ops结构体

struct net_device *nasdev[NB_INSTANCES_MAX];

void cleanup_module(void)
int init_module (void)
----pdcp_2_nas_irq=rt_request_srq(0, nas_interrupt, NULL);
----nasdev[inst] = alloc_netdev(sizeof(struct nas_priv),devicename, nas_init);
----nas_mesh_init(inst);
----err= register_netdev(nasdev[inst]);
----nas_netlink_init()
--------oai_netlink_cfg.input = nas_nl_data_ready;
--------nas_nl_sk = netlink_kernel_create(&init_net, OAI_IP_DRIVER_NETLINK_ID, &oai_netlink_cfg);
------------nlh = (struct nlmsghdr *)skb->data;
------------nas_COMMON_QOS_receive(nlh);
----------------rclass = nas_COMMON_search_class_for_rb(pdcph->rb_id,priv);
----------------nas_COMMON_receive
--------------------skb = dev_alloc_skb( dlen + 2 );
--------------------skb->dev = nasdev[inst];
--------------------netif_rx(skb);

common.c

void nas_COMMON_QOS_send(struct sk_buff *skb, struct cx_entity *cx, struct classifier_entity *gc,int inst, struct nas_priv *gpriv)// Request the transfer of data (QoS SAP)

void nas_COMMON_QOS_receive(struct nlmsghdr *nlh)

猜你喜欢

转载自www.cnblogs.com/LearnFromNow/p/9660363.html