java实现虚拟网卡_混合多系统虚拟网卡核间中断实现

APIC介绍

APIC的全称是Advanced Programmable Interrupt Controller,是8259控制器的升级版本。APIC包括了Local APIC和I/O APIC两部分内容,Local APIC是总的控制器,位于CPU内部;I/O APIC主要用于处理外部设备的中断。引入APIC可以适应多处理器环境。APIC在处理器中的逻辑如图 1.1所示:

f8388f22fcf6b8ccd0d362b377888491.png

图 1.1 APIC逻辑图

混合系统间通信

SylixOS和Linux通信介绍

在J1900工控机上安装SylixOS+Linux混合系统,SylixOS和Linux分别使用两个核。为了在SylixOS和Linux之间实现通信,在SylixOS和Linux上分别实现了虚拟网卡驱动,通过虚拟网卡实现两个系统之间通过网络通信的功能。虚拟网卡通过核间中断方式来通知CPU收发网络数据包。

Linux虚拟网卡驱动

Linux网卡驱动设置虚拟网卡驱动发送核间中断如图 2.1所示:

1734c3010eb62ac335fbb518aed7034d.png

图 2.1 Linux发送核间中断

SylixOS虚拟网卡驱动

SylixOS虚拟网卡驱动首先向系统注册一个核间中断,用于接收处理Linux发送的网路数据包,接口如图 2.2所示:

b3c414b606a9a6c141e84f826b809085.png

图 2.2 SylixOS注册核间中断

核间中断查看

通过Linux和SylixOS系统之间相互ping查看网络是否畅通,同时在Linux上可以查看触发的核间中断个数,如图 2.3所示:

c80f1f2e260b01cdd9cd66e291cc5e28.png

图 2.3 核间中断查看

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
虚拟网卡驱动源代码(原版): /* * snull.c -- the Simple Network Utility * * Copyright (C) 2001 Alessandro Rubini and Jonathan Corbet * Copyright (C) 2001 O'Reilly & Associates * * The source code in this file can be freely used, adapted, * and redistributed in source or binary form, so long as an * acknowledgment appears in derived source files. The citation * should list that the code comes from the book "Linux Device * Drivers" by Alessandro Rubini and Jonathan Corbet, published * by O'Reilly & Associates. No warranty is attached; * we cannot take responsibility for errors or fitness for use. * * $Id: snull.c,v 1.21 2004/11/05 02:36:03 rubini Exp $ */ #include #include #include #include #include #include /* printk() */ #include /* kmalloc() */ #include /* error codes */ #include /* size_t */ #include /* mark_bh */ #include #include /* struct device, and other headers */ #include /* eth_type_trans */ #include /* struct iphdr */ #include /* struct tcphdr */ #include #include "snull.h" #include #include MODULE_AUTHOR("Alessandro Rubini, Jonathan Corbet"); MODULE_LICENSE("Dual BSD/GPL"); /* * Transmitter lockup simulation, normally disabled. */ static int lockup = 0; module_param(lockup, int, 0); static int timeout = SNULL_TIMEOUT; module_param(timeout, int, 0); /* * Do we run in NAPI mode? */ static int use_napi = 0; module_param(use_napi, int, 0); /* * A structure representing an in-flight packet. */ struct snull_packet { struct snull_packet *next; struct net_device *dev; int datalen; u8 data[ETH_DATA_LEN]; }; int pool_size = 8; module_param(pool_size, int, 0); /* * This structure is private to each device. It is used to

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值