dpdkkni
参考https:blog。csdn。netsinat20184565articledetails92700223
官方文档:
http:doc。dpdk。orgdtstestplansknitestplan。html〔rootlocalhostdpdk19。11〕insmod。buildkmodrtekni。kokthreadmodemultipleinsmod:ERROR:couldnotinsertmodule。buildkmodrtekni。ko:Invalidmoduleformat〔rootlocalhostdpdk19。11〕insmod。buildbuildkernellinuxknirtekni。kokthreadmodemultipleinsmod:ERROR:couldnotinsertmodule。buildbuildkernellinuxknirtekni。ko:Invalidmoduleformat〔rootlocalhostdpdk19。11〕unameaLinuxlocalhost。localdomain4。14。0115。el7a。0。1。aarch641SMPSunNov2520:54:21UTC2018aarch64aarch64aarch64GNULinux〔rootlocalhostdpdk19。11〕lsusrsrcdebugkernels〔rootlocalhostdpdk19。11〕lsusrsrckernels4。18。0193。28。1。el7。aarch64〔rootlocalhostdpdk19。11〕〔rootlocalhostdpdk19。11〕yuminstallkerneldevelunamer(unamer)Loadedplugins:fastestmirrorLoadingmirrorspeedsfromcachedhostfilebase:mirror。worria。comextras:mirror。worria。comupdates:mirror。worria。comfile:mntrepodatarepomd。xml:〔Errno14〕curl37Couldntopenfilemntrepodatarepomd。xmlTryingothermirror。ResolvingDependenciesRunningtransactioncheckPackagekerneldevel。aarch640:4。14。0115。el7a。0。1willbeinstalledFinishedDependencyResolutionDependenciesResolvedPackageArchVersionRepositorySizeInstalling:kerneldevelaarch644。14。0115。el7a。0。1cdrom11MTransactionSummaryInstall1PackageTotaldownloadsize:11MInstalledsize:43MIsthisok〔ydN〕:yDownloadingpackages:Errordownloadingpackages:kerneldevel4。14。0115。el7a。0。1。aarch64:〔Errno256〕Nomoremirrorstotry。〔rootlocalhostdpdk19。11〕
挂载CentOS7aarch64Everything1810。iso〔rootlocalhostdpdk19。11〕vietcyumyumyum。confyum。repos。d〔rootlocalhostdpdk19。11〕vietcyumyumyum。confyum。repos。d〔rootlocalhostdpdk19。11〕vietcyum。repos。dcdrom。repoCentOSBase。repoCentOSCR。repoCentOSDebuginfo。repoCentOSfasttrack。repoCentOSMedia。repoCentOSSources。repoCentOSVault。repo〔rootlocalhostdpdk19。11〕vietcyum。repos。dcdrom。repo〔cdrom〕namecdrombaseurlfile:sr0enabled1gpgcheck0〔rootlocalhostdpdk19。11〕yuminstallkerneldevelunamer(unamer)Loadedplugins:fastestmirrorLoadingmirrorspeedsfromcachedhostfilebase:mirror。worria。comextras:mirror。worria。comupdates:mirror。worria。comcdrom3。6kB00:00:00ResolvingDependenciesRunningtransactioncheckPackagekerneldevel。aarch640:4。14。0115。el7a。0。1willbeinstalledFinishedDependencyResolutionDependenciesResolvedPackageArchVersionRepositorySizeInstalling:kerneldevelaarch644。14。0115。el7a。0。1cdrom11MTransactionSummaryInstall1PackageTotaldownloadsize:11MInstalledsize:43MIsthisok〔ydN〕:yDownloadingpackages:RunningtransactioncheckRunningtransactiontestTransactiontestsucceededRunningtransactionInstalling:kerneldevel4。14。0115。el7a。0。1。aarch6411Verifying:kerneldevel4。14。0115。el7a。0。1。aarch6411Installed:kerneldevel。aarch640:4。14。0115。el7a。0。1Complete!〔rootlocalhostdpdk19。11〕
安装成功rootlocalhostdpdk19。11〕lsusrsrckernels4。14。0115。el7a。0。1。aarch644。18。0193。28。1。el7。aarch64〔rootlocalhostdpdk19。11〕〔rootlocalhostdpdk19。11〕lnsfusrsrckernels4。14。0115。el7a。0。1。aarch64libmodules4。14。0115。el7a。0。1。aarch64build〔rootlocalhostdpdk19。11〕lslibmodules4。14。0115。el7a。0。1。aarch64altotal1772drwxrxrx。7rootroot4096Jun1002:50。drwxrxrx。3rootroot41Jun923:17。。lrwxrwxrwx。1rootroot45Jun1002:50buildusrsrckernels4。18。0193。28。1。el7。aarch64drwxrxrx。2rootroot6Nov252018extradrwxrxrx。12rootroot132Jun923:17kernelrwrr。1rootroot490436Jun923:18modules。aliasrwrr。1rootroot475434Jun923:18modules。alias。binrwrr。1rootroot671Nov252018modules。blockrwrr。1rootroot6516Nov252018modules。builtinrwrr。1rootroot8572Jun923:18modules。builtin。binrwrr。1rootroot110565Jun923:18modules。deprwrr。1rootroot168102Jun923:18modules。dep。binrwrr。1rootroot288Jun923:18modules。devnamerwrr。1rootroot113Nov252018modules。drmrwrr。1rootroot68Nov252018modules。modesettingrwrr。1rootroot1091Nov252018modules。networkingrwrr。1rootroot52153Nov252018modules。orderrwrr。1rootroot511Jun923:18modules。softdeprwrr。1rootroot208659Jun923:18modules。symbolsrwrr。1rootroot248887Jun923:18modules。symbols。binlrwxrwxrwx。1rootroot5Jun923:17sourcebuilddrwxrxrx。2rootroot6Nov252018updatesdrwxrxrx。2rootroot21Jun923:17vdsodrwxrxrx。2rootroot6Jun923:17weakupdates〔rootlocalhostdpdk19。11〕rmlibmodules4。14。0115。el7a。0。1。aarch64buildrm:removesymboliclink‘libmodules4。14。0115。el7a。0。1。aarch64build’?y〔rootlocalhostdpdk19。11〕lslibmodules4。14。0115。el7a。0。1。aarch64altotal1772drwxrxrx。7rootroot4096Jun1103:37。drwxrxrx。3rootroot41Jun923:17。。drwxrxrx。2rootroot6Nov252018extradrwxrxrx。12rootroot132Jun923:17kernelrwrr。1rootroot490436Jun923:18modules。aliasrwrr。1rootroot475434Jun923:18modules。alias。binrwrr。1rootroot671Nov252018modules。blockrwrr。1rootroot6516Nov252018modules。builtinrwrr。1rootroot8572Jun923:18modules。builtin。binrwrr。1rootroot110565Jun923:18modules。deprwrr。1rootroot168102Jun923:18modules。dep。binrwrr。1rootroot288Jun923:18modules。devnamerwrr。1rootroot113Nov252018modules。drmrwrr。1rootroot68Nov252018modules。modesettingrwrr。1rootroot1091Nov252018modules。networkingrwrr。1rootroot52153Nov252018modules。orderrwrr。1rootroot511Jun923:18modules。softdeprwrr。1rootroot208659Jun923:18modules。symbolsrwrr。1rootroot248887Jun923:18modules。symbols。binlrwxrwxrwx。1rootroot5Jun923:17sourcebuilddrwxrxrx。2rootroot6Nov252018updatesdrwxrxrx。2rootroot21Jun923:17vdsodrwxrxrx。2rootroot6Jun923:17weakupdates〔rootlocalhostdpdk19。11〕lnsfusrsrckernels4。14。0115。el7a。0。1。aarch64libmodules4。14。0115。el7a。0。1。aarch64build〔rootlocalhostdpdk19。11〕lslibmodules4。14。0115。el7a。0。1。aarch64altotal1772drwxrxrx。7rootroot4096Jun1103:38。drwxrxrx。3rootroot41Jun923:17。。lrwxrwxrwx。1rootroot45Jun1103:38buildusrsrckernels4。14。0115。el7a。0。1。aarch64drwxrxrx。2rootroot6Nov252018extradrwxrxrx。12rootroot132Jun923:17kernelrwrr。1rootroot490436Jun923:18modules。aliasrwrr。1rootroot475434Jun923:18modules。alias。binrwrr。1rootroot671Nov252018modules。blockrwrr。1rootroot6516Nov252018modules。builtinrwrr。1rootroot8572Jun923:18modules。builtin。binrwrr。1rootroot110565Jun923:18modules。deprwrr。1rootroot168102Jun923:18modules。dep。binrwrr。1rootroot288Jun923:18modules。devnamerwrr。1rootroot113Nov252018modules。drmrwrr。1rootroot68Nov252018modules。modesettingrwrr。1rootroot1091Nov252018modules。networkingrwrr。1rootroot52153Nov252018modules。orderrwrr。1rootroot511Jun923:18modules。softdeprwrr。1rootroot208659Jun923:18modules。symbolsrwrr。1rootroot248887Jun923:18modules。symbols。binlrwxrwxrwx。1rootroot5Jun923:17sourcebuilddrwxrxrx。2rootroot6Nov252018updatesdrwxrxrx。2rootroot21Jun923:17vdsodrwxrxrx。2rootroot6Jun923:17weakupdates〔rootlocalhostdpdk19。11〕
重新编译dpdk〔rootlocalhostdpdk19。11〕exportEXTRACFLAGSO0g〔rootlocalhostdpdk19。11〕exportRTETARGETarm64armv8alinuxappgcc〔rootlocalhostdpdk19。11〕xportRTESDKpwdbash:xport:commandnotfound〔rootlocalhostdpdk19。11〕exportRTESDKpwd〔rootlocalhostdpdk19。11〕makeinstallTRTETARGETj128
makecleanj128makeinstallTRTETARGETj128〔rootlocalhostdpdk19。11〕find。namertekni。ko。arm64armv8alinuxappgccbuildkernellinuxknirtekni。ko。arm64armv8alinuxappgcckmodrtekni。ko〔rootlocalhostdpdk19。11〕insmod。arm64armv8alinuxappgcckmodrtekni。ko〔rootlocalhostdpdk19。11〕rmmodrtekni。ko〔rootlocalhostdpdk19。11〕insmodarm64armv8alinuxappgcckmodrtekni。kokthreadmodemultiple〔rootlocalhostdpdk19。11〕〔rootlocalhostdpdk19。11〕insmod。arm64armv8alinuxappgcckmodigbuio。koinsmod:ERROR:couldnotinsertmodule。arm64armv8alinuxappgcckmodigbuio。ko:Unknownsymbolinmodule〔rootlocalhostdpdk19。11〕insmod。arm64armv8alinuxappgccbuildkernellinuxigbuioigbuio。koinsmod:ERROR:couldnotinsertmodule。arm64armv8alinuxappgccbuildkernellinuxigbuioigbuio。ko:Unknownsymbolinmodule〔rootlocalhostdpdk19。11〕modinfo。arm64armv8alinuxappgccbuildkernellinuxigbuioigbuio。kofilename:rootdpdk19。11。arm64armv8alinuxappgccbuildkernellinuxigbuioigbuio。koauthor:IntelCorporationlicense:GPLdescription:UIOdriverforIntelIGBPCIcardsrhelversion:7。6srcversion:26C63DAE2104091D5DE47C6depends:uioname:igbuiovermagic:4。14。0115。el7a。0。1。aarch64SMPmodunloadmodversionsaarch64parm:intrmode:igbuiointerruptmode(defaultmsix):msixUseMSIXinterruptmsiUseMSIinterruptlegacyUseLegacyinterrupt(charp)parm:wcactivate:Activatesupportforwritecombining(WC)(default0)0disableotherenable(int)
原来igbuio依赖uio,uio没有加载〔rootlocalhostdpdk19。11〕modprobeuio〔rootlocalhostdpdk19。11〕modinfo。arm64armv8alinuxappgccbuildkernellinuxigbuioigbuio。kofilename:rootdpdk19。11。arm64armv8alinuxappgccbuildkernellinuxigbuioigbuio。koauthor:IntelCorporationlicense:GPLdescription:UIOdriverforIntelIGBPCIcardsrhelversion:7。6srcversion:26C63DAE2104091D5DE47C6depends:uioname:igbuiovermagic:4。14。0115。el7a。0。1。aarch64SMPmodunloadmodversionsaarch64parm:intrmode:igbuiointerruptmode(defaultmsix):msixUseMSIXinterruptmsiUseMSIinterruptlegacyUseLegacyinterrupt(charp)parm:wcactivate:Activatesupportforwritecombining(WC)(default0)0disableotherenable(int)〔rootlocalhostdpdk19。11〕modinfo。arm64armv8alinuxappgccbuildkernellinuxigbuioigbuio。kofilename:rootdpdk19。11。arm64armv8alinuxappgccbuildkernellinuxigbuioigbuio。koauthor:IntelCorporationlicense:GPLdescription:UIOdriverforIntelIGBPCIcardsrhelversion:7。6srcversion:26C63DAE2104091D5DE47C6depends:uioname:igbuiovermagic:4。14。0115。el7a。0。1。aarch64SMPmodunloadmodversionsaarch64parm:intrmode:igbuiointerruptmode(defaultmsix):msixUseMSIXinterruptmsiUseMSIinterruptlegacyUseLegacyinterrupt(charp)parm:wcactivate:Activatesupportforwritecombining(WC)(default0)0disableotherenable(int)〔rootlocalhostdpdk19。11〕insmod。arm64armv8alinuxappgccbuildkernellinuxigbuioigbuio。ko〔rootlocalhostdpdk19。11〕dpdkkni内核模块
KNI内核可加载模块rtekni为DPDK应用提供内核接口。
当rtekni模块加载时,创建devkni设备节点(rtekni模块创建kni杂项设备,文件系统节点devkni需要手动或者通过udev机制创建),藉此节点,dpdkkni应用可控制和与内核rtekni模块交互。
在内核模块rtekni加载时,可指定一些可选的参数以控制其行为:
modinfortekni。ko
lomode:KNIloopbackmode(defaultlomodenone):
lomodenoneKernelloopbackdisabled
lomodefifoEnablekernelloopbackwithfifo
lomodefifoskbEnablekernelloopbackwithfifoandskbbuffer
kthreadmode:Kernelthreadmode(defaultsingle):
singleSinglekernelthreadmodeenabled。
multipleMultiplekernelthreadmodeenabled。
carrier:DefaultcarrierstateforKNIinterface(defaultoff):
offInterfaceswillbecreatedwithcarrierstatesettooff。
onInterfaceswillbecreatedwithcarrierstatesettoon。
典型的情况是,在加载rtekni模块时不指定任何参数,DPDK应用可由内核网络协议栈获取和向其发送报文。不指定任何参数,意味着仅创建一个内核线程处理所有的KNI虚拟设备在内核侧的报文接收,并且禁用回环模式,KNI接口的默认链路状态为关闭off。
insmodkmodrtekni。koportscores:e。g。:config(0,1,2),(1,3,4)Nokernelthreadspecified。config(0,1,2,21),(1,3,4,23)Onekernelthreadinuse。config(0,1,2,21,22),(1,3,4,23,25)Twokernelthreadsinuse。回环模式
以测试为目的,在加载rtekni模块式可指定lomode参数:
insmodkmodrtekni。kolomodelomodefifolomodefifo回环模式将在内核空间中操作FIFO环队列,由函数knififoget(knirxq,。。。)和knififoput(knitxq,。。。)实现从rxq接收队列读取报文,再写入发送队列txq来实现回环操作。
insmodkmodrtekni。kolomodelomodefifoskb
lomodefifoskb回环模式在以上lomodefifo的基础之上,增加了skbuff缓存的相关拷贝操作。具体包括将rxq接收队列的数据拷贝到分配的接收skb缓存中。以及分配发送skb缓存,将之前由rxq队列接收数据拷贝到发送skb缓存中,使用函数kninettx(skb,dev)发送skb缓存数据。最终将数据报文拷贝到mbuf结构中,使用knififoput函数加入到txq发送队列。可见此回环测试模式,更加接近真实的使用场景。
如果没有指定lomode参数,回环模式将禁用。内核线程模式
为了提供性能的灵活性,内核模块rtekni在加载时刻指定kthreadmode参数。rtekni模块支持两个选项:单内核线程模式和多内核线程模式。
如下,使能单内核线程模式:
insmodkmodrtekni。kokthreadmodesingle
此模式为所有的KNI虚拟接口创建唯一的内核线程在内核侧接收数据。默认情况下,此内核线程不绑定在特定的核心上,但是,用户可在创建第一个KNI虚拟接口时通过指定结构体rtekniconf的coreid和forcebind成员参数,设置此线程的亲核性。
为达到更高性能,内核线程绑定的核心应当与应用中DPDK的核心在同一个socket上。
KNI内核模块也可配置成为每个DPDK应用创建的KNI虚拟接口启动一个单独的内核线程。以下,使能多内核线程模式:
insmodkmodrtekni。kokthreadmodemultiple
此模式为每个KNI虚拟接口创建一个单独的内核线程在内核侧接收数据。内核线程的亲核性通过每个KNI虚拟接口创建时的结构体rtekniconf成员coreid和forcebind变量参数指定。
如果系统中由足够的未使用核心,多内核线程模式可提供具有扩展性的高性能。
如果kthreadmode参数未指定,使用单内核线程模式。默认链路状态
内核模块rtekni创建的KNI虚拟接口的链路状态,可通过模块加装时的carrier选项控制。
如果指定了carrieroff,当接口管理使能时,内核模块将接口的链路状态设置为关闭。DPDK应用可通过函数rtekniupdatelink设置KNI虚拟接口的链路状态。这对于需要KNI虚拟接口状态与对应的物理接口实际状态一致的应用是有用的。
如果指定了carrieron,当接口管理使能时,内核模块将自动设置接口的链路状态为启用。这对于仅将KNI接口作为纯虚拟接口,而不对应任何物理硬件;或者并不想通过rtekniupdatelink函数显示设置接口链路状态的DPDK应用是有用的。对于物理口为连接任何链路而进行的回环模式测试也是有用的。
以下,设置默认的链路状态为启用:
insmodkmodrtekni。kocarrieron
以下,设置默认的链路状态为关闭:
insmodkmodrtekni。kocarrieroff
如果carrier参数没有指定,KNI虚拟接口的默认链路状态为关闭。Thefollowingkernelmoduleoptionsareavailableincaseifaloopbackmodeisrequired。kthreadmodesinglemultiplenumberofkernelthreadslomodelomodefifolomodefifoskbloopbackmode以下命令首先以多线程模式加载rtekni内核模块。其次,kni应用指定两个接口(p0x3)启动;根据config参数可知,接口0(0,4,6,8)使用核心4运行接收任务,核心6运行发送任务,并且创建一个KNI虚拟接口vEth00,启动一个内核处理线程绑定在核心8上。类似的接口1(0,5,7,9)使用核心5运行接收任务,核心7运行发送任务,并且创建一个KNI虚拟接口vEth10,启动一个内核处理线程绑定在核心9上。rmmodrtekniinsmodkmodrtekni。kokthreadmodemultiple。buildknil47n4Pp0x3mconfig(0,4,6,8),(1,5,7,9)binshsetuppathtoDPDKexportRTESDKhomedpdkexportRTETARGETx8664nativelinuxappgccsetup512hugepagesmkdirpmnthugeumountthugetlbfsnodevmnthugemountthugetlbfsnodevmnthugeecho512sysdevicessystemnodenode0hugepageshugepages2048kBnrhugepagesbindeth1andeth2toLinuxgenericUIOmodprobeuiopcigeneric{RTESDK}toolsdpdknicbind。pybinduiopcigenericeth1{RTESDK}toolsdpdknicbind。pybinduiopcigenericeth2insertKNIkerneldriverinsmod{RTESDK}{RTETARGET}kmodrtekni。kostartKNIsampleapplicationexportLDLIBRARYPATH{RTESDK}{RTETARGET}lib{RTESDK}examplesknibuildknic0x0fn4Pp0x3config(0,0,1),(1,2,3)〔rootlocalhostdpdk19。11〕exportRTESDKpwd〔rootlocalhostdpdk19。11〕exportRTETARGETarm64armv8alinuxappgcc〔rootlocalhostdpdk19。11〕makeCexamplesknij8make:Enteringdirectorydata1dpdk19。11exampleskniCCmain。oLDkniINSTALLAPPkniINSTALLMAPkni。mapmake:Leavingdirectorydata1dpdk19。11exampleskni〔rootlocalhostdpdk19。11〕。examplesknibuildappknic0xFFFFFn4Pp0x3config(0,0,1),(1,2,3)EAL:Detected128lcore(s)EAL:Detected4NUMAnodesEAL:MultiprocesssocketvarrundpdkrtempsocketEAL:SelectedIOVAmodeVAEAL:Nofreehugepagesreportedinhugepages524288kBEAL:Nofreehugepagesreportedinhugepages524288kBEAL:Nofreehugepagesreportedinhugepages524288kBEAL:Nofreehugepagesreportedinhugepages524288kBEAL:Noavailablehugepagesreportedinhugepages524288kBEAL:Noavailablehugepagesreportedinhugepages2048kBEAL:FATAL:Cannotgethugepageinformation。EAL:Cannotgethugepageinformation。EAL:Errorexitingwithcode:1Cause:CouldnotinitialiseEAL(1)〔rootlocalhostdpdk19。11〕〔rootlocalhostdpdk19。11〕catsyskernelmmhugepageshugepages524288kBnrhugepages0〔rootlocalhostdpdk19。11〕echo256syskernelmmhugepageshugepages524288kBnrhugepages〔rootlocalhostdpdk19。11〕catsyskernelmmhugepageshugepages524288kBnrhugepages256〔rootlocalhostdpdk19。11〕
运行。usertoolsdpdksetup。sh
〔rootlocalhostdpdk19。11〕catsysdevicessystemnodehugepageshugepages524288kBnrhugepages64646464〔rootlocalhostdpdk19。11〕〔rootlocalhostdpdk19。11〕。examplesknibuildappknic0xFFFFFn4Pp0x3config(0,0,1),(1,2,3)EAL:Detected128lcore(s)EAL:Detected4NUMAnodesEAL:MultiprocesssocketvarrundpdkrtempsocketEAL:SelectedIOVAmodeVAEAL:Noavailablehugepagesreportedinhugepages2048kBEAL:ProbingVFIOsupport。。。EAL:PCIdevice0000:05:00。0onNUMAsocket0EAL:probedriver:19e5:200nethinicEAL:PCIdevice0000:06:00。0onNUMAsocket0EAL:probedriver:19e5:200nethinicEAL:PCIdevice0000:7d:00。0onNUMAsocket0EAL:probedriver:19e5:a222nethns3EAL:PCIdevice0000:7d:00。1onNUMAsocket0EAL:probedriver:19e5:a221nethns3EAL:PCIdevice0000:7d:00。2onNUMAsocket0EAL:probedriver:19e5:a222nethns3EAL:PCIdevice0000:7d:00。3onNUMAsocket0EAL:probedriver:19e5:a221nethns3EAL:Errorexitingwithcode:1Cause:NosupportedEthernetdevicefound〔rootlocalhostdpdk19。11〕lsaldevknicrw1rootroot10,57Sep2612:15devknicatprocmisc57kniminornumberdmidecodetmemorygrepSize
原文链接:https:www。cnblogs。comdream397p13565649。html