├── BIN-LICENSE ├── ChangeLog ├── LICENSE ├── ONLOAD-LICENSE ├── README ├── README.ef_vi ├── ReleaseNotes ├── ReleaseNotes-sfc ├── lwIP-LICENSE ├── mk ├── after.mk ├── apple_gcc.mk ├── before.mk ├── linux_gcc.mk ├── linux_kbuild.mk ├── makefile.copy.depends ├── middle.mk ├── platform │ ├── gnu.mk │ ├── gnu_aarch64.mk │ ├── gnu_ppc32le.mk │ ├── gnu_ppc64le.mk │ ├── gnu_x86_64.mk │ ├── linux.mk │ └── linux_uio_utils.mk └── site │ ├── ciapp.mk │ ├── ciip.mk │ ├── ciiscsi.mk │ ├── citools.mk │ ├── citpcommon.mk │ ├── ciul.mk │ ├── cplane.mk │ ├── efhw.mk │ ├── efrm.mk │ ├── efthrm.mk │ ├── libs.mk │ ├── mmake.mk │ ├── mpi.mk │ └── sfgpxe.mk ├── prebuilt ├── gnu_aarch64 │ └── tools │ │ ├── cplane │ │ ├── debug │ │ │ └── onload_cp_server │ │ └── onload_cp_server │ │ └── onload_mibdump │ │ ├── debug │ │ └── onload_mibdump │ │ └── onload_mibdump ├── gnu_x86_64 │ ├── lib │ │ └── zf │ │ │ ├── debug │ │ │ ├── libonload_zf.so │ │ │ ├── libonload_zf.so.1 │ │ │ ├── libonload_zf.so.1.1.1 │ │ │ └── libonload_zf_static.a │ │ │ ├── libonload_zf.so │ │ │ ├── libonload_zf.so.1 │ │ │ ├── libonload_zf.so.1.1.1 │ │ │ └── libonload_zf_static.a │ └── tools │ │ ├── cplane │ │ ├── debug │ │ │ └── onload_cp_server │ │ └── onload_cp_server │ │ ├── onload_mibdump │ │ ├── debug │ │ │ └── onload_mibdump │ │ └── onload_mibdump │ │ └── zf │ │ ├── debug │ │ └── zf_stackdump │ │ └── zf_stackdump ├── prebuilt_config_aarch64 ├── prebuilt_config_i686 └── prebuilt_config_x86_64 ├── scripts ├── check_header_presence ├── check_library_presence ├── check_prototype ├── libc_compat.sh ├── mmake ├── mmakebuildtree ├── mmaketool ├── onload ├── onload_apps │ ├── mpiexec │ ├── mpirun │ ├── sfnt-pingpong │ └── sfnt-stream ├── onload_build ├── onload_install ├── onload_iptables ├── onload_misc │ ├── dkms.conf │ ├── onload-extract-notes │ ├── onload-make-official-srpm │ ├── onload_depmod.conf │ ├── onload_modprobe.conf │ ├── onload_modules-load.d.conf │ ├── onload_sysconfig │ ├── onload_uninstall │ ├── openonload.dkms-spec │ ├── openonload.spec │ ├── setup.py │ ├── solar_clusterd-spec │ └── sysconfig_onload_modules ├── onload_profiles │ ├── cloud.opf │ ├── haproxy-balanced.opf │ ├── haproxy-parse-config.opf-fragment │ ├── haproxy-performance.opf │ ├── latency-best.opf │ ├── latency.opf │ ├── nettyio-balanced.opf │ ├── nettyio-performance.opf │ ├── nginx-like-st.opf │ ├── nginx-parse-config.opf-fragment │ ├── nginx-proxy-balanced.opf │ ├── nginx-proxy-performance.opf │ ├── nginx-webserver-balanced.opf │ ├── nginx-webserver-performance.opf │ ├── node-js.opf │ ├── proxy-throughput.opf-fragment │ ├── redis-balanced.opf │ ├── redis-performance.opf │ ├── safe.opf │ ├── throughput.opf-fragment │ ├── throughput_base.opf-fragment │ ├── wait-old-cluster-exit.opf-fragment │ ├── wan-traffic.opf-fragment │ └── zeromq.opf ├── onload_rpmtest ├── onload_tcpdump ├── onload_tool ├── sfcaffinity ├── sfcaffinity.py ├── sfcaffinity_config ├── sfcirqaffinity ├── sfcmask.py ├── sh │ ├── disttag │ ├── fns │ ├── mmake-fns │ └── mmakebuildtree_gen └── zf_debug └── src ├── driver ├── efab │ └── ipid.c ├── linux │ ├── gcov.c │ ├── gcov.h │ └── mmake.mk ├── linux_affinity │ ├── kernel_compat.h │ ├── kernel_compat.sh │ ├── mmake.mk │ └── sfcaffinity.c ├── linux_char │ ├── char_driver.c │ ├── char_internal.h │ ├── efch.h │ ├── efch_capabilities.c │ ├── efch_license.c │ ├── efch_manager.c │ ├── efch_memreg.c │ ├── efch_pd.c │ ├── filter_list.c │ ├── filter_list.h │ ├── linux_char_internal.h │ ├── mmake.mk │ ├── mmap.c │ ├── mmap_iopage.c │ ├── pio.c │ ├── resource_table.c │ ├── vi_resource.c │ ├── vi_resource_event.c │ ├── vi_resource_mmap.c │ └── vi_set.c ├── linux_net │ ├── Makefile │ ├── aoe.c │ ├── aoe.h │ ├── bitfield.h │ ├── debugfs.c │ ├── debugfs.h │ ├── driverlink.c │ ├── driverlink.h │ ├── driverlink_api.h │ ├── dump.c │ ├── dump.h │ ├── ef10.c │ ├── ef10_regs.h │ ├── ef10_sriov.c │ ├── ef10_sriov.h │ ├── efx.c │ ├── efx.h │ ├── efx_ioctl.h │ ├── efx_linux_types.h │ ├── enum.h │ ├── ethtool.c │ ├── farch.c │ ├── farch_regs.h │ ├── filter.h │ ├── io.h │ ├── ioctl.c │ ├── kabi_compat.h │ ├── kernel_compat.c │ ├── kernel_compat.h │ ├── kernel_compat.sh │ ├── kernel_compat_funcs.sh │ ├── linux_mdio.c │ ├── linux_mdio.h │ ├── linux_mtd_mtd.h │ ├── mcdi.c │ ├── mcdi.h │ ├── mcdi_mon.c │ ├── mcdi_pcol.h │ ├── mcdi_pcol_aoe.h │ ├── mcdi_port.c │ ├── mmake.mk │ ├── mtd.c │ ├── net_driver.h │ ├── nic.c │ ├── nic.h │ ├── ptp.c │ ├── rx.c │ ├── selftest.c │ ├── selftest.h │ ├── sfctool.c │ ├── sfctool.h │ ├── siena.c │ ├── siena_sriov.c │ ├── siena_sriov.h │ ├── sriov.c │ ├── sriov.h │ ├── trace │ │ └── events │ │ │ └── sfc.h │ ├── tx.c │ ├── tx.h │ ├── tx_tso.c │ ├── vfdi.h │ └── workarounds.h ├── linux_onload │ ├── aarch64_linux_trampoline.c │ ├── aarch64_linux_trampoline_asm.S │ ├── compat.c │ ├── cplane.c │ ├── cplane_prot.c │ ├── driver.c │ ├── driverlink_ip.c │ ├── dshm.c │ ├── epoll_device.c │ ├── linux_cplane_netif.c │ ├── linux_stats.c │ ├── linux_trampoline.c │ ├── linux_trampoline_asm_x86.S │ ├── mmake.mk │ ├── mmap.c │ ├── ofe_sysdep.c │ ├── onload_internal.h │ ├── onload_kernel_compat.h │ ├── onloadfs.c │ ├── ossock_calls.c │ ├── pinbuf.c │ ├── ppc64_linux_trampoline.c │ ├── ppc64_linux_trampoline_asm.S │ ├── ppc64_linux_trampoline_internal.c │ ├── ppc64_linux_trampoline_internal.h │ ├── shmbuf.c │ ├── sigaction_calls.c │ ├── tcp_sendpage.c │ ├── terminate.c │ ├── timesync.c │ └── x86_linux_trampoline.c ├── linux_resource │ ├── Makefile │ ├── bt_stats.c │ ├── compat_pat_wc.c │ ├── compat_pat_wc.h │ ├── driverlink_new.c │ ├── filter.c │ ├── iopage.c │ ├── kernel_compat.h │ ├── kernel_proc.c │ ├── linux_resource_internal.h │ ├── mmake.mk │ ├── port_sniff.c │ ├── resource_driver.c │ └── vfdi.h └── mmake.mk ├── include ├── ci │ ├── affinity │ │ ├── k_drv_intf.h │ │ └── ul_drv_intf.h │ ├── app.h │ ├── app │ │ ├── checkedsocket.h │ │ ├── ctimer.h │ │ ├── ifindex.h │ │ ├── net.h │ │ ├── onload.h │ │ ├── platform │ │ │ └── unix.h │ │ ├── rawpkt.h │ │ ├── recvmmsg.h │ │ ├── sendmmsg.h │ │ ├── socket.h │ │ ├── stats.h │ │ ├── testapp.h │ │ ├── testpattern.h │ │ └── utils.h │ ├── compat.h │ ├── compat │ │ ├── aarch64.h │ │ ├── gcc.h │ │ ├── gcc_aarch64.h │ │ ├── gcc_ppc.h │ │ ├── gcc_x86.h │ │ ├── pg_x86.h │ │ ├── ppc.h │ │ ├── primitive.h │ │ ├── sysdep.h │ │ ├── utils.h │ │ ├── x86.h │ │ └── x86_64.h │ ├── driver │ │ ├── chrdev.h │ │ ├── driverlink_api.h │ │ ├── efab │ │ │ ├── debug.h │ │ │ ├── hardware.h │ │ │ ├── hardware │ │ │ │ ├── alaska8080111.h │ │ │ │ ├── bitfield.h │ │ │ │ ├── byteswap.h │ │ │ │ ├── common.h │ │ │ │ ├── ef10.h │ │ │ │ ├── ef10_evq.h │ │ │ │ ├── ef10_vaddr.h │ │ │ │ ├── falcon.h │ │ │ │ ├── falcon │ │ │ │ │ ├── falcon_desc.h │ │ │ │ │ ├── falcon_event.h │ │ │ │ │ ├── falcon_grmon.h │ │ │ │ │ ├── falcon_intr_vec.h │ │ │ │ │ ├── falcon_mac.h │ │ │ │ │ ├── falcon_rmon.h │ │ │ │ │ └── falcon_xgrmon.h │ │ │ │ ├── falcon_spi.h │ │ │ │ ├── falcon_stats.h │ │ │ │ ├── falcon_ul.h │ │ │ │ ├── host_common.h │ │ │ │ ├── host_common_mac.h │ │ │ │ ├── host_common_pci_defs.h │ │ │ │ ├── host_ef10_common.h │ │ │ │ └── ixf1002.h │ │ │ ├── kprof.h │ │ │ └── open.h │ │ ├── internal.h │ │ ├── pci.h │ │ ├── platform │ │ │ ├── linux_kernel.h │ │ │ ├── ul_driver_common.h │ │ │ ├── unix_common.h │ │ │ └── unix_ul_driver.h │ │ └── resource │ │ │ └── linux_efhw_nic.h │ ├── efch │ │ ├── mmap.h │ │ ├── mmap_id.h │ │ ├── op_types.h │ │ └── resource_id.h │ ├── efhw │ │ ├── checks.h │ │ ├── common.h │ │ ├── common_ci2linux.h │ │ ├── common_linux.h │ │ ├── common_sysdep.h │ │ ├── debug.h │ │ ├── debug_ci2linux.h │ │ ├── debug_linux.h │ │ ├── device.h │ │ ├── ef10.h │ │ ├── efhw_buftable.h │ │ ├── efhw_config.h │ │ ├── efhw_types.h │ │ ├── eventq.h │ │ ├── eventq_macros.h │ │ ├── falcon.h │ │ ├── falcon_ul.h │ │ ├── hardware_ci2linux.h │ │ ├── hardware_linux.h │ │ ├── hardware_sysdep.h │ │ ├── hardware_ul.h │ │ ├── iopage.h │ │ ├── iopage_linux.h │ │ ├── iopage_types.h │ │ ├── iopage_ul.h │ │ ├── mc_driver_pcol.h │ │ ├── nic.h │ │ ├── public.h │ │ ├── sysdep.h │ │ ├── sysdep_ci2linux.h │ │ └── sysdep_linux.h │ ├── efrm │ │ ├── buddy.h │ │ ├── buffer_table.h │ │ ├── debug.h │ │ ├── debug_linux.h │ │ ├── driver_private.h │ │ ├── efrm_client.h │ │ ├── efrm_filter.h │ │ ├── efrm_nic.h │ │ ├── efrm_port_sniff.h │ │ ├── kernel_proc.h │ │ ├── kfifo.h │ │ ├── licensing.h │ │ ├── nic_set.h │ │ ├── nic_table.h │ │ ├── pd.h │ │ ├── pio.h │ │ ├── private.h │ │ ├── resource.h │ │ ├── resource_id.h │ │ ├── sysdep.h │ │ ├── sysdep_ci2linux.h │ │ ├── sysdep_linux.h │ │ ├── vf_resource.h │ │ ├── vi_allocation.h │ │ ├── vi_resource.h │ │ ├── vi_resource_manager.h │ │ ├── vi_resource_private.h │ │ └── vi_set.h │ ├── internal │ │ ├── banner.h │ │ ├── citp_opts.h │ │ ├── efabcfg.h │ │ ├── event_select.h │ │ ├── ip.h │ │ ├── ip_log.h │ │ ├── ip_shared_ops.h │ │ ├── ip_shared_types.h │ │ ├── ip_signal.h │ │ ├── ip_stats.h │ │ ├── ip_stats_count_def.h │ │ ├── ip_stats_ops.h │ │ ├── ip_timestamp.h │ │ ├── ip_types.h │ │ ├── ipid.h │ │ ├── iptimer.h │ │ ├── more_stats.h │ │ ├── more_stats_def.h │ │ ├── ni_dllist.h │ │ ├── ni_dllist_tmpl_instantiate.h │ │ ├── oo_vi_flags.h │ │ ├── opts_citp_def.h │ │ ├── opts_netif_def.h │ │ ├── opts_user_def.h │ │ ├── os_sock.h │ │ ├── pio_buddy.h │ │ ├── rcversion.h │ │ ├── stats_def.h │ │ ├── stats_dump.h │ │ ├── syscall.h │ │ ├── tcp_ext_stats_count_def.h │ │ ├── tcp_stats_count_def.h │ │ ├── tls.h │ │ ├── trampoline.h │ │ ├── transport_common.h │ │ ├── transport_config_opt.h │ │ ├── transport_config_opt_cloud.h │ │ ├── transport_config_opt_extra.h │ │ ├── udp_stats_count_def.h │ │ ├── user_opts.h │ │ └── version.h │ ├── net │ │ ├── arp.h │ │ ├── ethernet.h │ │ ├── ioctls.h │ │ ├── ipv4.h │ │ ├── ipv6.h │ │ ├── ipvx.h │ │ ├── ipvx_sh.h │ │ └── sockopts.h │ ├── tools.h │ └── tools │ │ ├── bitfield.h │ │ ├── buddy.h │ │ ├── buffer.h │ │ ├── bufrange.h │ │ ├── byteorder.h │ │ ├── config.h │ │ ├── cpu_features.h │ │ ├── crc32c.h │ │ ├── debug.h │ │ ├── distq.h │ │ ├── dllist.h │ │ ├── fifo.h │ │ ├── fifos.h │ │ ├── idllist.h.tmpl │ │ ├── internal.h │ │ ├── iovec.h │ │ ├── ipcsum.h │ │ ├── ippacket.h │ │ ├── istack.h │ │ ├── log.h │ │ ├── log2.h │ │ ├── magic.h │ │ ├── memchk.h │ │ ├── memleak_debug.h │ │ ├── namespace.h │ │ ├── pktdump.h │ │ ├── platform │ │ ├── gcc_aarch64.h │ │ ├── gcc_ppc.h │ │ ├── gcc_x86.h │ │ ├── linux_kernel.h │ │ ├── pg_x86.h │ │ ├── storport.h │ │ ├── ul_common.h │ │ └── unix.h │ │ ├── sllist.h │ │ ├── spinlock.h │ │ ├── stack.h │ │ ├── stacks.h │ │ ├── sysdep.h │ │ ├── timeval.h │ │ ├── ustream.h │ │ └── utils.h ├── cplane │ ├── agent.h │ ├── cplane.h │ ├── hash.h │ ├── ioctl.h │ ├── mib.h │ ├── mib_dllist_tmpl_instantiate.h │ ├── mibdump_sock.h │ ├── mmap.h │ └── server.h ├── etherfabric │ ├── base.h │ ├── capabilities.h │ ├── checksum.h │ ├── doxygen │ │ ├── 000_main.dox │ │ ├── 005_whats_new.dox │ │ ├── 010_overview.dox │ │ ├── 020_concepts.dox │ │ ├── 030_apps.dox │ │ ├── 040_using.dox │ │ ├── 050_examples.dox │ │ ├── disclaimer.tex │ │ ├── doxyfile_ef_vi │ │ ├── efvi_vnic.png │ │ ├── footer.tex │ │ ├── header.tex │ │ ├── packet_buffers.vsdx │ │ ├── packet_buffers_jumbo-2.png │ │ ├── packet_buffers_jumbo-2_merged.png │ │ ├── packet_buffers_jumbo-n.png │ │ ├── packet_buffers_jumbo-n_merged.png │ │ ├── packet_buffers_layout.png │ │ ├── packet_buffers_layout_merged.png │ │ ├── packet_buffers_non-jumbo.png │ │ ├── packet_buffers_non-jumbo_merged.png │ │ ├── sf_logo.eps │ │ └── solarflare_logo_blublk.png │ ├── ef_vi.h │ ├── internal │ │ ├── cluster_protocol.h │ │ ├── evq_rx_iter.h │ │ └── internal.h │ ├── memreg.h │ ├── packedstream.h │ ├── pd.h │ ├── pio.h │ ├── timer.h │ └── vi.h ├── mmake.mk ├── onload │ ├── atomics.h │ ├── common.h │ ├── cplane_driver.h │ ├── cplane_driver_handle.h │ ├── cplane_ops.h │ ├── cplane_prot.h │ ├── cplane_prot_types.h │ ├── debug.h │ ├── debug_intf.h │ ├── debug_ops.h │ ├── declare_syscalls.h.tmpl │ ├── driveraccess.h │ ├── driverlink_filter.h │ ├── driverlink_filter_private.h │ ├── drv │ │ └── dump_to_user.h │ ├── dshm.h │ ├── dup2_lock.h │ ├── eplock.h │ ├── eplock_resource.h │ ├── epoll.h │ ├── extensions.h │ ├── extensions_timestamping.h │ ├── extensions_zc.h │ ├── fd_private.h │ ├── hash.h │ ├── id_pool.h │ ├── iobufset.h │ ├── ioctl.h │ ├── ioctl_base.h │ ├── ip_protocols.h │ ├── ipid.h │ ├── linux_ip_protocols.h │ ├── linux_mmap.h │ ├── linux_onload.h │ ├── linux_onload_internal.h │ ├── linux_trampoline.h │ ├── mmap.h │ ├── mmap_base.h │ ├── nic.h │ ├── offbuf.h │ ├── oo_pipe.h │ ├── oof_hw_filter.h │ ├── oof_interface.h │ ├── oof_nat.h │ ├── oof_onload.h │ ├── oof_socket.h │ ├── osfile.h │ ├── pkt_filler.h │ ├── pkt_p.h │ ├── pktq.h │ ├── primitive_types.h │ ├── shmbuf.h │ ├── signals.h │ ├── sleep.h │ ├── sock_p.h │ ├── state_p.h │ ├── syscall_unix.h │ ├── syscalls.h │ ├── tcp_driver.h │ ├── tcp_helper.h │ ├── tcp_helper_endpoint.h │ ├── tcp_helper_fns.h │ ├── tcp_poll.h │ ├── test_intf.h │ ├── tmpl.h │ ├── ul.h │ ├── ul │ │ ├── per_thread.h │ │ ├── rwlock.h │ │ ├── stackname.h │ │ ├── tcp_helper.h │ │ └── wqlock.h │ ├── unix_intf.h │ ├── version.h │ └── version_check.h └── zf │ ├── attr.h │ ├── muxer.h │ ├── sysdep │ └── x86.h │ ├── types.h │ ├── zf.h │ ├── zf_alts.h │ ├── zf_ds.h │ ├── zf_platform.h │ ├── zf_reactor.h │ ├── zf_stack.h │ ├── zf_tcp.h │ └── zf_udp.h ├── lib ├── ciapp │ ├── bytepattern.c │ ├── ctimer.c │ ├── dummy_work.c │ ├── dump_select_set.c │ ├── dump_tcp_info.c │ ├── errno.c │ ├── fork_filter.c │ ├── get_record.c │ ├── getinput.c │ ├── iarray_mean_and_limits.c │ ├── iarray_median.c │ ├── iarray_mode.c │ ├── iarray_variance.c │ ├── ifindex.c │ ├── mmake.mk │ ├── net.c │ ├── onload_info.c │ ├── put_record.c │ ├── qsort_compare_int.c │ ├── rate_thread.c │ ├── rawpkt.c │ ├── read_exact.c │ ├── recv_exact.c │ ├── select.c │ ├── stats.c │ ├── sys_info.c │ ├── testapp.c │ ├── testethpkt.c │ ├── testpattern.c │ └── write_exact.c ├── citools │ ├── buddy.c │ ├── buffer.c │ ├── bufrange.c │ ├── cas64u.S │ ├── cithread.c │ ├── citools_internal.h │ ├── copy_iovec.c │ ├── copy_to_iovec.c │ ├── cpu_features.c │ ├── crc16.c │ ├── crc32.c │ ├── csum_copy2.c │ ├── csum_copy_iovec.c │ ├── csum_copy_to_iovec.c │ ├── dllist.c │ ├── drv_log_fn.c │ ├── drv_thread.c │ ├── eth_addr.c │ ├── fail.c │ ├── fifo_grow_lock.c │ ├── get_cpu_khz.c │ ├── glibc_version.c │ ├── hex_dump.c │ ├── hex_dump_to_raw.c │ ├── icmp_checksum.c │ ├── internal.h │ ├── ip_addr.c │ ├── ip_csum_partial.c │ ├── ip_csum_precompute.c │ ├── ipcsum.c │ ├── ippacket.c │ ├── log.c │ ├── log_buffer.c │ ├── log_file.c │ ├── log_fn.c │ ├── log_nth.c │ ├── log_unique.c │ ├── memchk.c │ ├── memleak_debug.c │ ├── mmake.mk │ ├── namespace.c │ ├── parse_eth_addr.c │ ├── pktdump.c │ ├── sys_fail.c │ ├── tcp_checksum.c │ ├── tcp_csum_precompute.c │ ├── toeplitz.c │ ├── udp_checksum.c │ └── udp_csum_precompute.c ├── ciul │ ├── bitfield.h │ ├── capabilities.c │ ├── checksum.c │ ├── ctpio.c │ ├── driver_access.h │ ├── ef10_event.c │ ├── ef10_evtimer.c │ ├── ef10_hw_defs.h │ ├── ef10_vi.c │ ├── ef_app_cluster.c │ ├── ef_vi_ef10.h │ ├── ef_vi_falcon.h │ ├── ef_vi_falcon_desc.h │ ├── ef_vi_falcon_event.h │ ├── ef_vi_internal.h │ ├── event_q.c │ ├── event_q_put.c │ ├── falcon_event.c │ ├── falcon_evtimer.c │ ├── falcon_hw_defs.h │ ├── falcon_vi.c │ ├── filter.c │ ├── logging.c │ ├── logging.h │ ├── memcpy_to_io.h │ ├── memreg.c │ ├── mmake.mk │ ├── open.c │ ├── pd.c │ ├── pio.c │ ├── pt_endpoint.c │ ├── pt_rx.c │ ├── pt_tx.c │ ├── sysdep.h │ ├── sysdep_linux.h │ ├── sysdep_unix.h │ ├── vi_discard.c │ ├── vi_init.c │ ├── vi_layout.c │ ├── vi_prime.c │ ├── vi_set.c │ └── vi_stats.c ├── cplane │ ├── mib.c │ ├── mib_fwd.c │ ├── mmake.mk │ ├── onload.c │ ├── services.c │ └── version.c ├── efhw │ ├── ef10.c │ ├── ef10_mcdi.h │ ├── eventq.c │ ├── falcon.c │ ├── mmake.mk │ └── nic.c ├── efrm │ ├── assert_valid.c │ ├── bt_manager.c │ ├── bt_manager.h │ ├── buddy.c │ ├── driver_object.c │ ├── efrm_internal.h │ ├── efrm_pd.c │ ├── efrm_pd.h │ ├── efrm_pio.c │ ├── efrm_pio.h │ ├── efrm_vf.h │ ├── efrm_vi.h │ ├── efrm_vi_set.c │ ├── efrm_vi_set.h │ ├── kfifo.c │ ├── licensing.c │ ├── mmake.mk │ ├── resource_manager.c │ ├── resources.c │ ├── vi_allocator.c │ ├── vi_resource_alloc.c │ ├── vi_resource_event.c │ ├── vi_resource_flush.c │ ├── vi_resource_info.c │ └── vi_resource_manager.c ├── efthrm │ ├── cplane_netif.c │ ├── driverlink_filter.c │ ├── dump_to_user.c │ ├── eplock_resource_manager.c │ ├── id_pool.c │ ├── iobufset.c │ ├── ip_prot_rx.c │ ├── ip_protocols.c │ ├── onload_nic.c │ ├── oo_hw_filter.h │ ├── oof_filters.c │ ├── oof_impl.h │ ├── oof_interface.c │ ├── oof_nat.c │ ├── oof_onload.c │ ├── oof_onload_types.h │ ├── oof_tproxy_ipproto.h │ ├── tcp_filters.c │ ├── tcp_filters_deps.h │ ├── tcp_filters_internal.h │ ├── tcp_helper_cluster.c │ ├── tcp_helper_endpoint.c │ ├── tcp_helper_endpoint_move.c │ ├── tcp_helper_ioctl.c │ ├── tcp_helper_linux.c │ ├── tcp_helper_mmap.c │ ├── tcp_helper_resource.c │ ├── tcp_helper_resource.h │ ├── tcp_helper_sleep.c │ ├── tcp_helper_stats_dump.c │ └── tcp_helper_stats_dump.h ├── mmake.mk ├── onload_ext │ ├── mmake.mk │ ├── onload_ext.c │ └── onload_ext_static.c ├── sfcaffinity │ ├── mmake.mk │ └── sfcaffinity.c └── transport │ ├── common │ ├── lock.c │ ├── log.c │ ├── mmake.mk │ └── netif_init.c │ ├── ip │ ├── COMPLIANCE │ ├── active_wild.c │ ├── common_ioctl.c │ ├── common_sockopts.c │ ├── cplane_ops.c │ ├── csum_copy_iovec_setlen.c │ ├── efabcfg.c │ ├── eplock_slow.c │ ├── icmp_send.c │ ├── init.c │ ├── iovec_ptr.h │ ├── ip_cmsg.c │ ├── ip_internal.h │ ├── ip_tx.c │ ├── ip_tx.h │ ├── ipid.c │ ├── iptimer.c │ ├── mmake.mk │ ├── netif.c │ ├── netif_debug.c │ ├── netif_event.c │ ├── netif_init.c │ ├── netif_pkt.c │ ├── netif_stats.c │ ├── netif_table.c │ ├── netif_table.h │ ├── netif_table_ip6.c │ ├── netif_tx.c │ ├── netif_tx.h │ ├── os_sock.c │ ├── per_thread.c │ ├── pio_buddy.c │ ├── pipe.c │ ├── pkt_checksum.c │ ├── pkt_filler.c │ ├── pmtu.c │ ├── rwlock.c │ ├── save_fd.c │ ├── signal.c │ ├── sockerr.c │ ├── socket.c │ ├── syscall.c │ ├── tcp_close.c │ ├── tcp_connect.c │ ├── tcp_debug.c │ ├── tcp_driver_ops.c │ ├── tcp_helper.c │ ├── tcp_init_shared.c │ ├── tcp_ioctl.c │ ├── tcp_misc.c │ ├── tcp_recv.c │ ├── tcp_rx.c │ ├── tcp_rx.h │ ├── tcp_send.c │ ├── tcp_sleep.c │ ├── tcp_sockopts.c │ ├── tcp_stats.c │ ├── tcp_syncookie.c │ ├── tcp_synrecv.c │ ├── tcp_timer.c │ ├── tcp_tx.c │ ├── tcp_tx.h │ ├── tcp_tx_reformat.c │ ├── udp.c │ ├── udp_connect.c │ ├── udp_internal.h │ ├── udp_ioctl.c │ ├── udp_misc.c │ ├── udp_recv.c │ ├── udp_rx.c │ ├── udp_send.c │ ├── udp_sockopts.c │ └── waitable.c │ ├── mmake.mk │ └── unix │ ├── closed_fd.c │ ├── common_fcntl.c │ ├── debug.c │ ├── environ.c │ ├── epinfo.c │ ├── epoll_fd.c │ ├── epoll_fd_b.c │ ├── exec.c │ ├── exports.map │ ├── fdtable.c │ ├── internal.h │ ├── log_fn.c │ ├── mapfile.ilp32 │ ├── mapfile.lp64 │ ├── mmake.mk │ ├── netif_init.c │ ├── nonsock.c │ ├── nonsock.h │ ├── onload_ext_intercept.c │ ├── passthrough_fd.c │ ├── pipe_fd.c │ ├── poll_select.c │ ├── protocol_manager.c │ ├── sockcall_intercept.c │ ├── stackname.c │ ├── stackopt.c │ ├── startup.c │ ├── startup_order.h │ ├── sys.c │ ├── tcp_fd.c │ ├── tmpl_intercept.c │ ├── trampoline.c │ ├── trampoline_asm.S │ ├── udp_fd.c │ ├── ul_epoll.h │ ├── ul_pipe.h │ ├── ul_poll.h │ ├── ul_select.h │ ├── utils.c │ ├── vfork_intercept.S │ ├── wqlock.c │ └── zc_intercept.c ├── mmake.mk ├── tests ├── ef_vi │ ├── efforward.c │ ├── efforward_packed.c │ ├── efjumborx.c │ ├── eflatency.c │ ├── efrink.h │ ├── efrink_consumer.c │ ├── efrink_controller.c │ ├── efrss.c │ ├── efsend.c │ ├── efsend_common.c │ ├── efsend_common.h │ ├── efsend_pio.c │ ├── efsend_pio_warm.c │ ├── efsend_timestamping.c │ ├── efsink.c │ ├── efsink_packed.c │ ├── mmake.mk │ ├── stats.py │ ├── utils.c │ └── utils.h ├── mmake.mk ├── onload │ ├── extensions │ │ ├── .onload_intercept │ │ ├── Makefile │ │ ├── libpthread_intercept.c │ │ ├── libpthread_test.c │ │ ├── onload_fd_stat.c │ │ ├── onload_is_present.c │ │ ├── onload_move_fd.c │ │ ├── onload_recv_filter.c │ │ ├── onload_set_stackname.c │ │ ├── onload_stack_opt.c │ │ ├── onload_stackname.c │ │ ├── onload_thread_set_spin.c │ │ └── zc_udp_recv.c │ ├── hwtimestamping │ │ ├── cpacket_send.c │ │ ├── mmake.mk │ │ ├── rx_timestamping.c │ │ └── tx_timestamping.c │ ├── mmake.mk │ ├── onload_remote_monitor │ │ ├── mmake.mk │ │ ├── orm_example_client │ │ └── using_collectd │ │ │ ├── README.collectd_example.txt │ │ │ └── collectd_example.conf │ └── wire_order │ │ ├── mmake.mk │ │ ├── wire_order.h │ │ ├── wire_order_client.c │ │ └── wire_order_server.c ├── rtt │ ├── mmake.mk │ ├── rtt.c │ ├── rtt.h │ ├── rtt_efvi.c │ └── rtt_socket.c ├── trade_sim │ ├── README │ ├── ct_rx.h │ ├── exchange.c │ ├── mmake.mk │ ├── trader_onload_ds_efvi.c │ ├── trader_tcpdirect_ds_efvi.c │ ├── trader_tcpdirect_ds_efvi_ct_rx.c │ ├── utils.c │ └── utils.h └── zf_apps │ ├── mmake.mk │ ├── shared │ └── mmake.mk │ ├── static │ └── mmake.mk │ ├── zf_supported.sh │ ├── zf_utils.h │ ├── zfaltpingpong.c │ ├── zfsink.c │ ├── zftcpmtpong.c │ ├── zftcppingpong.c │ └── zfudppingpong.c └── tools ├── ip ├── fuser.c ├── libstack.c ├── libstack.h ├── mmake.mk ├── sockbuf_filter.h ├── stackdump.c └── tcpdump_bin.c ├── jni ├── OnloadExt.java ├── OnloadTemplateSend.java ├── OnloadWireOrderDelivery.java ├── OnloadZeroCopy.java ├── README └── libOnloadExt.c ├── mmake.mk ├── onload_remote_monitor ├── ftl_decls.h ├── ftl_defs.h ├── mmake.mk ├── onload_remote_monitor ├── orm_json.c ├── orm_json_lib.c ├── orm_json_lib.h ├── orm_webserver ├── orm_zmq_publisher.c └── zmq_subscriber.c ├── sfcaffinity ├── mmake.mk └── sfcaffinity_tool.c └── solar_clusterd ├── __init__.py ├── cluster_protocol.c ├── daemonize.py ├── example.conf ├── filter_string.c ├── internal.h ├── mmake.mk ├── parse_config.py └── solar_clusterd /LICENSE: -------------------------------------------------------------------------------- 1 | 2 | The software in this package is Copyright 2006-2018 Solarflare 3 | Communications Inc., 2002-2005 Level 5 Networks. All rights reserved. 4 | 5 | Except as noted otherwise below, OpenOnload and EnterpriseOnload are 6 | licensed under the GNU General Public License version 2 (GPLv2) and 7 | subject to the distribution agreement shown in ONLOAD_LICENSE. 8 | 9 | Note that applications that use the Onload library via the LD_PRELOAD 10 | linkage mechanism are not subject to the terms of the GPL because they 11 | are not derived works of Onload. 12 | 13 | The Onload Extensions Stub Library is licensed under the BSD 2-Clause 14 | Licence. 15 | 16 | The Etherfabric API and library (ef_vi) are licensed under the GNU 17 | Lesser General Public License version 2.1. 18 | 19 | This package includes software derived from lwIP. Please see 20 | lwIP-LICENSE. 21 | 22 | The TCP Direct API and library and other binary objects are licensed as 23 | described in BIN-LICENSE. 24 | -------------------------------------------------------------------------------- /mk/makefile.copy.depends: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-2.0 OR Solarflare-Binary 2 | # X-SPDX-Copyright-Text: (c) Solarflare Communications Inc 3 | 4 | TARGETS := 5 | 6 | all: _all 7 | 8 | -include copy.depends 9 | 10 | _all: $(TARGETS) 11 | 12 | 13 | clean: 14 | rm -rf $(TARGETS) 15 | 16 | 17 | -------------------------------------------------------------------------------- /mk/platform/gnu.mk: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-2.0 OR Solarflare-Binary 2 | # X-SPDX-Copyright-Text: (c) Solarflare Communications Inc 3 | GNU := 1 4 | ifndef MMAKE_CTUNE 5 | MMAKE_CTUNE = "-msse" 6 | # Not all gcc's support -mtune=native, so we do a dummy invocation with that 7 | # argument and only use the argument if the gcc invocation doesn't fail. 8 | # Note that gcc takes empty STDIN, is told it is C (with -x c) and will create an output executable! 9 | # Then use cond && a || b in order to set MMAKE_CTUNE := "-mtune=native" if the test compile worked 10 | MMAKE_CTUNE += $(shell $(CC) -x c -c -march=core2 - -o /dev/null /dev/null 2>&1 && echo "-march=core2" || echo "") 11 | MMAKE_CTUNE += $(shell $(CC) -x c -c -mtune=native - -o /dev/null /dev/null 2>&1 && echo "-mtune=native" || echo "") 12 | endif 13 | MMAKE_CARCH := -m32 $(MMAKE_CTUNE) 14 | 15 | MMAKE_RELOCATABLE_LIB := -z combreloc 16 | 17 | include $(TOP)/mk/linux_gcc.mk 18 | -------------------------------------------------------------------------------- /mk/platform/gnu_aarch64.mk: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-2.0 OR Solarflare-Binary 2 | # X-SPDX-Copyright-Text: (c) Solarflare Communications Inc 3 | GNU := 1 4 | ifndef MMAKE_CTUNE 5 | # Not all gcc's support -mtune=native, so we do a dummy invocation with that 6 | # argument and only use the argument if the gcc invocation doesn't fail. 7 | # Note that gcc takes empty STDIN, is told it is C (with -x c) and will create an output executable! 8 | # Then use cond && a || b in order to set MMAKE_CTUNE := "-mtune=native" if the test compile worked 9 | MMAKE_CTUNE := $(shell $(CC) -x c -c -mtune=native - -o /dev/null /dev/null 2>&1 && echo "-mtune=native" || echo "") 10 | endif 11 | 12 | AARCH64_PAGE_SIZE := $(shell getconf PAGESIZE) 13 | 14 | MMAKE_CARCH := -march=native $(MMAKE_CTUNE) -DAARCH64_PAGE_SIZE=$(AARCH64_PAGE_SIZE) 15 | 16 | MMAKE_RELOCATABLE_LIB := -z combreloc 17 | 18 | include $(TOP)/mk/linux_gcc.mk 19 | 20 | -------------------------------------------------------------------------------- /mk/platform/gnu_ppc32le.mk: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-2.0 OR Solarflare-Binary 2 | # X-SPDX-Copyright-Text: (c) Solarflare Communications Inc 3 | 4 | GNU := 1 5 | ifndef MMAKE_CTUNE 6 | MMAKE_CTUNE := -mtune=native 7 | endif 8 | MMAKE_CARCH := -m32 -mcpu=native $(MMAKE_CTUNE) 9 | 10 | MMAKE_RELOCATABLE_LIB := -mrelocatable-lib 11 | 12 | include $(TOP)/mk/linux_gcc.mk 13 | -------------------------------------------------------------------------------- /mk/platform/gnu_ppc64le.mk: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-2.0 OR Solarflare-Binary 2 | # X-SPDX-Copyright-Text: (c) Solarflare Communications Inc 3 | GNU := 1 4 | 5 | #Following is how we optimised for PPC64 BE, which I doubt is optimal here, 6 | #TBD: work out best tuning settings for PPC64 LE 7 | #ifndef MMAKE_CTUNE 8 | # MMAKE_CTUNE := -mtune=native 9 | # ifneq ($(shell grep -i power8 /proc/cpuinfo),) 10 | # MMAKE_CTUNE += -mpower8-fusion -O6 11 | # endif 12 | #endif 13 | #MMAKE_CARCH := -m64 -mcpu=native $(MMAKE_CTUNE) 14 | 15 | MMAKE_CTUNE := 16 | MMAKE_CARCH := -m64 $(MMAKE_CTUNE) 17 | 18 | MMAKE_RELOCATABLE_LIB := -mrelocatable-lib 19 | 20 | include $(TOP)/mk/linux_gcc.mk 21 | -------------------------------------------------------------------------------- /mk/platform/gnu_x86_64.mk: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-2.0 OR Solarflare-Binary 2 | # X-SPDX-Copyright-Text: (c) Solarflare Communications Inc 3 | GNU := 1 4 | ifndef MMAKE_CTUNE 5 | # Not all gcc's support -mtune=native, so we do a dummy invocation with that 6 | # argument and only use the argument if the gcc invocation doesn't fail. 7 | # Note that gcc takes empty STDIN, is told it is C (with -x c) and will create an output executable! 8 | # Then use cond && a || b in order to set MMAKE_CTUNE := "-mtune=native" if the test compile worked 9 | MMAKE_CTUNE := $(shell $(CC) -x c -c -mtune=native - -o /dev/null /dev/null 2>&1 && echo "-mtune=native" || echo "") 10 | endif 11 | MMAKE_CARCH := -m64 $(MMAKE_CTUNE) 12 | 13 | MMAKE_RELOCATABLE_LIB := -z combreloc 14 | 15 | include $(TOP)/mk/linux_gcc.mk 16 | -------------------------------------------------------------------------------- /mk/platform/linux.mk: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-2.0 OR Solarflare-Binary 2 | # X-SPDX-Copyright-Text: (c) Solarflare Communications Inc 3 | ifndef KPATH 4 | $(shell echo >&2 "KPATH is not set.") 5 | $(error KPATH is not set.) 6 | endif 7 | 8 | LINUX := 1 9 | 10 | LINUX_VERSION_3 := $(shell cat $(KPATH)/include/{linux/utsrelease.h,generated/utsrelease.h,linux/version.h} 2>/dev/null | sed 's/^\#define UTS_RELEASE \"\([0-9]\+\.[0-9]\+\.[0-9]\+\).*/\1/; t; d') 11 | 12 | DRIVER := 1 13 | MMAKE_USE_KBUILD := 1 14 | MMAKE_NO_RULES := 1 15 | 16 | # Itanium on linux2.6 is very strict that for a given library/module, 17 | # all objects must be compiled with the same flags. For some reason 18 | # the linux kbuild environment doesn't satisfy this condition 19 | include $(KPATH)/.config 20 | ifdef CONFIG_IA64 21 | CFLAGS_KERNEL := 22 | endif 23 | 24 | ifdef CONFIG_ARM64 25 | EXTRA_CFLAGS += -mcmodel=large 26 | endif 27 | 28 | # To build without -g set CONFIG_DEBUG_INFO to empty string 29 | # (-g does make kernel modules quite big, but only on disk). 30 | ifdef NO_DEBUG_INFO 31 | MMAKE_KBUILD_ARGS_DBG := CONFIG_DEBUG_INFO= 32 | endif 33 | 34 | # Setting KBUILD_VERBOSE=1 is quite useful here 35 | MMAKE_KBUILD_ARGS_CONST := -C $(KPATH) NDEBUG=$(NDEBUG) GCOV=$(GCOV) CC=$(CC) 36 | MMAKE_KBUILD_ARGS = $(MMAKE_KBUILD_ARGS_CONST) $(MMAKE_KBUILD_ARGS_DBG) 37 | 38 | -------------------------------------------------------------------------------- /mk/platform/linux_uio_utils.mk: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-2.0 OR Solarflare-Binary 2 | # X-SPDX-Copyright-Text: (c) Solarflare Communications Inc 3 | LINUX_UIO_UTILS := 1 4 | -------------------------------------------------------------------------------- /mk/site/ciapp.mk: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-2.0 OR Solarflare-Binary 2 | # X-SPDX-Copyright-Text: (c) Solarflare Communications Inc 3 | 4 | lib_ver := 1 5 | lib_name := ciapp 6 | lib_where := lib/ciapp 7 | CIAPP_LIB := $(MMakeGenerateLibTarget) 8 | CIAPP_LIB_DEPEND := $(MMakeGenerateLibDepend) 9 | LINK_CIAPP_LIB := $(MMakeGenerateLibLink) 10 | 11 | -------------------------------------------------------------------------------- /mk/site/ciip.mk: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-2.0 OR Solarflare-Binary 2 | # X-SPDX-Copyright-Text: (c) Solarflare Communications Inc 3 | lib_ver := 0 4 | lib_name := ciip 5 | lib_where := lib/transport/ip 6 | CIIP_LIB := $(MMakeGenerateLibTarget) 7 | CIIP_LIB_DEPEND := $(MMakeGenerateLibDepend) 8 | LINK_CIIP_LIB := $(MMakeGenerateLibLink) 9 | 10 | -------------------------------------------------------------------------------- /mk/site/ciiscsi.mk: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-2.0 OR Solarflare-Binary 2 | # X-SPDX-Copyright-Text: (c) Solarflare Communications Inc 3 | lib_ver := 1 4 | lib_name := ciiscsi 5 | lib_where := lib/iscsi 6 | CIISCSI_LIB := $(MMakeGenerateLibTarget) 7 | CIISCSI_LIB_DEPEND := $(MMakeGenerateLibDepend) 8 | LINK_CIISCSI_LIB := $(MMakeGenerateLibLink) 9 | 10 | -------------------------------------------------------------------------------- /mk/site/citools.mk: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-2.0 OR Solarflare-Binary 2 | # X-SPDX-Copyright-Text: (c) Solarflare Communications Inc 3 | 4 | lib_ver := 1 5 | 6 | ifeq ($(DRIVER),1) 7 | lib_name := citools-drv 8 | else 9 | lib_name := citools 10 | endif 11 | 12 | lib_where := lib/citools 13 | CITOOLS_LIB := $(MMakeGenerateLibTarget) 14 | CITOOLS_LIB_DEPEND := $(MMakeGenerateLibDepend) 15 | LINK_CITOOLS_LIB := $(MMakeGenerateLibLink) 16 | ifeq ($(SOLARIS),1) 17 | # libkstat for libcitool get_cpu_khz 18 | LINK_CITOOLS_LIB += -lkstat 19 | endif 20 | -------------------------------------------------------------------------------- /mk/site/citpcommon.mk: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-2.0 OR Solarflare-Binary 2 | # X-SPDX-Copyright-Text: (c) Solarflare Communications Inc 3 | lib_ver := 0 4 | lib_name := citpcommon 5 | lib_where := lib/transport/common 6 | CITPCOMMON_LIB := $(MMakeGenerateLibTarget) 7 | CITPCOMMON_LIB_DEPEND := $(MMakeGenerateLibDepend) 8 | LINK_CITPCOMMON_LIB := $(MMakeGenerateLibLink) 9 | -------------------------------------------------------------------------------- /mk/site/ciul.mk: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-2.0 OR Solarflare-Binary 2 | # X-SPDX-Copyright-Text: (c) Solarflare Communications Inc 3 | # The libciul static library. 4 | lib_ver := 1 5 | ifeq ($(DRIVER),1) 6 | lib_name := ciul-drv 7 | else 8 | lib_name := ciul 9 | endif 10 | lib_where := lib/ciul 11 | CIUL_LIB := $(MMakeGenerateLibTarget) 12 | CIUL_LIB_DEPEND := $(MMakeGenerateLibDepend) 13 | LINK_CIUL_LIB := $(MMakeGenerateLibLink) 14 | 15 | # The libciul dynamic library. 16 | # 17 | # As things stand, it is very difficult to make libciul compatible between 18 | # releases, because the internals of the data structures are exposed. That 19 | # means that almost any non-trivial change to ef_vi should cause the MAJOR 20 | # version number to be incremented. 21 | lib_maj := 1 22 | lib_min := 1 23 | lib_mic := 1 24 | CIUL_REALNAME := $(MMakeGenerateDllRealname) 25 | CIUL_SONAME := $(MMakeGenerateDllSoname) 26 | CIUL_LINKNAME := $(MMakeGenerateDllLinkname) 27 | LINK_CIUL_DLIB := $(MMakeGenerateDllLink) 28 | 29 | lib_name := efvi 30 | lib_where := lib/efvi 31 | EFVI_LIB := $(MMakeGenerateLibTarget) 32 | EFVI_LIB_DEPEND := $(MMakeGenerateLibDepend) 33 | LINK_EFVI_LIB := $(MMakeGenerateLibLink) 34 | -------------------------------------------------------------------------------- /mk/site/cplane.mk: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-2.0 OR Solarflare-Binary 2 | # X-SPDX-Copyright-Text: (c) Solarflare Communications Inc 3 | lib_ver := 0 4 | lib_name := cplane 5 | lib_where := lib/cplane 6 | CPLANE_LIB := $(MMakeGenerateLibTarget) 7 | CPLANE_LIB_DEPEND := $(MMakeGenerateLibDepend) 8 | LINK_CPLANE_LIB := $(MMakeGenerateLibLink) 9 | -------------------------------------------------------------------------------- /mk/site/efhw.mk: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-2.0 OR Solarflare-Binary 2 | # X-SPDX-Copyright-Text: (c) Solarflare Communications Inc 3 | lib_ver := 1 4 | lib_name := efhw 5 | lib_where := lib/efhw 6 | EFHW_LIB := $(MMakeGenerateLibTarget) 7 | EFHW_LIB_DEPEND := $(MMakeGenerateLibDepend) 8 | LINK_EFHW_LIB := $(MMakeGenerateLibLink) 9 | -------------------------------------------------------------------------------- /mk/site/efrm.mk: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-2.0 OR Solarflare-Binary 2 | # X-SPDX-Copyright-Text: (c) Solarflare Communications Inc 3 | lib_ver := 1 4 | lib_name := efrm 5 | lib_where := lib/efrm 6 | EFRM_LIB := $(MMakeGenerateLibTarget) 7 | EFRM_LIB_DEPEND := $(MMakeGenerateLibDepend) 8 | LINK_EFRM_LIB := $(MMakeGenerateLibLink) 9 | -------------------------------------------------------------------------------- /mk/site/efthrm.mk: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-2.0 OR Solarflare-Binary 2 | # X-SPDX-Copyright-Text: (c) Solarflare Communications Inc 3 | lib_ver := 1 4 | lib_name := efthrm 5 | lib_where := lib/efthrm 6 | EFTHRM_LIB := $(MMakeGenerateLibTarget) 7 | EFTHRM_LIB_DEPEND := $(MMakeGenerateLibDepend) 8 | LINK_EFTHRM_LIB := $(MMakeGenerateLibLink) 9 | -------------------------------------------------------------------------------- /mk/site/mmake.mk: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-2.0 OR Solarflare-Binary 2 | # X-SPDX-Copyright-Text: (c) Solarflare Communications Inc 3 | include $(BUILD)/config.mk 4 | ifeq ($(DESTFLAG),1) 5 | include $(DESTPATH)/options_config.mk 6 | else 7 | include $(BUILD)/options_config.mk 8 | endif 9 | include $(TOP)/mk/before.mk 10 | include $(TOP)/mk/platform/$(PLATFORM).mk 11 | ifneq ($(MMAKEBUILDTREE),1) 12 | include $(TOP)/mk/site/citools.mk 13 | include $(TOP)/mk/site/ciapp.mk 14 | include $(TOP)/mk/site/ciul.mk 15 | include $(TOP)/mk/site/ciip.mk 16 | include $(TOP)/mk/site/cplane.mk 17 | include $(TOP)/mk/site/citpcommon.mk 18 | include $(TOP)/mk/site/efrm.mk 19 | include $(TOP)/mk/site/efthrm.mk 20 | include $(TOP)/mk/site/libs.mk 21 | include $(TOP)/mk/site/sfgpxe.mk 22 | include $(TOP)/mk/site/efhw.mk 23 | endif 24 | include $(TOP)/mk/middle.mk 25 | -------------------------------------------------------------------------------- /mk/site/mpi.mk: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-2.0 OR Solarflare-Binary 2 | # X-SPDX-Copyright-Text: (c) Solarflare Communications Inc 3 | 4 | CC := mpicc 5 | CFLAGS := -Wall -g $(INCLUDES) 6 | CXX := mpiCC 7 | CXXFLAGS:= $(CFLAGS) 8 | LIBS := $(addprefix -L,$(dir $(LIBS))) $(addprefix -l,$(notdir $(basename $(LIBS)))) 9 | 10 | %: %.c 11 | $(CC) $(CFLAGS) $(CPPFLAGS) $^ $(LIBS) -o $@ 12 | 13 | -------------------------------------------------------------------------------- /mk/site/sfgpxe.mk: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-2.0 OR Solarflare-Binary 2 | # X-SPDX-Copyright-Text: (c) Solarflare Communications Inc 3 | lib_ver := 1 4 | lib_name := sfgpxe 5 | lib_where := lib/sfgpxe 6 | 7 | SFGPXE_LIB := $(MMakeGenerateLibTarget) 8 | SFGPXE_LIB_DEPEND := $(MMakeGenerateLibDepend) 9 | LINK_SFGPXE_LIB := $(MMakeGenerateLibLink) 10 | 11 | -------------------------------------------------------------------------------- /prebuilt/gnu_aarch64/tools/cplane/debug/onload_cp_server: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/majek/openonload/aff60a36ed3543446d9ff179905f47c47d1e300b/prebuilt/gnu_aarch64/tools/cplane/debug/onload_cp_server -------------------------------------------------------------------------------- /prebuilt/gnu_aarch64/tools/cplane/onload_cp_server: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/majek/openonload/aff60a36ed3543446d9ff179905f47c47d1e300b/prebuilt/gnu_aarch64/tools/cplane/onload_cp_server -------------------------------------------------------------------------------- /prebuilt/gnu_aarch64/tools/onload_mibdump/debug/onload_mibdump: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/majek/openonload/aff60a36ed3543446d9ff179905f47c47d1e300b/prebuilt/gnu_aarch64/tools/onload_mibdump/debug/onload_mibdump -------------------------------------------------------------------------------- /prebuilt/gnu_aarch64/tools/onload_mibdump/onload_mibdump: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/majek/openonload/aff60a36ed3543446d9ff179905f47c47d1e300b/prebuilt/gnu_aarch64/tools/onload_mibdump/onload_mibdump -------------------------------------------------------------------------------- /prebuilt/gnu_x86_64/lib/zf/debug/libonload_zf.so: -------------------------------------------------------------------------------- 1 | libonload_zf.so.1.1.1 -------------------------------------------------------------------------------- /prebuilt/gnu_x86_64/lib/zf/debug/libonload_zf.so.1: -------------------------------------------------------------------------------- 1 | libonload_zf.so.1.1.1 -------------------------------------------------------------------------------- /prebuilt/gnu_x86_64/lib/zf/debug/libonload_zf.so.1.1.1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/majek/openonload/aff60a36ed3543446d9ff179905f47c47d1e300b/prebuilt/gnu_x86_64/lib/zf/debug/libonload_zf.so.1.1.1 -------------------------------------------------------------------------------- /prebuilt/gnu_x86_64/lib/zf/debug/libonload_zf_static.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/majek/openonload/aff60a36ed3543446d9ff179905f47c47d1e300b/prebuilt/gnu_x86_64/lib/zf/debug/libonload_zf_static.a -------------------------------------------------------------------------------- /prebuilt/gnu_x86_64/lib/zf/libonload_zf.so: -------------------------------------------------------------------------------- 1 | libonload_zf.so.1.1.1 -------------------------------------------------------------------------------- /prebuilt/gnu_x86_64/lib/zf/libonload_zf.so.1: -------------------------------------------------------------------------------- 1 | libonload_zf.so.1.1.1 -------------------------------------------------------------------------------- /prebuilt/gnu_x86_64/lib/zf/libonload_zf.so.1.1.1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/majek/openonload/aff60a36ed3543446d9ff179905f47c47d1e300b/prebuilt/gnu_x86_64/lib/zf/libonload_zf.so.1.1.1 -------------------------------------------------------------------------------- /prebuilt/gnu_x86_64/lib/zf/libonload_zf_static.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/majek/openonload/aff60a36ed3543446d9ff179905f47c47d1e300b/prebuilt/gnu_x86_64/lib/zf/libonload_zf_static.a -------------------------------------------------------------------------------- /prebuilt/gnu_x86_64/tools/cplane/debug/onload_cp_server: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/majek/openonload/aff60a36ed3543446d9ff179905f47c47d1e300b/prebuilt/gnu_x86_64/tools/cplane/debug/onload_cp_server -------------------------------------------------------------------------------- /prebuilt/gnu_x86_64/tools/cplane/onload_cp_server: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/majek/openonload/aff60a36ed3543446d9ff179905f47c47d1e300b/prebuilt/gnu_x86_64/tools/cplane/onload_cp_server -------------------------------------------------------------------------------- /prebuilt/gnu_x86_64/tools/onload_mibdump/debug/onload_mibdump: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/majek/openonload/aff60a36ed3543446d9ff179905f47c47d1e300b/prebuilt/gnu_x86_64/tools/onload_mibdump/debug/onload_mibdump -------------------------------------------------------------------------------- /prebuilt/gnu_x86_64/tools/onload_mibdump/onload_mibdump: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/majek/openonload/aff60a36ed3543446d9ff179905f47c47d1e300b/prebuilt/gnu_x86_64/tools/onload_mibdump/onload_mibdump -------------------------------------------------------------------------------- /prebuilt/gnu_x86_64/tools/zf/debug/zf_stackdump: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/majek/openonload/aff60a36ed3543446d9ff179905f47c47d1e300b/prebuilt/gnu_x86_64/tools/zf/debug/zf_stackdump -------------------------------------------------------------------------------- /prebuilt/gnu_x86_64/tools/zf/zf_stackdump: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/majek/openonload/aff60a36ed3543446d9ff179905f47c47d1e300b/prebuilt/gnu_x86_64/tools/zf/zf_stackdump -------------------------------------------------------------------------------- /prebuilt/prebuilt_config_aarch64: -------------------------------------------------------------------------------- 1 | Linux qc2400c 4.13.0-46-generic #51-Ubuntu SMP Tue Jun 12 12:39:10 UTC 2018 aarch64 aarch64 aarch64 GNU/Linux 2 | Ubuntu 17.10 \n \l 3 | 4 | gcc (Ubuntu/Linaro 7.2.0-8ubuntu3.2) 7.2.0 5 | Copyright (C) 2017 Free Software Foundation, Inc. 6 | This is free software; see the source for copying conditions. There is NO 7 | warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 8 | 9 | Linux qc2400c 4.13.0-46-generic #51-Ubuntu SMP Tue Jun 12 12:39:10 UTC 2018 aarch64 aarch64 aarch64 GNU/Linux 10 | Ubuntu 17.10 \n \l 11 | 12 | gcc (Ubuntu/Linaro 7.2.0-8ubuntu3.2) 7.2.0 13 | Copyright (C) 2017 Free Software Foundation, Inc. 14 | This is free software; see the source for copying conditions. There is NO 15 | warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 16 | 17 | -------------------------------------------------------------------------------- /prebuilt/prebuilt_config_i686: -------------------------------------------------------------------------------- 1 | Linux dellr210s.uk.solarflarecom.com 3.10.0-693.el7.x86_64 #1 SMP Thu Jul 6 19:56:57 EDT 2017 x86_64 x86_64 x86_64 GNU/Linux 2 | \S 3 | Kernel \r on an \m 4 | 5 | gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-16) 6 | Copyright (C) 2015 Free Software Foundation, Inc. 7 | This is free software; see the source for copying conditions. There is NO 8 | warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 9 | 10 | Linux dellr210s.uk.solarflarecom.com 3.10.0-693.el7.x86_64 #1 SMP Thu Jul 6 19:56:57 EDT 2017 x86_64 x86_64 x86_64 GNU/Linux 11 | \S 12 | Kernel \r on an \m 13 | 14 | gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-16) 15 | Copyright (C) 2015 Free Software Foundation, Inc. 16 | This is free software; see the source for copying conditions. There is NO 17 | warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 18 | 19 | -------------------------------------------------------------------------------- /prebuilt/prebuilt_config_x86_64: -------------------------------------------------------------------------------- 1 | Linux dellr210s.uk.solarflarecom.com 3.10.0-693.el7.x86_64 #1 SMP Thu Jul 6 19:56:57 EDT 2017 x86_64 x86_64 x86_64 GNU/Linux 2 | \S 3 | Kernel \r on an \m 4 | 5 | gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-16) 6 | Copyright (C) 2015 Free Software Foundation, Inc. 7 | This is free software; see the source for copying conditions. There is NO 8 | warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 9 | 10 | cc (GCC) 7.3.1 20180303 (Red Hat 7.3.1-5) 11 | Copyright (C) 2017 Free Software Foundation, Inc. 12 | This is free software; see the source for copying conditions. There is NO 13 | warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 14 | 15 | Linux dellr210s.uk.solarflarecom.com 3.10.0-693.el7.x86_64 #1 SMP Thu Jul 6 19:56:57 EDT 2017 x86_64 x86_64 x86_64 GNU/Linux 16 | \S 17 | Kernel \r on an \m 18 | 19 | gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-16) 20 | Copyright (C) 2015 Free Software Foundation, Inc. 21 | This is free software; see the source for copying conditions. There is NO 22 | warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 23 | 24 | cc (GCC) 7.3.1 20180303 (Red Hat 7.3.1-5) 25 | Copyright (C) 2017 Free Software Foundation, Inc. 26 | This is free software; see the source for copying conditions. There is NO 27 | warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 28 | 29 | -------------------------------------------------------------------------------- /scripts/check_header_presence: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # SPDX-License-Identifier: GPL-2.0 3 | # X-SPDX-Copyright-Text: (c) Solarflare Communications Inc 4 | 5 | # Check whether the header exists. 6 | 7 | header=$1 8 | 9 | dir=$(mktemp -d) 10 | 11 | cat >$dir/checkheaderpresence.c < 13 | int main(int argc, char ** argv) {return 0;} 14 | EOF 15 | if $CC $CFLAGS -Werror -c $dir/checkheaderpresence.c -o $dir/checkheaderpresence.o &>/dev/null ; then 16 | echo 1 17 | else 18 | echo 0 19 | fi 20 | 21 | rm -rf $dir 22 | -------------------------------------------------------------------------------- /scripts/check_library_presence: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # SPDX-License-Identifier: GPL-2.0 3 | # X-SPDX-Copyright-Text: (c) Solarflare Communications Inc 4 | 5 | # Check if header+library are available. 6 | header=$1 7 | lib=$2 8 | dir=$(mktemp -d) 9 | 10 | cat >$dir/checklib.c </dev/null; then 15 | echo 1 16 | else 17 | echo "Failed to find lib$lib with header $header" >&2 18 | echo 0 19 | fi 20 | 21 | rm -rf $dir 22 | -------------------------------------------------------------------------------- /scripts/check_prototype: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # SPDX-License-Identifier: GPL-2.0 3 | # X-SPDX-Copyright-Text: (c) Solarflare Communications Inc 4 | 5 | #Check whether symbol in header matches given prototype 6 | # 7 | #Check is done with _GNU_SOURCE defined. 8 | #Symbol prototype should be definition of function pointer of name foo. 9 | 10 | headers=$1 11 | symbol=$2 12 | prototype=$3 13 | 14 | dir=$(mktemp -d) 15 | 16 | cat >$dir/checkprototype.c </dev/null ; then 26 | echo 1 27 | else 28 | echo 0 29 | fi 30 | 31 | rm -rf $dir 32 | -------------------------------------------------------------------------------- /scripts/mmake: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # SPDX-License-Identifier: GPL-2.0 3 | # X-SPDX-Copyright-Text: (c) Solarflare Communications Inc 4 | 5 | # A 'make' wrapper 6 | 7 | . "$(dirname "$0")/sh/fns" 8 | . "$bin/sh/mmake-fns" 9 | 10 | ###################################################################### 11 | # main() 12 | 13 | # Put this mmake (and associated scripts) at front of PATH. 14 | export PATH="$bin:$PATH" 15 | 16 | 17 | # Parse args. 18 | # ?? Fixme: add usage, verbose option... 19 | args= 20 | while [ $# -gt 0 ]; do 21 | case "$1" in 22 | -C) shift 23 | [ -d "$1" ] || 24 | { mkdir -p "$1" || fail "Failed to: mkdir -p '$1'"; } 25 | cd "$1" || fail "Failed to: cd '$1'" 26 | ;; 27 | *) args="$args $1" 28 | ;; 29 | esac 30 | shift 31 | done 32 | 33 | # Use gnumake if it exists, otherwise make. 34 | [ -z "$MMAKE_MAKE" ] && { 35 | MMAKE_MAKE=gmake 36 | which "$MMAKE_MAKE" &>/dev/null || MMAKE_MAKE=make 37 | which "$MMAKE_MAKE" &>/dev/null || 38 | fail "Cannot find a make command. Please define MMAKE_MAKE." 39 | } 40 | 41 | # Setup make variables. 42 | orient-in-build-tree || fail "Not in a mmake build tree" 43 | 44 | [ -f "$TOP/mk/platform/$PLATFORM.mk" ] || fail "No such platform '$PLATFORM' $PWD/$TOP/mk/platform/" 45 | 46 | "$MMAKE_MAKE" -r -f "$TOP/mk/site/mmake.mk" "MAKE=mmake" "TOP=$TOP" \ 47 | "TOPPATH=$TOPPATH" \ 48 | "BUILD=$BUILD" "BUILDPATH=$BUILDPATH" "CURRENT=$CURRENT" \ 49 | "PLATFORM=$PLATFORM" "THISDIR=$THISDIR" "VPATH=$VPATH" $args 50 | 51 | -------------------------------------------------------------------------------- /scripts/onload_apps/sfnt-pingpong: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: BSD-2-Clause 2 | # X-SPDX-Copyright-Text: (c) Solarflare Communications Inc 3 | onload_import latency-best 4 | -------------------------------------------------------------------------------- /scripts/onload_apps/sfnt-stream: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: BSD-2-Clause 2 | # X-SPDX-Copyright-Text: (c) Solarflare Communications Inc 3 | onload_import latency-best 4 | onload_set EF_STACK_PER_THREAD 1 5 | -------------------------------------------------------------------------------- /scripts/onload_misc/onload-extract-notes: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # SPDX-License-Identifier: GPL-2.0 3 | # X-SPDX-Copyright-Text: (c) Solarflare Communications Inc 4 | ###################################################################### 5 | 6 | me=$(basename "$0") 7 | err() { echo >&2 "$*"; } 8 | log() { err "$me: $*"; } 9 | fail() { log "FAILED: $*"; exit 1; } 10 | try() { "$@" || fail "$*"; } 11 | 12 | ###################################################################### 13 | # main() 14 | 15 | tgz="$1" 16 | try [ -f "$tgz" ] 17 | dir=${tgz%.tgz} 18 | try tar xf "$tgz" 19 | try [ -d "$dir" ] 20 | try mv "$dir/ChangeLog" "$dir-ChangeLog.txt" 21 | try mv "$dir/ReleaseNotes" "$dir-ReleaseNotes.txt" 22 | try mv "$dir/README" "$dir-README.txt" 23 | try rm -r "$dir" 24 | -------------------------------------------------------------------------------- /scripts/onload_misc/onload_depmod.conf: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-2.0 2 | # X-SPDX-Copyright-Text: (c) Solarflare Communications Inc 3 | # Ensure that drivers provided by Onload install override any that came 4 | # with the kernel. 5 | override sfc * weak-updates 6 | override sfc * extra 7 | -------------------------------------------------------------------------------- /scripts/onload_misc/onload_modprobe.conf: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-2.0 2 | # X-SPDX-Copyright-Text: (c) Solarflare Communications Inc 3 | 4 | # This file is part of OpenOnload(tm). 5 | # 6 | # We recommend you do not edit this file. To add custom module options 7 | # create a new file in /etc/modprobe.d/. 8 | # 9 | install onload /sbin/modprobe --ignore-install onload $CMDLINE_OPTS \ 10 | $(/sbin/onload_tool mod_params onload) && \ 11 | /sbin/onload_tool post_install 12 | 13 | install sfc /sbin/modprobe --ignore-install sfc $CMDLINE_OPTS && \ 14 | if [ -e /lib/modules/$(uname -r)/extra/sfc_aoe.ko ]; then \ 15 | /sbin/modprobe sfc_aoe; \ 16 | fi 17 | -------------------------------------------------------------------------------- /scripts/onload_misc/onload_modules-load.d.conf: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-2.0 2 | # X-SPDX-Copyright-Text: (c) Solarflare Communications Inc 3 | 4 | # Load onload.ko at boot 5 | onload 6 | -------------------------------------------------------------------------------- /scripts/onload_misc/setup.py: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-2.0 2 | # X-SPDX-Copyright-Text: (c) Solarflare Communications Inc 3 | from distutils.core import setup 4 | setup(name='OpenOnload utilities', 5 | version='1.0', 6 | author='David Riddoch', 7 | author_email='driddoch@solarflare.com', 8 | url='http://www.openonload.org/', 9 | py_modules=['sfcmask', 'sfcaffinity'], 10 | ) 11 | -------------------------------------------------------------------------------- /scripts/onload_misc/sysconfig_onload_modules: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # SPDX-License-Identifier: GPL-2.0 3 | # X-SPDX-Copyright-Text: (c) Solarflare Communications Inc 4 | /sbin/modprobe onload 5 | -------------------------------------------------------------------------------- /scripts/onload_profiles/cloud.opf: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: BSD-2-Clause 2 | # X-SPDX-Copyright-Text: (c) Solarflare Communications Inc 3 | 4 | # Cloud Onload approximation profile for OpenOnload 5 | # 6 | # This profile configures OpenOnload to behave like Cloud Onload for 7 | # features that are currently activated. 8 | 9 | # Enable event merging, which is always on in Cloud Onload 10 | 11 | onload_set EF_HIGH_THROUGHPUT_MODE 1 12 | 13 | # Disable CTPIO and PIO transfers. Cloud Onload uses DMA for all 14 | # transfers. 15 | 16 | onload_set EF_CTPIO 0 17 | onload_set EF_PIO 0 18 | 19 | # UDP acceleration is not available in Cloud Onload. All UDP 20 | # traffic will be transparently handed over to the kernel 21 | 22 | onload_set EF_UDP 0 23 | -------------------------------------------------------------------------------- /scripts/onload_profiles/haproxy-balanced.opf: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: BSD-2-Clause 2 | # X-SPDX-Copyright-Text: (c) Solarflare Communications Inc 3 | 4 | # pass "$@" so application command line can be parsed by haproxy-parse-config 5 | onload_import haproxy-parse-config "$@" 6 | 7 | # HAProxy uses pipes in a manner incompatible with Onload, so disable pipe acceleration 8 | onload_set EF_PIPE 0 9 | 10 | # Assert application use of epoll is multithread safe. 11 | onload_set EF_EPOLL_MT_SAFE 1 12 | 13 | onload_import proxy-throughput 14 | -------------------------------------------------------------------------------- /scripts/onload_profiles/haproxy-performance.opf: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: BSD-2-Clause 2 | # X-SPDX-Copyright-Text: (c) Solarflare Communications Inc 3 | 4 | # pass "$@" so application command line can be parsed by haproxy-parse-config 5 | onload_import haproxy-parse-config "$@" 6 | 7 | # Immediate push on TX to reduce send latency 8 | onload_set EF_TX_PUSH 1 9 | 10 | # Disable sleep spin 11 | onload_set EF_SLEEP_SPIN_USEC 0 12 | 13 | # HAProxy uses pipes in a manner incompatible with Onload, so disable pipe acceleration 14 | onload_set EF_PIPE 0 15 | 16 | # Assert application use of epoll is multithread safe. 17 | onload_set EF_EPOLL_MT_SAFE 1 18 | 19 | onload_import proxy-throughput 20 | -------------------------------------------------------------------------------- /scripts/onload_profiles/latency.opf: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: BSD-2-Clause 2 | # X-SPDX-Copyright-Text: (c) Solarflare Communications Inc 3 | 4 | # OpenOnload low latency profile. 5 | 6 | # Enable polling / spinning. When the application makes a blocking call 7 | # such as recv() or poll(), this causes Onload to busy wait for up to 100ms 8 | # before blocking. 9 | # 10 | onload_set EF_POLL_USEC 100000 11 | 12 | # Disable FASTSTART when connection is new or has been idle for a while. 13 | # The additional acks it causes add latency on the receive path. 14 | onload_set EF_TCP_FASTSTART_INIT 0 15 | onload_set EF_TCP_FASTSTART_IDLE 0 16 | 17 | # Use a large initial congestion window so that the slow-start algorithm 18 | # doesn't cause delays. We don't enable this by default because it breaks 19 | # the TCP specs, and could cause congestion in your network. Uncomment if 20 | # you think you need this. 21 | # 22 | ##onload_set EF_TCP_INITIAL_CWND 100000 23 | 24 | # When TCP_NODELAY is used, always kick packets out immediately. This is 25 | # not enabled by default because most apps benefit from the default 26 | # behaviour. 27 | # 28 | ##onload_set EF_NONAGLE_INFLIGHT_MAX 65535 29 | -------------------------------------------------------------------------------- /scripts/onload_profiles/nettyio-balanced.opf: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: BSD-2-Clause 2 | # X-SPDX-Copyright-Text: (c) Solarflare Communications Inc 3 | 4 | # netty.io balanced profile 5 | 6 | # Enable small amount of polling / spinning. When the application makes a 7 | # blocking call such as poll() or epoll_wait(), this causes Onload to busy wait 8 | # for up to 20us before blocking. 9 | # 10 | onload_set EF_INT_DRIVEN 0 11 | onload_set EF_POLL_USEC 20 12 | 13 | # Prevent spinning inside socket calls. (Spinning will take place 14 | # on epoll_wait polling). 15 | onload_set EF_PKT_WAIT_SPIN 0 16 | onload_set EF_TCP_RECV_SPIN 0 17 | onload_set EF_TCP_SEND_SPIN 0 18 | onload_set EF_TCP_CONNECT_SPIN 0 19 | onload_set EF_TCP_ACCEPT_SPIN 0 20 | onload_set EF_UDP_RECV_SPIN 0 21 | onload_set EF_UDP_SEND_SPIN 0 22 | 23 | 24 | # Use EPOLL mode 3 as will provide the best scalability and speed 25 | onload_set EF_UL_EPOLL 3 26 | 27 | # EPOLL can be multithread safe, as netty poll architecture is single threaded 28 | onload_set EF_EPOLL_MT_SAFE 1 29 | 30 | onload_set EF_RXQ_SIZE 4096 31 | onload_set EF_CLUSTER_IGNORE 1 32 | 33 | # enable receive packet event batching, this adds a small latency 34 | # cost, but improves transaction rate/efficiency 35 | onload_set EF_HIGH_THROUGHPUT_MODE 1 36 | 37 | # disable CTPIO and PIO as these reduce CPU efficiency and don't 38 | # for this class of application, bring major benefits. 39 | onload_set EF_CTPIO 0 40 | onload_set EF_PIO 0 41 | -------------------------------------------------------------------------------- /scripts/onload_profiles/nettyio-performance.opf: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: BSD-2-Clause 2 | # X-SPDX-Copyright-Text: (c) Solarflare Communications Inc 3 | 4 | # netty.io performance profile 5 | 6 | # Enable polling / spinning. When the application makes a blocking call 7 | # such as recv() or poll(), this causes Onload to busy wait for up to 100ms 8 | # before blocking. 9 | # 10 | onload_set EF_POLL_USEC 100000 11 | 12 | # Use EPOLL mode 3 as will provide the best scalability and speed 13 | onload_set EF_UL_EPOLL 3 14 | 15 | # EPOLL can be multithread safe, as redis poll architecture is single threaded 16 | onload_set EF_EPOLL_MT_SAFE 1 17 | 18 | onload_set EF_RXQ_SIZE 4096 19 | onload_set EF_CLUSTER_IGNORE 1 20 | 21 | # enable receive packet event batching, this adds a small latency 22 | # cost, but improves transaction rate/efficiency 23 | onload_set EF_HIGH_THROUGHPUT_MODE 1 24 | 25 | # disable CTPIO and PIO as these reduce CPU efficiency and don't 26 | # for this class of application, bring major benefits. If 27 | # absolutely best latency is needed, then consider enabling them. 28 | onload_set EF_CTPIO 0 29 | onload_set EF_PIO 0 30 | -------------------------------------------------------------------------------- /scripts/onload_profiles/nginx-like-st.opf: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: BSD-2-Clause 2 | # X-SPDX-Copyright-Text: (c) Solarflare Communications Inc 3 | 4 | # nginx-like settings to use with non-nginx applications and tests. 5 | 6 | onload_import throughput_base 7 | onload_import wan-traffic 8 | 9 | -------------------------------------------------------------------------------- /scripts/onload_profiles/nginx-proxy-balanced.opf: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: BSD-2-Clause 2 | # X-SPDX-Copyright-Text: (c) Solarflare Communications Inc 3 | 4 | # pass "$@" so application command line can be parsed by nginx-parse-config 5 | onload_import nginx-parse-config "$@" 6 | onload_import proxy-throughput 7 | 8 | # Assert application use of epoll is multithread safe. 9 | onload_set EF_EPOLL_MT_SAFE 1 10 | 11 | # pass "$@" so application command line can be parsed by wait-old-cluster-exit 12 | onload_import wait-old-cluster-exit "$@" 13 | -------------------------------------------------------------------------------- /scripts/onload_profiles/nginx-proxy-performance.opf: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: BSD-2-Clause 2 | # X-SPDX-Copyright-Text: (c) Solarflare Communications Inc 3 | 4 | # pass "$@" so application command line can be parsed by nginx-parse-config 5 | onload_import nginx-parse-config "$@" 6 | 7 | onload_set EF_TX_PUSH 1 8 | onload_set EF_SLEEP_SPIN_USEC 0 9 | 10 | onload_import proxy-throughput 11 | 12 | # Assert application use of epoll is multithread safe. 13 | onload_set EF_EPOLL_MT_SAFE 1 14 | 15 | # pass "$@" so application command line can be parsed by wait-old-cluster-exit 16 | onload_import wait-old-cluster-exit "$@" 17 | -------------------------------------------------------------------------------- /scripts/onload_profiles/nginx-webserver-balanced.opf: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: BSD-2-Clause 2 | # X-SPDX-Copyright-Text: (c) Solarflare Communications Inc 3 | 4 | # Tuning profile for nginx in webserver configuration with OpenOnload 5 | # acceleration. 6 | 7 | # The balanced profile gives excellent throughput, with low latency. 8 | # It has reduced CPU usage at lower traffic rates. 9 | 10 | # Read nginx config files and set num_workers accordingly. 11 | # Need to pass "$@" so application command line can be parsed by nginx-parse-config 12 | onload_import nginx-parse-config "$@" 13 | 14 | # nginx uses epoll within one process only 15 | onload_set EF_EPOLL_MT_SAFE 1 16 | 17 | # Enable clustering to spread connections over workers. 18 | onload_set EF_CLUSTER_SIZE "$num_workers" 19 | onload_set EF_CLUSTER_NAME webs 20 | onload_set EF_CLUSTER_RESTART 1 21 | onload_set EF_CLUSTER_HOT_RESTART 1 22 | 23 | # Enable spinning and sleep-spin mode. 24 | onload_set EF_POLL_USEC 1000000 25 | onload_set EF_SLEEP_SPIN_USEC 50 26 | 27 | onload_import throughput 28 | onload_import wan-traffic 29 | 30 | # If nginx '-s' option is used, check whether old clusters are still in 31 | # existence and if needed wait for them to exit. 32 | # Pass "$@" so application command line can be parsed 33 | onload_import wait-old-cluster-exit "$@" 34 | -------------------------------------------------------------------------------- /scripts/onload_profiles/nginx-webserver-performance.opf: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: BSD-2-Clause 2 | # X-SPDX-Copyright-Text: (c) Solarflare Communications Inc 3 | 4 | # Tuning profile for nginx in webserver configuration with OpenOnload 5 | # acceleration. 6 | 7 | # The performance profile is latency focused. It constantly polls for network 8 | # events to achieve the lowest latency possible, and so has higher CPU usage. 9 | 10 | # Read nginx config files and set num_workers accordingly. 11 | # Need to pass "$@" so application command line can be parsed by nginx-parse-config 12 | onload_import nginx-parse-config "$@" 13 | 14 | # nginx uses epoll within one process only 15 | onload_set EF_EPOLL_MT_SAFE 1 16 | 17 | # Enable clustering to spread connections over workers. 18 | onload_set EF_CLUSTER_SIZE "$num_workers" 19 | onload_set EF_CLUSTER_NAME webs 20 | onload_set EF_CLUSTER_RESTART 1 21 | onload_set EF_CLUSTER_HOT_RESTART 1 22 | 23 | # Enable spinning 24 | onload_set EF_POLL_USEC 1000000 25 | 26 | onload_import throughput 27 | onload_import wan-traffic 28 | 29 | # If nginx '-s' option is used, check whether old clusters are still in 30 | # existence and if needed wait for them to exit. 31 | # Pass "$@" so application command line can be parsed 32 | onload_import wait-old-cluster-exit "$@" 33 | -------------------------------------------------------------------------------- /scripts/onload_profiles/proxy-throughput.opf-fragment: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: BSD-2-Clause 2 | # X-SPDX-Copyright-Text: (c) Solarflare Communications Inc 3 | 4 | # Enable clustering to spread connections over workers. 5 | # Name will need to be overridden for each cluster if 6 | # wanting to use multiple clusters. 7 | onload_set EF_CLUSTER_SIZE "$num_workers" 8 | onload_set EF_CLUSTER_NAME prox 9 | 10 | # Force termination of orphaned stacks on restart. 11 | onload_set EF_CLUSTER_RESTART 1 12 | 13 | # Allow sharing of stacks in cluster by two processes 14 | # to allow hot/seamless restart. 15 | onload_set EF_CLUSTER_HOT_RESTART 1 16 | 17 | # Enable scalable filters to avoid using a separate filter 18 | # for each connection. A proxy both accepts passive connections 19 | # and makes active connections. 20 | # This will need to be overridden to not use 'any' interface if 21 | # wanting separate clusters on different interfaces. 22 | onload_set EF_SCALABLE_FILTERS "any=rss:active:passive" 23 | 24 | # Scalable filters mode for applications using master/worker 25 | # hierarchy. 26 | onload_set EF_SCALABLE_FILTERS_ENABLE 2 27 | 28 | # Connections not accepted through scalable filters interface 29 | # are refused. 30 | onload_set EF_SCALABLE_LISTEN_MODE 1 31 | 32 | # Allocate plenty of packet memory 33 | # (NB overrides setting in "throughput.opf-fragment") 34 | onload_set EF_MAX_PACKETS $(( (180000*16) / $num_workers )) 35 | 36 | onload_import throughput 37 | onload_import wan-traffic 38 | -------------------------------------------------------------------------------- /scripts/onload_profiles/redis-balanced.opf: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: BSD-2-Clause 2 | # X-SPDX-Copyright-Text: (c) Solarflare Communications Inc 3 | 4 | # redis balanced profile 5 | 6 | # Enable small amount of polling / spinning. When the application makes a 7 | # blocking call to epoll_wait(), this causes Onload to busy wait for up to 20us 8 | # before blocking. 9 | # 10 | onload_set EF_INT_DRIVEN 0 11 | onload_set EF_POLL_USEC 20 12 | 13 | # Prevent spinning inside socket calls. (Spinning will take place 14 | # on epoll_wait polling). 15 | onload_set EF_PKT_WAIT_SPIN 0 16 | onload_set EF_TCP_RECV_SPIN 0 17 | onload_set EF_TCP_SEND_SPIN 0 18 | onload_set EF_TCP_CONNECT_SPIN 0 19 | onload_set EF_TCP_ACCEPT_SPIN 0 20 | onload_set EF_UDP_RECV_SPIN 0 21 | onload_set EF_UDP_SEND_SPIN 0 22 | 23 | 24 | # Use EPOLL mode 2 as this will be compatible with redis process forking and 25 | # can scale to large numbers of sockets 26 | onload_set EF_UL_EPOLL 2 27 | 28 | # EPOLL can be multithread safe, as redis poll architecture is single threaded 29 | onload_set EF_EPOLL_MT_SAFE 1 30 | 31 | onload_set EF_RXQ_SIZE 4096 32 | onload_set EF_CLUSTER_IGNORE 1 33 | 34 | # enable receive packet event batching, this adds a small latency 35 | # cost, but improves transaction rate/efficiency 36 | onload_set EF_HIGH_THROUGHPUT_MODE 1 37 | 38 | # disable CTPIO and PIO as these reduce CPU efficiency and don't 39 | # for this class of application, bring major benefits. 40 | onload_set EF_CTPIO 0 41 | onload_set EF_PIO 0 42 | -------------------------------------------------------------------------------- /scripts/onload_profiles/redis-performance.opf: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: BSD-2-Clause 2 | # X-SPDX-Copyright-Text: (c) Solarflare Communications Inc 3 | 4 | # redis performance profile 5 | 6 | # Enable polling / spinning. When the application makes a blocking call 7 | # such as recv() or poll(), this causes Onload to busy wait for up to 100ms 8 | # before blocking. 9 | # 10 | onload_set EF_POLL_USEC 100000 11 | 12 | # Use EPOLL mode 2 as this will be compatible with redis process forking and 13 | # can scale to large numbers of sockets 14 | onload_set EF_UL_EPOLL 2 15 | 16 | # EPOLL can be multithread safe, as redis poll architecture is single threaded 17 | onload_set EF_EPOLL_MT_SAFE 1 18 | 19 | onload_set EF_RXQ_SIZE 4096 20 | onload_set EF_CLUSTER_IGNORE 1 21 | 22 | # enable receive packet event batching, this adds a small latency 23 | # cost, but improves transaction rate/efficiency 24 | onload_set EF_HIGH_THROUGHPUT_MODE 1 25 | 26 | # disable CTPIO and PIO as these reduce CPU efficiency and don't 27 | # for this class of application, bring major benefits. If 28 | # absolutely best latency is needed, then consider enabling them. 29 | onload_set EF_CTPIO 0 30 | onload_set EF_PIO 0 31 | 32 | -------------------------------------------------------------------------------- /scripts/onload_profiles/throughput_base.opf-fragment: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: BSD-2-Clause 2 | # X-SPDX-Copyright-Text: (c) Solarflare Communications Inc 3 | # 4 | 5 | # Tuning profile for applications favouring high throughput and scale over low 6 | # latency. 7 | # For use within another profile only. 8 | # 9 | 10 | # Disable low-latency sends to minimise CPU overheads. 11 | onload_set EF_TX_PUSH 0 12 | onload_set EF_PIO 0 13 | onload_set EF_CTPIO 0 14 | 15 | # Optimize packet handling for throughput rather than latency. 16 | onload_set EF_HIGH_THROUGHPUT_MODE 1 17 | 18 | -------------------------------------------------------------------------------- /scripts/onload_profiles/wait-old-cluster-exit.opf-fragment: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: BSD-2-Clause 2 | # X-SPDX-Copyright-Text: (c) Solarflare Communications Inc 3 | 4 | # In case of cold restart make sure previous instance (of the same name) has 5 | # ceased to exist 6 | # If references to old onload stacks are still being released - wait. 7 | 8 | if echo "$@" | perl -n -e 'if(/\s-s/) {exit 1}'; then 9 | ITER=0 10 | while true; do 11 | stackdump_contents=$(onload_stackdump --nopids stacks) || break 12 | echo "$stackdump_contents" | grep "\s${EF_CLUSTER_NAME}-c" >/dev/null || \ 13 | break 14 | if [ "$(( ITER % 20 ))" -eq 19 ]; then 15 | echo Onload stacks of name "${EF_CLUSTER_NAME}"-c## still present. >&2 16 | echo Verify that previous instance of application has been killed. >&2 17 | onload_stackdump --nopids stacks >&2 18 | if [ $ITER -gt 50 ]; then 19 | exit 16 20 | fi 21 | fi 22 | ITER="$(( ITER + 1 ))" 23 | sleep 0.2; 24 | done 25 | fi 26 | -------------------------------------------------------------------------------- /scripts/onload_profiles/wan-traffic.opf-fragment: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: BSD-2-Clause 2 | # X-SPDX-Copyright-Text: (c) Solarflare Communications Inc 3 | # 4 | # Tuning profile for environments involving TCP traffic travelling over 5 | # unreliable or high-latency networks, such as the public Internet. 6 | # For use within another profile only. 7 | # 8 | 9 | # Adjustments for potentially-lossy network environment 10 | # Use a minimum congestion window of 10 MSS 11 | onload_set EF_TCP_INITIAL_CWND 14600 12 | 13 | # Set how many unacked segments force ACK. Increasing this 14 | # will reduce network load but could result in peer needing to 15 | # retransmit more data if network is lossy. 16 | onload_set EF_DYNAMIC_ACK_THRESH 4 17 | 18 | # It is recommended to use TCP tail drop probe to retransmit faster. 19 | # By default, Onload uses the setting from /proc/sys/net/ipv4/tcp_early_retrans 20 | # which is typically on by default. 21 | # If needed, tail drop probe can be forced on by uncommenting the line below: 22 | # onload_set EF_TAIL_DROP_PROBE 1 23 | 24 | # Enable dynamically sized TCP receive buffers. 25 | onload_set EF_TCP_RCVBUF_MODE 1 26 | 27 | # Defense against attack on receive buffer 28 | onload_set EF_TCP_RCVBUF_STRICT 1 29 | onload_set EF_ENDPOINT_PACKET_RESERVE 3 30 | -------------------------------------------------------------------------------- /scripts/onload_profiles/zeromq.opf: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: BSD-2-Clause 2 | # X-SPDX-Copyright-Text: (c) Solarflare Communications Inc 3 | 4 | # OpenOnload profile for applications using zeromq. 5 | 6 | # Zeromq uses unix sockets for inter-thread communication, and blocks using 7 | # poll() and epoll(). The following options ensure that the messages 8 | # passed through unix sockets are not delayed. 9 | onload_set EF_POLL_FAST_USEC 0 10 | onload_set EF_POLL_NONBLOCK_FAST_USEC 0 11 | 12 | # We also recommend that you use the latency profile. 13 | -------------------------------------------------------------------------------- /scripts/sfcaffinity: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # SPDX-License-Identifier: BSD-2-Clause 3 | # X-SPDX-Copyright-Text: (c) Solarflare Communications Inc 4 | 5 | # Runs an application with sfcaffinity support. 6 | 7 | me=$(basename "$0") 8 | 9 | err() { echo >&2 "$*"; } 10 | log() { err "$me: $*"; } 11 | vlog() { $verbose && log "$*"; } 12 | fail() { log "$*"; exit 1; } 13 | rawecho() { echo -E "x$*" | sed 's/^x//'; } 14 | 15 | 16 | preload=libsfcaffinity.so 17 | rawecho "$LD_PRELOAD" | grep -q "$(basename "$preload")" || { 18 | if [ -z "$LD_PRELOAD" ]; then 19 | LD_PRELOAD="$preload"; export LD_PRELOAD 20 | else 21 | LD_PRELOAD="$preload:$LD_PRELOAD"; export LD_PRELOAD 22 | fi 23 | } 24 | exec "$@" 25 | exit 26 | -------------------------------------------------------------------------------- /scripts/sh/fns: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-2.0 2 | # X-SPDX-Copyright-Text: (c) Solarflare Communications Inc 3 | 4 | # We use dirname and basename a lot which can be slow on Cygwin, 5 | # and they're simple enough to reimplement with built-ins. 6 | dirname () { 7 | [ "${1%/*}" = "$1" ] && echo . || echo "${1%/*}" 8 | } 9 | basename () { 10 | local name="${1##*/}" 11 | echo "${name%$2}" 12 | } 13 | 14 | p=$(basename "$0") 15 | me=$(basename "$0") 16 | bin=$(cd "$(dirname "$0")" && /bin/pwd) 17 | export PATH="$bin:$PATH" 18 | 19 | err () { echo 1>&2 "$*"; } 20 | log () { err "$p: $*"; } 21 | fail () { log "$*"; exit 1; } 22 | try () { "$@" || fail "'$*' failed"; } 23 | try_quiet () { "$@" 2>&1 > /dev/null || fail "'$*' failed"; } 24 | 25 | -------------------------------------------------------------------------------- /src/driver/linux/mmake.mk: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-2.0 2 | # X-SPDX-Copyright-Text: (c) Solarflare Communications Inc 3 | ############################ 4 | # 5 | # EtherFabric linux kernel drivers 6 | # 7 | # Placeholeder for (un)load.sh scripts and copyed modules 8 | # 9 | ############################ 10 | 11 | clean: 12 | @$(MakeClean) 13 | rm -rf *.ko 14 | -------------------------------------------------------------------------------- /src/driver/linux_affinity/mmake.mk: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-2.0 2 | # X-SPDX-Copyright-Text: (c) Solarflare Communications Inc 3 | SFCAFF_SRCS := sfcaffinity.c 4 | 5 | SFCAFF_TARGET := sfc_affinity.o 6 | SFCAFF_TARGET_SRCS := $(SFCAFF_SRCS) 7 | 8 | TARGETS := $(SFCAFF_TARGET) 9 | 10 | IMPORT := ../linux_net/driverlink_api.h 11 | 12 | 13 | ###################################################### 14 | # linux kbuild support 15 | # 16 | 17 | KBUILD_EXTRA_SYMBOLS := $(BUILDPATH)/driver/linux_net/Module.symvers 18 | 19 | all: $(KBUILD_EXTRA_SYMBOLS) $(BUILDPATH)/driver/linux_affinity/autocompat.h 20 | $(MAKE) $(MMAKE_KBUILD_ARGS) M=$(CURDIR) 21 | cp -f sfc_affinity.ko $(DESTPATH)/driver/linux 22 | ifndef CI_FROM_DRIVER 23 | $(warning "Due to build order sfc.ko may be out-of-date. Please build in driver/linux_net") 24 | endif 25 | 26 | $(BUILDPATH)/driver/linux_affinity/autocompat.h: kernel_compat.sh ../linux_net/kernel_compat_funcs.sh 27 | ./kernel_compat.sh -k $(KPATH) $(if $(filter 1,$(V)),-v,-q) >$@ 28 | 29 | clean: 30 | @$(MakeClean) 31 | rm -rf *.ko Module.symvers .*.cmd 32 | 33 | 34 | ifdef MMAKE_IN_KBUILD 35 | 36 | dummy := $(shell echo>&2 "MMAKE_IN_KBUILD") 37 | 38 | obj-m := $(SFCAFF_TARGET) 39 | 40 | sfc_affinity-objs := $(SFCAFF_TARGET_SRCS:%.c=%.o) 41 | 42 | endif # MMAKE_IN_KBUILD 43 | -------------------------------------------------------------------------------- /src/driver/linux_net/aoe.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * Driver for Solarflare network controllers and boards 3 | * Copyright 2012 Solarflare Communications Inc. 4 | * 5 | * This program is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 as published 7 | * by the Free Software Foundation, incorporated herein by reference. 8 | */ 9 | 10 | #ifndef EFX_AOE_H 11 | #define EFX_AOE_H 12 | 13 | #include "net_driver.h" 14 | #include "efx.h" 15 | #include "mcdi.h" 16 | #include "mcdi_pcol.h" 17 | #include "io.h" 18 | #include "farch_regs.h" 19 | #include "nic.h" 20 | 21 | #if defined(EFX_NOT_UPSTREAM) && defined(CONFIG_SFC_AOE) 22 | #include "efx_ioctl.h" 23 | #include "mcdi_pcol_aoe.h" 24 | 25 | int efx_aoe_event(struct efx_nic *efx, efx_qword_t *event, int budget); 26 | int efx_aoe_update_cpld(struct efx_nic *efx, struct efx_update_cpld *cpld); 27 | int efx_aoe_update_keys(struct efx_nic *efx, 28 | struct efx_update_license *key_stats); 29 | int efx_aoe_reset_aoe(struct efx_nic *efx, 30 | struct efx_aoe_reset *reset_flags); 31 | #else 32 | static inline int efx_aoe_event(struct efx_nic *efx, efx_qword_t *event, int budget) 33 | { return -ENOENT; }; 34 | #endif 35 | 36 | #endif /* EFX_AOE_H */ 37 | -------------------------------------------------------------------------------- /src/driver/linux_net/driverlink.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * Driver for Solarflare network controllers and boards 3 | * Copyright 2005 Fen Systems Ltd. 4 | * Copyright 2006-2017 Solarflare Communications Inc. 5 | * 6 | * This program is free software; you can redistribute it and/or modify it 7 | * under the terms of the GNU General Public License version 2 as published 8 | * by the Free Software Foundation, incorporated herein by reference. 9 | */ 10 | 11 | #ifndef EFX_DRIVERLINK_H 12 | #define EFX_DRIVERLINK_H 13 | 14 | struct efx_nic; 15 | 16 | void efx_dl_register_nic(struct efx_nic *efx); 17 | void efx_dl_unregister_nic(struct efx_nic *efx); 18 | 19 | /* Suspend and resume client drivers over a hardware reset */ 20 | void efx_dl_reset_suspend(struct efx_nic *efx); 21 | void efx_dl_reset_resume(struct efx_nic *efx, int ok); 22 | 23 | /* Send unrecognised event to client drivers */ 24 | int efx_dl_handle_event(struct efx_nic *efx, void *event, int budget); 25 | 26 | /* List of all registered Efx ports. Protected by the rtnl_lock */ 27 | extern struct list_head efx_port_list; 28 | 29 | #endif /* EFX_DRIVERLINK_H */ 30 | -------------------------------------------------------------------------------- /src/driver/linux_net/dump.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * Driver for Solarflare network controllers and boards 3 | * Copyright 2015 Solarflare Communications Inc. 4 | * 5 | * This program is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 as published 7 | * by the Free Software Foundation, incorporated herein by reference. 8 | */ 9 | 10 | #ifndef EFX_DUMP_H 11 | #define EFX_DUMP_H 12 | 13 | #ifdef CONFIG_SFC_DUMP 14 | 15 | #define EFX_DUMP_DISABLE 0x0 16 | #define EFX_DUMP_ENABLE 0x1 17 | #define EFX_DUMP_FORCE 0x2 18 | 19 | struct efx_dump_data; 20 | struct ethtool_dump; 21 | 22 | int efx_dump_init(struct efx_nic *efx); 23 | void efx_dump_fini(struct efx_nic *efx); 24 | int efx_dump_reset(struct efx_nic *efx); 25 | int efx_dump_get_flag(struct efx_nic *efx, struct ethtool_dump *dump); 26 | int efx_dump_get_data(struct efx_nic *efx, struct ethtool_dump *dump, 27 | void *buffer); 28 | int efx_dump_set(struct efx_nic *efx, struct ethtool_dump *val); 29 | 30 | #else /* !CONFIG_SFC_DUMP */ 31 | 32 | static inline int efx_dump_init(struct efx_nic *efx) 33 | { 34 | return 0; 35 | } 36 | static inline void efx_dump_fini(struct efx_nic *efx) {} 37 | 38 | #endif /* CONFIG_SFC_DUMP */ 39 | 40 | #endif /* EFX_DUMP_H */ 41 | -------------------------------------------------------------------------------- /src/driver/linux_net/kabi_compat.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * Driver for Solarflare network controllers and boards 3 | * Copyright 2019 Solarflare Communications Inc. 4 | * 5 | * This program is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 as published 7 | * by the Free Software Foundation, incorporated herein by reference. 8 | */ 9 | 10 | #undef EFX_USE_IRQ_SET_AFFINITY_HINT 11 | #undef EFX_HAVE_ROUND_JIFFIES_UP 12 | #undef EFX_NEED_PCI_CLEAR_MASTER 13 | #define EFX_NEED_PCI_CLEAR_MASTER 14 | #undef EFX_NEED_GETNSTIMEOFDAY 15 | #define EFX_NEED_GETNSTIMEOFDAY 16 | #undef EFX_NEED_NS_TO_TIMESPEC 17 | #define EFX_NEED_NS_TO_TIMESPEC 18 | #undef EFX_HAVE_XEN_START_INFO 19 | #undef EFX_NEED_SET_NORMALIZED_TIMESPEC 20 | #define EFX_NEED_SET_NORMALIZED_TIMESPEC 21 | -------------------------------------------------------------------------------- /src/driver/linux_net/linux_mtd_mtd.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * Driver for Solarflare network controllers and boards 3 | * Copyright 2012 Solarflare Communications Inc. 4 | * 5 | * This program is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License version 2 as published 7 | * by the Free Software Foundation, incorporated herein by reference. 8 | */ 9 | 10 | /* Prior to Linux 3.2, would define a DEBUG 11 | * function-like macro, which we really don't want. Save and 12 | * restore the defined-ness of DEBUG across this #include. 13 | */ 14 | 15 | #ifdef DEBUG 16 | #define EFX_MTD_DEBUG 17 | #undef DEBUG 18 | #endif 19 | #include 20 | #undef DEBUG 21 | #ifdef EFX_MTD_DEBUG 22 | #define DEBUG 23 | #endif 24 | -------------------------------------------------------------------------------- /src/driver/linux_net/mmake.mk: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-2.0 2 | # X-SPDX-Copyright-Text: (c) 2005-2019 Solarflare Communications Inc 3 | 4 | SUBDIRS := util 5 | 6 | ifeq ($(DRIVER),1) 7 | ifeq ($(MMAKE_LIBERAL),1) 8 | NOWERROR := 1 9 | endif 10 | 11 | include $(TOPPATH)/$(CURRENT)/Makefile 12 | 13 | ../linux/sfc.ko: modules 14 | cp -f sfc.ko $@ 15 | 16 | all: ../linux/sfc.ko 17 | endif 18 | -------------------------------------------------------------------------------- /src/driver/linux_net/tx.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * Driver for Solarflare network controllers and boards 3 | * Copyright 2005-2006 Fen Systems Ltd. 4 | * Copyright 2006-2017 Solarflare Communications Inc. 5 | * 6 | * This program is free software; you can redistribute it and/or modify it 7 | * under the terms of the GNU General Public License version 2 as published 8 | * by the Free Software Foundation, incorporated herein by reference. 9 | */ 10 | 11 | #ifndef EFX_TX_H 12 | #define EFX_TX_H 13 | 14 | #include 15 | 16 | /** Driver internal tx-path related declarations. */ 17 | 18 | unsigned int efx_tx_limit_len( 19 | struct efx_tx_queue *tx_queue, 20 | dma_addr_t dma_addr, 21 | unsigned int len); 22 | 23 | u8 *efx_tx_get_copy_buffer_limited(struct efx_tx_queue *tx_queue, 24 | struct efx_tx_buffer *buffer, size_t len); 25 | 26 | int efx_tx_tso_sw(struct efx_tx_queue *tx_queue, struct sk_buff *skb, 27 | bool *data_mapped); 28 | 29 | #endif /* EFX_TX_H */ 30 | -------------------------------------------------------------------------------- /src/driver/linux_onload/aarch64_linux_trampoline_asm.S: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | #include 4 | #include 5 | #include 6 | 7 | ENTRY(efab_linux_trampoline_close) 8 | mov x1, sp 9 | b efab_linux_aarch64_trampoline_close 10 | ENDPROC(efab_linux_trampoline_close) 11 | -------------------------------------------------------------------------------- /src/driver/linux_resource/Makefile: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-2.0 2 | # X-SPDX-Copyright-Text: (c) Solarflare Communications Inc 3 | obj-$(CONFIG_SFC_RESOURCE) := sfc_resource.o 4 | 5 | sfc_resource-objs := iopage.o \ 6 | driverlink_new.o kernel_proc.o kfifo.o \ 7 | nic.o eventq.o falcon.o falcon_mac.o filter.o \ 8 | assert_valid.o buddy.o buffer_table.o \ 9 | iobufset_resource.o resource_manager.o resources.o \ 10 | vi_resource_alloc.o vi_resource_event.o vi_resource_flush.o \ 11 | vi_resource_manager.o vi_allocator.o filter.o compat_pat_wc.c 12 | 13 | -------------------------------------------------------------------------------- /src/driver/mmake.mk: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-2.0 2 | # X-SPDX-Copyright-Text: (c) Solarflare Communications Inc 3 | # For linux_net/util 4 | ifeq ($(LINUX),1) 5 | SUBDIRS += linux_net 6 | endif 7 | 8 | MMAKE_NO_DEPS := 1 9 | 10 | ifeq ($(LINUX),1) 11 | 12 | # DRIVER_SUBDIRS must be ordered according to inter-driver dependencies 13 | DRIVER_SUBDIRS := linux_net linux_affinity linux_resource \ 14 | linux_char linux_onload linux 15 | 16 | ifeq ($(BUILD_AFONLOAD),1) 17 | DRIVER_SUBDIRS += openonload 18 | endif 19 | 20 | endif # ifeq ($(LINUX),1) 21 | 22 | ifeq ($(WINDOWS),1) 23 | DRIVER_SUBDIRS := win 24 | endif 25 | 26 | ifeq ($(GLD),1) 27 | SUBDIRS := gld 28 | endif 29 | 30 | ifeq ($(DARWIN),1) 31 | DRIVER_SUBDIRS := macosx 32 | endif 33 | 34 | ifeq ($(DOS), 1) 35 | SUBDIRS = dos 36 | endif 37 | 38 | all: passthruparams := "CI_FROM_DRIVER=1" 39 | all: 40 | +@(target=all ; $(MakeSubdirs)) 41 | 42 | clean: 43 | @$(MakeClean) 44 | 45 | -------------------------------------------------------------------------------- /src/include/ci/app.h: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | /**************************************************************************\ 4 | *//*! \file 5 | ** 6 | ** \author 7 | ** \brief 8 | ** \date 9 | ** \cop (c) Level 5 Networks Limited. 10 | ** 11 | *//* 12 | \**************************************************************************/ 13 | 14 | /*! \cidoxg_include_ci */ 15 | 16 | #ifndef __CI_APP_H__ 17 | #define __CI_APP_H__ 18 | 19 | #ifdef __KERNEL__ 20 | # error This header should not be included in __KERNEL__ builds. 21 | #endif 22 | 23 | #ifndef __CI_TOOLS_H__ 24 | # include 25 | #endif 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | # include 32 | 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | 40 | #ifdef __cplusplus 41 | } 42 | #endif 43 | 44 | #endif /* __CI_APP_H__ */ 45 | 46 | /*! \cidoxg_end */ 47 | -------------------------------------------------------------------------------- /src/include/ci/app/ifindex.h: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | /**************************************************************************\ 4 | *//*! \file 5 | ** 6 | ** \author djr 7 | ** \brief An interface to translate between ifindex and interface name. 8 | ** \date 2008/12/18 9 | ** \cop (c) Solarflare Communications Inc. 10 | ** 11 | *//* 12 | \**************************************************************************/ 13 | 14 | /*! \cidoxg_include_ci_app */ 15 | #ifndef __CI_APP_IFINDEX_H__ 16 | #define __CI_APP_IFINDEX_H__ 17 | 18 | 19 | extern int ci_net_interface_ifindex_to_name(int ifindex, char* name_buf, 20 | int name_buf_len); 21 | 22 | /* Translates [name] to an ifindex. [name] may either be an integer (which 23 | * is returned) or an interface name such as "eth2". Returns a -ve error 24 | * code on failure. 25 | */ 26 | extern int ci_net_interface_name_to_ifindex(const char* name); 27 | 28 | 29 | #endif /* __CI_APP_IFINDEX_H__ */ 30 | /*! \cidoxg_end */ 31 | -------------------------------------------------------------------------------- /src/include/ci/app/onload.h: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | /**************************************************************************\ 4 | *//*! \file 5 | ** 6 | ** \author djr 7 | ** \brief Tools for testing onload. 8 | ** \date 2009/05/13 9 | ** \cop (c) Solarflare Communications Inc. 10 | ** 11 | *//* 12 | \**************************************************************************/ 13 | 14 | /*! \cidoxg_include_ci_app */ 15 | #ifndef __CI_APP_ONLOAD_H__ 16 | #define __CI_APP_ONLOAD_H__ 17 | 18 | 19 | /* Return true if the onload transport library is linked to this 20 | * application, or present in LD_PRELOAD. 21 | * 22 | * This is slightly unreliable -- it can return false for old versions of 23 | * onload when it is linked via /etc/ld.so.preload. Also it can return 24 | * true if onload is present in LD_PRELOAD but for some reason not linked. 25 | */ 26 | extern int ci_onload_is_active(void); 27 | 28 | /* Dump info about onload-related execution environment to given stream. 29 | * Includes value of LD_PRELOAD, onload version (if available) and onload 30 | * configuration options in the environment. 31 | */ 32 | extern void ci_onload_info_dump(FILE* f, const char* prefix); 33 | 34 | 35 | #endif /* __CI_APP_ONLOAD_H__ */ 36 | -------------------------------------------------------------------------------- /src/include/ci/compat/gcc_aarch64.h: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | /**************************************************************************\ 4 | *//*! \file 5 | ** 6 | ** \author 7 | ** \brief 8 | ** \date 9 | ** \cop (c) Level 5 Networks Limited. 10 | ** 11 | *//* 12 | \**************************************************************************/ 13 | 14 | /*! \cidoxg_include_ci_compat */ 15 | 16 | #ifndef __CI_COMPAT_GCC_AARCH64_H__ 17 | #define __CI_COMPAT_GCC_AARCH64_H__ 18 | 19 | /* ARM64 TODO review these */ 20 | 21 | /* 22 | Barriers to enforce ordering with respect to: 23 | normal memory use: ci_wmb, ci_rmb, ci_wmb 24 | */ 25 | 26 | #define ci_mb() __asm__ __volatile__ ("dsb sy" : : : "memory") 27 | #define ci_wmb() __asm__ __volatile__ ("dsb st" : : : "memory") 28 | #define ci_rmb() __asm__ __volatile__ ("dsb ld" : : : "memory") 29 | 30 | /* Really these should be in src/include/ci/driver/platform/... */ 31 | typedef unsigned long ci_phys_addr_t; 32 | #define ci_phys_addr_fmt "%lx" 33 | 34 | 35 | #endif /* __CI_COMPAT_GCC_AARCH64_H__ */ 36 | 37 | /*! \cidoxg_end */ 38 | -------------------------------------------------------------------------------- /src/include/ci/compat/gcc_ppc.h: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | /**************************************************************************\ 4 | *//*! \file 5 | ** 6 | ** \author 7 | ** \brief 8 | ** \date 9 | ** \cop (c) Level 5 Networks Limited. 10 | ** 11 | *//* 12 | \**************************************************************************/ 13 | 14 | /*! \cidoxg_include_ci_compat */ 15 | 16 | #ifndef __CI_COMPAT_GCC_PPC_H__ 17 | #define __CI_COMPAT_GCC_PPC_H__ 18 | 19 | /* 20 | Barriers to enforce ordering with respect to: 21 | normal memory use: ci_wmb, ci_rmb, ci_wmb 22 | */ 23 | 24 | /* 25 | System wide macros 'mb,rmb,wmb' are supplied 26 | which are ppc 32/64 bit specific. See 27 | */ 28 | 29 | #define ci_mb() __asm__ __volatile__ ("sync" : : : "memory") 30 | #if defined(__powerpc64__) 31 | #define ci_wmb() __asm__ __volatile__ ("lwsync" : : : "memory") 32 | #define ci_rmb() ci_wmb() 33 | #else 34 | #define ci_wmb() __asm__ __volatile__ ("eieio" : : : "memory") 35 | #define ci_rmb() ci_wmb() 36 | #endif 37 | 38 | #define ci_ul_iowb() ci_wmb() 39 | 40 | /* Really these should be in src/include/ci/driver/platform/... */ 41 | typedef unsigned long ci_phys_addr_t; 42 | #define ci_phys_addr_fmt "%lx" 43 | 44 | 45 | #endif /* __CI_COMPAT_GCC_PPC_H__ */ 46 | 47 | /*! \cidoxg_end */ 48 | -------------------------------------------------------------------------------- /src/include/ci/compat/pg_x86.h: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | /**************************************************************************\ 4 | *//*! \file 5 | ** 6 | ** \author 7 | ** \brief 8 | ** \date 9 | ** \cop (c) Level 5 Networks Limited. 10 | ** 11 | *//* 12 | \**************************************************************************/ 13 | 14 | /*! \cidoxg_include_ci_compat */ 15 | 16 | #ifndef __CI_COMPAT_PG_X86_H__ 17 | #define __CI_COMPAT_PG_X86_H__ 18 | 19 | 20 | #define CI_HAVE_INT64 21 | typedef unsigned long long ci_uint64; 22 | typedef long long ci_int64; 23 | 24 | #define CI_PRId64 "lld" 25 | #define CI_PRIi64 "lli" 26 | #define CI_PRIo64 "llo" 27 | #define CI_PRIu64 "llu" 28 | #define CI_PRIx64 "llx" 29 | #define CI_PRIX64 "llX" 30 | 31 | /* ?? need some assembler here */ 32 | 33 | #define ci_mb() /*??*/ 34 | 35 | #define ci_wmb() /* x86 processors store in-order */ 36 | #define ci_rmb() ci_mb() 37 | 38 | /* ?? double check sfence and mfence */ 39 | 40 | 41 | #endif /* __CI_COMPAT_PG_X86_H__ */ 42 | 43 | /*! \cidoxg_end */ 44 | -------------------------------------------------------------------------------- /src/include/ci/driver/driverlink_api.h: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | #ifndef __CI_DRIVER_DRIVERLINK_API__ 4 | #define __CI_DRIVER_DRIVERLINK_API__ 5 | 6 | #define EFX_DRIVERLINK_API_VERSION_MINOR 0 7 | 8 | #include 9 | 10 | /* Every time the major driverlink version is bumped, this check forces a build 11 | * failure, as it's necessary to audit the net driver change for compatibility 12 | * with driverlink clients. */ 13 | #if EFX_DRIVERLINK_API_VERSION > 25 14 | #error "Driverlink API has changed. Audit client code for compatibility." 15 | #endif 16 | 17 | #endif /* __CI_DRIVER_DRIVERLINK_API__ */ 18 | -------------------------------------------------------------------------------- /src/include/ci/driver/efab/hardware/ef10_evq.h: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | #ifndef __CI_DRIVER_EFAB_HARDWARE_EF10_EVQ_H__ 4 | #define __CI_DRIVER_EFAB_HARDWARE_EF10_EVQ_H__ 5 | 6 | 7 | /* Primes the EVQ by poking the current pointer to the relevant register. See 8 | * also ef10_update_evq_rptr_bug35388_workaround(), for use on hardware where 9 | * writes to that register can cause a lockup. */ 10 | static inline void ef10_update_evq_rptr(volatile void* io_page, int rptr) 11 | { 12 | writel(rptr << ERF_DZ_EVQ_RPTR_LBN, 13 | (char*) io_page + ER_DZ_EVQ_RPTR_REG); 14 | mmiowb(); 15 | } 16 | 17 | 18 | /* Workaround for the lockup issue: bug35981, bug35887, bug35388, bug36064. */ 19 | static inline void 20 | ef10_update_evq_rptr_bug35388_workaround(volatile void* io_page, int rptr) 21 | { 22 | const uint32_t REV0_OP_RPTR_HI = 0x800; 23 | const uint32_t REV0_OP_RPTR_LO = 0x900; 24 | 25 | uint32_t rptr_hi = REV0_OP_RPTR_HI | ((rptr >> 8) & 0xff); 26 | uint32_t rptr_lo = REV0_OP_RPTR_LO | (rptr & 0xff); 27 | 28 | writel(rptr_hi, (char*) io_page + ER_DZ_TX_DESC_UPD_REG + 8); 29 | wmb(); 30 | writel(rptr_lo, (char*) io_page + ER_DZ_TX_DESC_UPD_REG + 8); 31 | mmiowb(); 32 | } 33 | 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /src/include/ci/driver/efab/kprof.h: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | /* delete me */ 4 | -------------------------------------------------------------------------------- /src/include/ci/driver/platform/unix_common.h: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | /**************************************************************************\ 4 | *//*! \file 5 | ** 6 | ** \author 7 | ** \brief 8 | ** \date 9 | ** \cop (c) Level 5 Networks Limited. 10 | ** 11 | *//* 12 | \**************************************************************************/ 13 | 14 | /*! \cidoxg_include_ci_driver_platform */ 15 | 16 | #ifndef __CI_DRIVER_PLATFORM_UNIX_H__ 17 | #define __CI_DRIVER_PLATFORM_UNIX_H__ 18 | 19 | #include 20 | 21 | 22 | #ifndef __KERNEL__ 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | 35 | #endif 36 | 37 | 38 | #endif /* __CI_DRIVER_PLATFORM_UNIX_H__ */ 39 | 40 | /*! \cidoxg_end */ 41 | -------------------------------------------------------------------------------- /src/include/ci/efch/mmap.h: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | #ifndef __CI_EFCH_MMAP_H__ 4 | #define __CI_EFCH_MMAP_H__ 5 | 6 | #include 7 | 8 | struct efrm_vi; 9 | 10 | 11 | extern int 12 | efab_vi_resource_mmap(struct efrm_vi *virs, unsigned long *bytes, void *opaque, 13 | int *map_num, unsigned long *offset, int map_type); 14 | 15 | extern int 16 | efab_vi_resource_mmap_bytes(struct efrm_vi* virs, int map_type); 17 | 18 | extern unsigned long 19 | efab_vi_resource_nopage(struct efrm_vi *virs, void *opaque, 20 | unsigned long offset, unsigned long map_size); 21 | 22 | 23 | #endif /* __CI_EFCH_MMAP_H__ */ 24 | -------------------------------------------------------------------------------- /src/include/ci/efch/mmap_id.h: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | #ifndef __CI_EFCH_MMAP_ID_H__ 4 | #define __CI_EFCH_MMAP_ID_H__ 5 | 6 | #define EFCH_VI_MMAP_IO 0 7 | #define EFCH_VI_MMAP_MEM 1 8 | #define EFCH_VI_MMAP_PIO 2 9 | #define EFCH_VI_MMAP_CTPIO 3 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /src/include/ci/efhw/common_ci2linux.h: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | 4 | #ifndef __CI_EFHW_COMMON_CI2LINUX_H__ 5 | #define __CI_EFHW_COMMON_CI2LINUX_H__ 6 | 7 | #include 8 | 9 | 10 | # if defined(__KERNEL__) 11 | # error ci/efhw/common_ci2linux.h should not be included for Linux modules 12 | # endif 13 | #include 14 | typedef unsigned long dma_addr_t; 15 | #define DMA_ADDR_T_FMT "%lx" 16 | 17 | 18 | #ifdef __KERNEL__ 19 | #define PRIx32 "x" 20 | #define PRIx64 "llx" 21 | #endif 22 | 23 | #if ! (defined bool) && ! (defined __cplusplus) 24 | #undef false 25 | #undef true 26 | typedef enum { 27 | false = 0, 28 | true = 1 29 | } bool; 30 | #endif 31 | 32 | #ifndef uint64_t 33 | #define uint64_t ci_uint64 34 | #endif 35 | #ifndef uint32_t 36 | #define uint32_t ci_uint32 37 | #endif 38 | #ifndef uint16_t 39 | #define uint16_t ci_uint16 40 | #endif 41 | #ifndef uint8_t 42 | #define uint8_t ci_uint8 43 | #endif 44 | 45 | #ifndef int64_t 46 | #define int64_t ci_int64 47 | #endif 48 | #ifndef int32_t 49 | #define int32_t ci_int32 50 | #endif 51 | #ifndef int16_t 52 | #define int16_t ci_int16 53 | #endif 54 | #ifndef int8_t 55 | #define int8_t ci_int8 56 | #endif 57 | 58 | #endif /* __CI_EFHW_COMMON_CI2LINUX_H__ */ 59 | -------------------------------------------------------------------------------- /src/include/ci/efhw/debug_ci2linux.h: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | 4 | #ifndef __CI_EFHW_DEBUG_CI2LINUX_H__ 5 | #define __CI_EFHW_DEBUG_CI2LINUX_H__ 6 | 7 | #include 8 | #include 9 | #include 10 | 11 | #define printk ci_log 12 | #define printk_nl "" 13 | 14 | #define KERN_ERR "ERR>" 15 | #define KERN_WARNING "WARN>" 16 | #define KERN_NOTICE "NOTICE>" 17 | #define KERN_DEBUG "DBG>" 18 | 19 | # define BUG_ON(cond) ci_assert((cond) == 0) 20 | # define BUG() ci_assert(0) 21 | 22 | #endif /* __CI_EFHW_DEBUG_CI2LINUX_H__ */ 23 | -------------------------------------------------------------------------------- /src/include/ci/efhw/device.h: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | #ifndef __CI_EFHW_DEVICE_H__ 4 | #define __CI_EFHW_DEVICE_H__ 5 | 6 | enum efhw_arch { 7 | EFHW_ARCH_FALCON, 8 | EFHW_ARCH_EF10, 9 | }; 10 | 11 | /*---------------------------------------------------------------------------- 12 | * 13 | * NIC type 14 | * 15 | *---------------------------------------------------------------------------*/ 16 | 17 | enum efhw_function { 18 | EFHW_FUNCTION_PF, 19 | EFHW_FUNCTION_VF, 20 | }; 21 | 22 | struct efhw_device_type { 23 | int arch; /* enum efhw_arch */ 24 | char variant; /* 'A', 'B', ... */ 25 | int revision; /* 0, 1, ... */ 26 | int function; /* enum efhw_function */ 27 | }; 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /src/include/ci/efhw/efhw_buftable.h: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | #ifndef __CI_EFHW_EFHW_BUFTABLE_H__ 4 | #define __CI_EFHW_EFHW_BUFTABLE_H__ 5 | 6 | #include 7 | 8 | #ifndef NDEBUG 9 | static inline void 10 | efhw_buffer_table_set_debug(struct efhw_buffer_table_block *block, 11 | int first_entry, int n_entries) 12 | { 13 | EFHW_ASSERT(first_entry >= 0); 14 | EFHW_ASSERT(first_entry < EFHW_BUFFER_TABLE_BLOCK_SIZE); 15 | EFHW_ASSERT(n_entries > 0); 16 | EFHW_ASSERT(n_entries <= EFHW_BUFFER_TABLE_BLOCK_SIZE); 17 | EFHW_ASSERT(first_entry + n_entries <= 18 | EFHW_BUFFER_TABLE_BLOCK_SIZE); 19 | } 20 | 21 | static inline void 22 | efhw_buffer_table_clear_debug(struct efhw_buffer_table_block *block, 23 | int first_entry, int n_entries) 24 | { 25 | EFHW_ASSERT(first_entry >= 0); 26 | EFHW_ASSERT(first_entry < EFHW_BUFFER_TABLE_BLOCK_SIZE); 27 | EFHW_ASSERT(n_entries > 0); 28 | EFHW_ASSERT(n_entries <= EFHW_BUFFER_TABLE_BLOCK_SIZE); 29 | EFHW_ASSERT(first_entry + n_entries <= 30 | EFHW_BUFFER_TABLE_BLOCK_SIZE); 31 | } 32 | 33 | #endif /* NDEBUG */ 34 | 35 | #endif /* __CI_EFHW_EFHW_BUFTABLE_H__ */ 36 | -------------------------------------------------------------------------------- /src/include/ci/efhw/hardware_ci2linux.h: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | 4 | #ifndef __CI_EFHW_HARDWARE_CI2LINUX_H__ 5 | #define __CI_EFHW_HARDWARE_CI2LINUX_H__ 6 | 7 | #include 8 | 9 | #define __iomem 10 | 11 | #if CI_MY_BYTE_ORDER == CI_LITTLE_ENDIAN 12 | #define EFHW_IS_LITTLE_ENDIAN 13 | #else 14 | #define EFHW_IS_BIG_ENDIAN 15 | #endif 16 | 17 | 18 | #ifndef PAGE_SIZE 19 | #define PAGE_SIZE CI_PAGE_SIZE 20 | #endif 21 | #ifndef PAGE_SHIFT 22 | #define PAGE_SHIFT CI_PAGE_SHIFT 23 | #endif 24 | 25 | 26 | #define mmiowb() 27 | #define rmb ci_rmb 28 | #define wmb ci_wmb 29 | 30 | 31 | #endif /* __CI_EFHW_HARDWARE_CI2LINUX_H__ */ 32 | -------------------------------------------------------------------------------- /src/include/ci/internal/banner.h: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | /**************************************************************************\ 4 | *//*! \file 5 | ** 6 | ** \author dar 7 | ** \brief Helper function to print startup banner 8 | ** \date 2019/08/05 9 | ** \cop (c) Solarflare Communications Inc. 10 | ** 11 | *//* 12 | \**************************************************************************/ 13 | 14 | #ifndef __KERNEL__ 15 | #include 16 | #include 17 | 18 | #include 19 | #include 20 | #include 21 | 22 | static inline void ci_netif_log_startup_banner(ci_netif* ni, const char* verb) 23 | { 24 | struct cp_mibs* mib; 25 | cp_version_t version; 26 | char* sku; 27 | 28 | CP_VERLOCK_START(version, mib, ni->cplane) 29 | /* This is safe even in the event of a race, as the string is always 30 | * terminated somewhere. */ 31 | sku = strdup(mib->sku->value); 32 | CP_VERLOCK_STOP(version, mib) 33 | 34 | NI_LOG(ni, BANNER, "%s %s %s [%s]", 35 | verb, 36 | sku != NULL ? sku : ONLOAD_PRODUCT, 37 | ONLOAD_VERSION, 38 | ni->state->pretty_name); 39 | NI_LOG(ni, BANNER, ONLOAD_COPYRIGHT); 40 | 41 | free(sku); 42 | } 43 | #endif 44 | -------------------------------------------------------------------------------- /src/include/ci/internal/ip_signal.h: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | /**************************************************************************\ 4 | *//*! \file 5 | ** 6 | ** \author mjs 7 | ** \brief Decls needed for async signal management. 8 | ** \date 2005/03/06 9 | ** \cop (c) Level 5 Networks Limited. 10 | ** 11 | *//* 12 | \**************************************************************************/ 13 | 14 | /*! \cidoxg_include_ci_internal */ 15 | #ifndef __CI_INTERNAL_IP_SIGNAL_H__ 16 | #define __CI_INTERNAL_IP_SIGNAL_H__ 17 | 18 | #include 19 | #include 20 | #include 21 | 22 | 23 | typedef struct oo_sig_thread_state citp_signal_info; 24 | 25 | 26 | extern void citp_signal_run_pending(citp_signal_info* info) CI_HF; 27 | 28 | ci_inline citp_signal_info *citp_signal_get_specific_inited(void) 29 | { 30 | struct oo_per_thread* pt = __oo_per_thread_get(); 31 | return &pt->sig; 32 | } 33 | 34 | 35 | #endif /* __CI_INTERNAL_IP_SIGNAL_H__ */ 36 | /*! \cidoxg_end */ 37 | -------------------------------------------------------------------------------- /src/include/ci/internal/ni_dllist_tmpl_instantiate.h: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | /* Defines the macros for ni_dllists that parameterise the idllist template. 4 | * Since idllist.h.tmpl undefines all of these macros when it is finished, this 5 | * file is written in such a way that it may be included multiple times, with 6 | * different options defined that affect the behaviour of idllist.h.tmpl. */ 7 | 8 | #define CI_MK_ID(x) ci_ni_dllist##x 9 | #define CI_ILL_PTR(ctx, a) ((ci_ni_dllist_link*) CI_NETIF_PTR((ctx), (a))) 10 | #define CI_ILL_ADDR(ctx, lnk) oo_ptr_to_statep((ctx), (void*) (lnk)) 11 | #define CI_ILL_ADDR_EQ(a, b) OO_P_EQ((a), (b)) 12 | #define CI_ILL_ADDR_T oo_p 13 | #define CI_ILL_ADDR_NULL OO_P_NULL 14 | #define CI_ILL_CTX_T ci_netif* 15 | #define CI_ILL_CAS(p,old,new) ci_cas32u_succeed((volatile ci_uint32*) (p), \ 16 | (ci_uint32) (old), \ 17 | (ci_uint32) (new)) 18 | #define CI_ILL_XCHG(p,new) ((oo_p) ci_xchg32((volatile ci_uint32*) (p), \ 19 | (ci_uint32) (new))) 20 | 21 | #include 22 | -------------------------------------------------------------------------------- /src/include/ci/internal/oo_vi_flags.h: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | #ifndef __CI_INTERNAL_OO_VI_FLAGS_H__ 4 | #define __CI_INTERNAL_OO_VI_FLAGS_H__ 5 | 6 | #define OO_VI_FLAGS_PIO_EN 0x1 7 | #define OO_VI_FLAGS_RX_HW_TS_EN 0x2 8 | #define OO_VI_FLAGS_TX_HW_LOOPBACK_EN 0x4 9 | #define OO_VI_FLAGS_TX_HW_TS_EN 0x8 10 | #define OO_VI_FLAGS_CTPIO_EN 0x10 11 | 12 | #endif /* __CI_INTERNAL_OO_VI_FLAGS_H__ */ 13 | -------------------------------------------------------------------------------- /src/include/ci/internal/opts_user_def.h: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | /**************************************************************************\ 4 | *//*! \file 5 | ** 6 | ** \author cgg 7 | ** \brief Definition of user-specific options/restrictions 8 | ** \date 2005/12/12 9 | ** \cop (c) Level 5 Networks Limited. 10 | ** 11 | *//* 12 | \**************************************************************************/ 13 | 14 | 15 | /* For a detailed explanation of how this macro system works, look at 16 | * 17 | * 18 | * CI_CFG_OPT(type, type_modifider, name, group, default, 19 | * minimum, maximum, presentation) 20 | */ 21 | 22 | #ifdef CI_CFG_OPTFILE_VERSION 23 | CI_CFG_OPTFILE_VERSION(100) 24 | #endif 25 | 26 | -------------------------------------------------------------------------------- /src/include/ci/internal/os_sock.h: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | /**************************************************************************\ 4 | *//*! \file 5 | ** 6 | ** \author stg 7 | ** \brief OS-specific abstraction of kernel-based OS socket functions 8 | ** \date 2005/07/14 9 | ** \cop (c) Level 5 Networks Limited. 10 | ** 11 | *//* 12 | \**************************************************************************/ 13 | 14 | /*! \cidoxg_include_ci_internal */ 15 | 16 | /* Moved to ip.h (unfortunately)! */ 17 | 18 | /*! \cidoxg_end */ 19 | -------------------------------------------------------------------------------- /src/include/ci/internal/pio_buddy.h: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | #ifndef __CI_INTERNAL_PIO_BUDDY_H__ 4 | #define __CI_INTERNAL_PIO_BUDDY_H__ 5 | 6 | 7 | struct ci_pio_buddy_allocator; 8 | struct ci_netif; 9 | 10 | 11 | /*! Initialise a PIO buddy allocator. */ 12 | extern void ci_pio_buddy_ctor(ci_netif* ni, ci_pio_buddy_allocator* buddy, 13 | unsigned pio_len); 14 | 15 | /*! Destruct a PIO buddy allocator. */ 16 | extern void ci_pio_buddy_dtor(ci_netif* ni, ci_pio_buddy_allocator* buddy); 17 | 18 | /*! Allocate a block from the PIO region. Allocates a block of length 19 | * 1 << order and returns the offset into the PIO region of that block. 20 | * Returns less than 0 (errno) on failure. 21 | */ 22 | extern ci_int32 ci_pio_buddy_alloc(ci_netif* ni, ci_pio_buddy_allocator*, 23 | ci_uint8 order); 24 | 25 | /*! Free a block in the PIO region. The provided offset should be an offset 26 | * into the region as returned from ci_pio_buddy_alloc. 27 | */ 28 | extern void ci_pio_buddy_free(ci_netif* ni, ci_pio_buddy_allocator*, 29 | ci_int32 offset, ci_uint8 order); 30 | 31 | 32 | #endif /* __CI_INTERNAL_PIO_BUDDY_H__ */ 33 | 34 | -------------------------------------------------------------------------------- /src/include/ci/internal/rcversion.h: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | /**************************************************************************\ 4 | *//*! \file 5 | ** 6 | ** \author mch 7 | ** \brief Version information 8 | ** \date 2003/06/03 9 | ** \cop (c) Level 5 Networks Limited. 10 | ** 11 | *//* 12 | \**************************************************************************/ 13 | 14 | /*! \cidoxg_include_ci_internal */ 15 | 16 | #ifndef __CI_INTERNAL_RCVERSION_H__ 17 | #define __CI_INTERNAL_RCVERSION_H__ 18 | 19 | #include 20 | 21 | #undef VER_COMPANYNAME_STR 22 | #define VER_COMPANYNAME_STR CI_COMPANY_NAME 23 | 24 | #define VER_LEGALCOPYRIGHT_STR CI_COPYRIGHT_STRING 25 | 26 | #undef VER_PRODUCTNAME_STR 27 | #define VER_PRODUCTNAME_STR CI_PRODUCT_NAME 28 | 29 | #undef VER_PRODUCTVERSION 30 | #define VER_PRODUCTVERSION CI_RC_PRODUCT_VERSION 31 | 32 | #undef VER_PRODUCTVERSION_STR 33 | #define VER_PRODUCTVERSION_STR CI_RC_VERSION_STRING 34 | 35 | 36 | /* Make file version same as product version unless redefined later */ 37 | #define VER_FILEVERSION VER_PRODUCTVERSION 38 | #define VER_FILEVERSION_STR VER_PRODUCTVERSION_STR 39 | 40 | /* Default to language-independent software */ 41 | #define VER_LANGNEUTRAL 42 | 43 | #endif /* __CI_INTERNAL_VERSION_H__ */ 44 | /*! \cidoxg_end */ 45 | 46 | -------------------------------------------------------------------------------- /src/include/ci/internal/trampoline.h: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | /**************************************************************************\ 4 | *//*! \file 5 | ** 6 | ** \author gel,mjs 7 | ** \brief System call trampoline code kernel/UL interface 8 | ** \date 2005/03/01 9 | ** \cop (c) Level 5 Networks Limited. 10 | ** 11 | *//* 12 | \**************************************************************************/ 13 | 14 | /*! \cidoxg_include_ci_internal */ 15 | 16 | #ifndef __CI_INTERNAL_TRAMPOLINE_H__ 17 | #define __CI_INTERNAL_TRAMPOLINE_H__ 18 | 19 | /* Trampoline function opcodes */ 20 | #define CI_TRAMP_OPCODE_CLOSE 1 21 | 22 | #endif /* __CI_INTERNAL_TRAMPOLINE_H__ */ 23 | 24 | /*! \cidoxg_end */ 25 | 26 | -------------------------------------------------------------------------------- /src/include/ci/internal/transport_config_opt_cloud.h: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | #ifndef __CI_INTERNAL_TRANSPORT_CONFIG_OPT_CLOUD_H__ 4 | #define __CI_INTERNAL_TRANSPORT_CONFIG_OPT_CLOUD_H__ 5 | 6 | /* Use default values for the most of options: */ 7 | #include 8 | 9 | #undef CI_CFG_IPV6 10 | #define CI_CFG_IPV6 1 11 | 12 | /* Enable Berkeley Packet Filter program functionality. */ 13 | #undef CI_CFG_BPF 14 | #define CI_CFG_BPF 1 15 | 16 | #endif /* __CI_INTERNAL_TRANSPORT_CONFIG_OPT_CLOUD_H__ */ 17 | -------------------------------------------------------------------------------- /src/include/ci/internal/transport_config_opt_extra.h: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | #ifndef __CI_INTERNAL_TRANSPORT_CONFIG_OPT_EXTRA_H__ 4 | #define __CI_INTERNAL_TRANSPORT_CONFIG_OPT_EXTRA_H__ 5 | 6 | /* Disable IPv6 by default */ 7 | #undef CI_CFG_IPV6 8 | #define CI_CFG_IPV6 0 9 | 10 | /* Disable Berkeley Packet Filter program functionality. */ 11 | #undef CI_CFG_BPF 12 | #define CI_CFG_BPF 0 13 | 14 | #endif /* __CI_INTERNAL_TRANSPORT_CONFIG_OPT_EXTRA_H__ */ 15 | -------------------------------------------------------------------------------- /src/include/ci/internal/udp_stats_count_def.h: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | /**************************************************************************\ 4 | *//*! \file 5 | ** 6 | ** \author jmj 7 | ** \brief Definition of udp stack statistics 8 | ** \date 2018/07/03 9 | ** \cop (c) Solarflare Communications Inc. 10 | ** 11 | *//* 12 | \**************************************************************************/ 13 | 14 | OO_STAT("Total number of UDP datagrams delivered to UDP users.", 15 | CI_IP_STATS_TYPE, udp_in_dgrams, count) 16 | 17 | OO_STAT("Total number of received UDP datagrams for which " 18 | "there was no application at the destination port.", 19 | CI_IP_STATS_TYPE, udp_no_ports, count) 20 | 21 | OO_STAT("Number of received UDP datagrams that could not be delivered " 22 | "for reason other than the lack of an application at the destination " 23 | "port.", 24 | CI_IP_STATS_TYPE, udp_in_errs, count) 25 | 26 | OO_STAT("Total number of UDP datagrams sent from this entity.", 27 | CI_IP_STATS_TYPE, udp_out_dgrams, count) 28 | -------------------------------------------------------------------------------- /src/include/ci/net/ioctls.h: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | /**************************************************************************\ 4 | *//*! \file 5 | ** 6 | ** \author adp 7 | ** \brief Ioctls for ioctl() call compatibilty 8 | ** \date 2004/7/29 9 | ** \cop (c) Level 5 Networks Limited. 10 | ** 11 | *//* 12 | \**************************************************************************/ 13 | 14 | /*! \cidoxg_include_ci_net */ 15 | 16 | #ifndef __CI_NET_IOCTLS_H__ 17 | #define __CI_NET_IOCTLS_H__ 18 | 19 | # define SIOCINQ FIONREAD 20 | # define SIOCOUTQ TIOCOUTQ 21 | # ifndef SIOCOUTQNSD 22 | # define SIOCOUTQNSD 0x894b 23 | # endif 24 | # ifndef SIOCGSTAMPNS 25 | # define SIOCGSTAMPNS 0x8907 26 | # endif 27 | 28 | #endif /* __CI_NET_IOCTLS_H__ */ 29 | -------------------------------------------------------------------------------- /src/include/ci/tools.h: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | /**************************************************************************\ 4 | *//*! \file 5 | ** 6 | ** \author 7 | ** \brief 8 | ** \date 9 | ** \cop (c) Level 5 Networks Limited. 10 | ** 11 | *//* 12 | \**************************************************************************/ 13 | 14 | /*! \cidoxg_include_ci */ 15 | 16 | #ifndef __CI_TOOLS_H__ 17 | #define __CI_TOOLS_H__ 18 | 19 | #include 20 | #include 21 | #include 22 | #include 23 | 24 | #ifdef __cplusplus 25 | extern "C" { 26 | #endif 27 | 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include 43 | #include 44 | #include 45 | #include 46 | 47 | #ifdef __cplusplus 48 | } 49 | #endif 50 | 51 | #endif /* __CI_TOOLS_H__ */ 52 | 53 | /*! \cidoxg_end */ 54 | -------------------------------------------------------------------------------- /src/include/ci/tools/cpu_features.h: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | /**************************************************************************\ 4 | *//*! \file 5 | ** 6 | ** \author slp 7 | ** \brief Code to ensure the CPU has all the features required by this build. 8 | ** \date 2003/08/07 9 | ** \cop (c) Level 5 Networks Limited. 10 | ** 11 | *//* 12 | \**************************************************************************/ 13 | 14 | /*! \cidoxg_include_ci_tools */ 15 | 16 | #ifndef __CI_TOOLS_CPU_FEATURES_H__ 17 | #define __CI_TOOLS_CPU_FEATURES_H__ 18 | 19 | #define CI_CPU_OK (0) /* CPU checked out ok */ 20 | #define CI_CPU_OLD (-1) /* CPU didn't respond to the cpuid instruction */ 21 | #define CI_CPU_ERROR (-2) /* CPU cannot run this build */ 22 | #define CI_CPU_WARNING (-3) /* CPU can run this build but performance could 23 | be impacted */ 24 | 25 | /*! Comment? */ 26 | extern int ci_cpu_features_check(int verbose); 27 | 28 | extern int ci_cpu_has_feature(char* feature); 29 | 30 | #endif /* __CI_TOOLS_CPU_FEATURES_H__ */ 31 | 32 | /*! \cidoxg_end */ 33 | -------------------------------------------------------------------------------- /src/include/ci/tools/crc32c.h: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | /**************************************************************************\ 4 | *//*! \file 5 | ** 6 | ** \author 7 | ** \brief 8 | ** \date 9 | ** \cop (c) Level 5 Networks Limited. 10 | ** 11 | *//* 12 | \**************************************************************************/ 13 | 14 | /*! \cidoxg_include_ci_tools */ 15 | #ifndef __CI_TOOLS_CRC32C_H__ 16 | #define __CI_TOOLS_CRC32C_H__ 17 | 18 | extern ci_uint32 ci_crc32c_partial(const ci_uint8 *buf, ci_uint32 buflen, 19 | ci_uint32 crc); 20 | 21 | extern ci_uint32 ci_crc32c_partial_copy(ci_uint8 *dest, const ci_uint8 *buf, 22 | ci_uint32 buflen, ci_uint32 crc); 23 | 24 | ci_inline ci_uint32 ci_crc32c(const ci_uint8 *buf, ci_uint32 buflen) 25 | { 26 | return ~ci_crc32c_partial(buf, buflen, 0xffffffff); 27 | } 28 | 29 | #endif /* __CI_TOOLS_CRC32C_H__ */ 30 | /*! \cidoxg_end */ 31 | -------------------------------------------------------------------------------- /src/include/ci/tools/internal.h: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | /**************************************************************************\ 4 | *//*! \file 5 | ** 6 | ** \author 7 | ** \brief 8 | ** \date 9 | ** \cop (c) Level 5 Networks Limited. 10 | ** 11 | *//* 12 | \**************************************************************************/ 13 | 14 | /*! \cidoxg_include_ci_tools */ 15 | 16 | #ifndef __CI_TOOLS_INTERNAL_H__ 17 | #define __CI_TOOLS_INTERNAL_H__ 18 | 19 | 20 | #endif /* __CI_TOOLS_INTERNAL_H__ */ 21 | 22 | /*! \cidoxg_end */ 23 | -------------------------------------------------------------------------------- /src/include/ci/tools/log2.h: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | 4 | #ifndef __CI_TOOLS_LOG2_H__ 5 | #define __CI_TOOLS_LOG2_H__ 6 | 7 | /********************************************************************** 8 | * powers of two 9 | **********************************************************************/ 10 | 11 | /* The smallest [o] such that (1u << o) >= n. */ 12 | 13 | ci_inline unsigned ci_log2_ge(unsigned long n, unsigned min_order) { 14 | unsigned order = min_order; 15 | while( (1ul << order) < n ) ++order; 16 | return order; 17 | } 18 | 19 | 20 | /* The smallest [o] such that (1u << o) > n. */ 21 | 22 | ci_inline unsigned ci_log2_g(unsigned long n, unsigned min_order) { 23 | unsigned order = min_order; 24 | while( (1ul << order) <= n ) ++order; 25 | return order; 26 | } 27 | 28 | 29 | /* The largest [o] such that (1u << o) <= n. Requires n > 0. */ 30 | 31 | ci_inline unsigned ci_log2_le(unsigned long n) { 32 | unsigned order = 1; 33 | while( (1ul << order) <= n ) ++order; 34 | return (order - 1); 35 | } 36 | 37 | ci_inline unsigned long 38 | ci_pow2(unsigned order) { 39 | return (1ul << order); 40 | } 41 | 42 | #define CI_IS_POW2(x) ((x) && ! ((x) & ((x) - 1))) 43 | 44 | 45 | #endif /* __CI_TOOLS_LOG2_H__ */ 46 | -------------------------------------------------------------------------------- /src/include/ci/tools/namespace.h: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | int ci_check_net_namespace(const char* ns_filename); 4 | int ci_switch_net_namespace(const char* ns_filename); 5 | -------------------------------------------------------------------------------- /src/include/ci/tools/platform/pg_x86.h: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | /**************************************************************************\ 4 | *//*! \file 5 | ** 6 | ** \author 7 | ** \brief 8 | ** \date 9 | ** \cop (c) Level 5 Networks Limited. 10 | ** 11 | *//* 12 | \**************************************************************************/ 13 | 14 | /*! \cidoxg_include_ci_tools_platform */ 15 | 16 | #ifndef __CI_TOOLS_PG_X86_H__ 17 | #define __CI_TOOLS_PG_X86_H__ 18 | 19 | 20 | /********************************************************************** 21 | * Atomic integer. 22 | */ 23 | 24 | /* Minimal hack to compile stuff. */ 25 | typedef volatile ci_int32 ci_atomic_t; 26 | #define ci_atomic_read(p) (*(p)) 27 | 28 | 29 | 30 | #endif /* __CI_TOOLS_PG_X86_H__ */ 31 | 32 | /*! \cidoxg_end */ 33 | -------------------------------------------------------------------------------- /src/include/ci/tools/stacks.h: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | /**************************************************************************\ 4 | *//*! \file 5 | ** 6 | ** \author 7 | ** \brief 8 | ** \date 9 | ** \cop (c) Level 5 Networks Limited. 10 | ** 11 | *//* 12 | \**************************************************************************/ 13 | 14 | /*! \cidoxg_include_ci_tools */ 15 | 16 | #ifndef __CI_TOOLS_STACKS_H__ 17 | #define __CI_TOOLS_STACKS_H__ 18 | 19 | 20 | /*! Comment? */ 21 | typedef struct { 22 | int* stack_base; 23 | int* stack_top; 24 | int* stack_ptr; 25 | } ci_int_stack_t; 26 | 27 | typedef ci_int_stack_t ci_int_stack; 28 | 29 | 30 | /*! Comment? */ 31 | typedef struct { 32 | void** stack_base; 33 | void** stack_top; 34 | void** stack_ptr; 35 | } ci_ptr_stack_t; 36 | 37 | typedef ci_ptr_stack_t ci_ptr_stack; 38 | 39 | 40 | #endif /* __CI_TOOLS_STACKS_H__ */ 41 | 42 | /*! \cidoxg_end */ 43 | -------------------------------------------------------------------------------- /src/include/ci/tools/timeval.h: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | /**************************************************************************\ 4 | *//*! \file 5 | ** 6 | ** \author djr 7 | ** \brief Fixed width, cross-platform, timeval 8 | ** \date 2008/08/14 9 | ** \cop (c) Solarflare Communications Inc. 10 | ** 11 | *//* 12 | \**************************************************************************/ 13 | 14 | /*! \cidoxg_include_ci_tools */ 15 | #ifndef __CI_TOOLS_TIMEVAL_H__ 16 | #define __CI_TOOLS_TIMEVAL_H__ 17 | 18 | 19 | /* Fixed width type equivalent of struct timeval */ 20 | typedef struct ci_timeval_s { 21 | ci_int32 tv_sec; 22 | ci_int32 tv_usec; 23 | } ci_timeval_t; 24 | 25 | 26 | #endif /* __CI_TOOLS_TIMEVAL_H__ */ 27 | /*! \cidoxg_end */ 28 | -------------------------------------------------------------------------------- /src/include/cplane/mibdump_sock.h: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: Solarflare-Binary */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | /* This header describes the interface between the open source parts 4 | * of Onload and the binary-only control plane server. 5 | * 6 | * We use an md5sum over certain headers to ensure that userland and 7 | * kernel drivers are built against a compatible interface. The 8 | * control plane server and its clients will verify this hash against 9 | * the kernel module and refuse to start if there is a version 10 | * mismatch. 11 | * 12 | * Users should therefore not modify these headers because the 13 | * supplied control plane server will refuse to operate with the 14 | * resulting module. 15 | */ 16 | 17 | #ifndef __ONLOAD_CPLANE_MIBDUMP_SOCK_H__ 18 | #define __ONLOAD_CPLANE_MIBDUMP_SOCK_H__ 19 | 20 | #include 21 | 22 | static void cp_init_mibdump_addr(struct sockaddr_un* addr, 23 | ci_uint32 server_pid) 24 | { 25 | memset(addr, 0, sizeof(*addr)); 26 | addr->sun_family = AF_UNIX; 27 | snprintf(addr->sun_path + 1, sizeof(addr->sun_path) - 2, 28 | "onload_cp_server_mibdump.%d", server_pid); 29 | } 30 | 31 | #endif /* __ONLOAD_CPLANE_MIBDUMP_SOCK_H__ */ 32 | -------------------------------------------------------------------------------- /src/include/etherfabric/doxygen/005_whats_new.dox: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | 4 | /**************************************************************************\ 5 | *//*! \file 6 | ** \brief Additional Doxygen-format documentation for ef_vi. 7 | *//* 8 | \**************************************************************************/ 9 | 10 | /************************************************************************** 11 | * What's New page 12 | *************************************************************************/ 13 | /*! \page whatsnew What's New 14 | 15 | This chapter tells you what's new in this release of ef_vi. 16 | 17 | If you are not a previous user of ef_vi, go to \ref overview. 18 | 19 | \section whatsnew_bugfixes Bug fixes 20 | 21 | Various bugs have been fixed. For details, see the `ChangeLog` file. 22 | 23 | */ 24 | -------------------------------------------------------------------------------- /src/include/etherfabric/doxygen/efvi_vnic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/majek/openonload/aff60a36ed3543446d9ff179905f47c47d1e300b/src/include/etherfabric/doxygen/efvi_vnic.png -------------------------------------------------------------------------------- /src/include/etherfabric/doxygen/footer.tex: -------------------------------------------------------------------------------- 1 | % SPDX-License-Identifier: GPL-2.0 2 | % X-SPDX-Copyright-Text: (c) Solarflare Communications Inc 3 | 4 | % SF: Based on the default Latex footer for doxygen 1.8.13. 5 | % SF: Solarflare changes have comments starting "SF:" 6 | 7 | %--- End generated contents --- 8 | 9 | % Index 10 | \backmatter 11 | \newpage 12 | \phantomsection 13 | \cleardoublepage 14 | \addcontentsline{toc}{chapter}{Index} 15 | \printindex 16 | 17 | \end{document} 18 | -------------------------------------------------------------------------------- /src/include/etherfabric/doxygen/packet_buffers.vsdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/majek/openonload/aff60a36ed3543446d9ff179905f47c47d1e300b/src/include/etherfabric/doxygen/packet_buffers.vsdx -------------------------------------------------------------------------------- /src/include/etherfabric/doxygen/packet_buffers_jumbo-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/majek/openonload/aff60a36ed3543446d9ff179905f47c47d1e300b/src/include/etherfabric/doxygen/packet_buffers_jumbo-2.png -------------------------------------------------------------------------------- /src/include/etherfabric/doxygen/packet_buffers_jumbo-2_merged.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/majek/openonload/aff60a36ed3543446d9ff179905f47c47d1e300b/src/include/etherfabric/doxygen/packet_buffers_jumbo-2_merged.png -------------------------------------------------------------------------------- /src/include/etherfabric/doxygen/packet_buffers_jumbo-n.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/majek/openonload/aff60a36ed3543446d9ff179905f47c47d1e300b/src/include/etherfabric/doxygen/packet_buffers_jumbo-n.png -------------------------------------------------------------------------------- /src/include/etherfabric/doxygen/packet_buffers_jumbo-n_merged.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/majek/openonload/aff60a36ed3543446d9ff179905f47c47d1e300b/src/include/etherfabric/doxygen/packet_buffers_jumbo-n_merged.png -------------------------------------------------------------------------------- /src/include/etherfabric/doxygen/packet_buffers_layout.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/majek/openonload/aff60a36ed3543446d9ff179905f47c47d1e300b/src/include/etherfabric/doxygen/packet_buffers_layout.png -------------------------------------------------------------------------------- /src/include/etherfabric/doxygen/packet_buffers_layout_merged.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/majek/openonload/aff60a36ed3543446d9ff179905f47c47d1e300b/src/include/etherfabric/doxygen/packet_buffers_layout_merged.png -------------------------------------------------------------------------------- /src/include/etherfabric/doxygen/packet_buffers_non-jumbo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/majek/openonload/aff60a36ed3543446d9ff179905f47c47d1e300b/src/include/etherfabric/doxygen/packet_buffers_non-jumbo.png -------------------------------------------------------------------------------- /src/include/etherfabric/doxygen/packet_buffers_non-jumbo_merged.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/majek/openonload/aff60a36ed3543446d9ff179905f47c47d1e300b/src/include/etherfabric/doxygen/packet_buffers_non-jumbo_merged.png -------------------------------------------------------------------------------- /src/include/etherfabric/doxygen/solarflare_logo_blublk.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/majek/openonload/aff60a36ed3543446d9ff179905f47c47d1e300b/src/include/etherfabric/doxygen/solarflare_logo_blublk.png -------------------------------------------------------------------------------- /src/include/etherfabric/internal/cluster_protocol.h: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: LGPL-2.1 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | 4 | #ifndef __EFAB_CLUSTER_PROTOCOL_H__ 5 | #define __EFAB_CLUSTER_PROTOCOL_H__ 6 | 7 | /* Internal interfaces, so exclude from doxygen documentation */ 8 | /*! \cond internal */ 9 | 10 | /* WARNING!!! This file is not part of the public ef_vi API and should 11 | * not be included by any applications. */ 12 | 13 | /* src/tool/solar_clusterd will need updating if you update any of the 14 | * definitions below 15 | */ 16 | 17 | /* 18 | * \brief Cluster Daemon Protocol 19 | * \date 2013/11/28 20 | */ 21 | 22 | 23 | #define CLUSTERD_PROTOCOL_VERSION 1 24 | 25 | /* 26 | * Default file names and location. 27 | * For example, /tmp/solar_clusterd-root/solar_clusterd.log 28 | */ 29 | #define DEFAULT_CLUSTERD_DIR "/tmp/solar_clusterd-" 30 | #define DEFAULT_CLUSTERD_SOCK_NAME "solar_clusterd" 31 | 32 | #define MSGLEN_MAX 255 33 | 34 | enum cluster_req { 35 | CLUSTERD_VERSION_REQ, 36 | CLUSTERD_VERSION_RESP, 37 | CLUSTERD_ALLOC_CLUSTER_REQ, 38 | CLUSTERD_ALLOC_CLUSTER_RESP, 39 | }; 40 | 41 | enum cluster_result_code { 42 | CLUSTERD_ERR_SUCCESS, 43 | CLUSTERD_ERR_FAIL, 44 | CLUSTERD_ERR_BAD_REQUEST, 45 | }; 46 | 47 | /*! \endcond internal */ 48 | 49 | #endif /* __EFAB_CLUSTER_PROTOCOL_H__ */ 50 | -------------------------------------------------------------------------------- /src/include/mmake.mk: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-2.0 OR Solarflare-Binary 2 | # X-SPDX-Copyright-Text: (c) Solarflare Communications Inc 3 | all: 4 | 5 | clean: 6 | -@rm *.h $(EXTRA_CLEANS) 2>/dev/null 7 | 8 | ifneq ($(DRIVER),1) 9 | DRIVER=0 10 | 11 | ###################################################################### 12 | # Autogenerated headers to find out details about libc features 13 | libc_compat.h: $(TOP)/scripts/libc_compat.sh 14 | CC="${CC}" CFLAGS="${CFLAGS} ${MMAKE_CFLAGS}" $(TOP)/scripts/libc_compat.sh libc_compat.h 15 | 16 | 17 | all: libc_compat.h 18 | endif 19 | -------------------------------------------------------------------------------- /src/include/onload/atomics.h: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | #ifndef __ONLOAD_ATOMICS_H__ 4 | #define __ONLOAD_ATOMICS_H__ 5 | 6 | 7 | ci_inline ci_int32 oo_atomic_read(const oo_atomic_t* a) { return a->n; } 8 | ci_inline void oo_atomic_set(oo_atomic_t* a, ci_int32 v) { a->n = v; } 9 | 10 | ci_inline void oo_atomic_inc(oo_atomic_t* a) 11 | { ci_atomic32_inc(&a->n); } 12 | 13 | ci_inline int oo_atomic_dec_and_test(oo_atomic_t* a) 14 | { return ci_atomic32_dec_and_test(&a->n); } 15 | 16 | ci_inline void oo_atomic_add(oo_atomic_t* a, int n) 17 | { ci_atomic32_add(&a->n, n); } 18 | 19 | 20 | #endif /* __ONLOAD_ATOMICS_H__ */ 21 | -------------------------------------------------------------------------------- /src/include/onload/cplane_prot_types.h: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | /* Data types for cppl subsystem - driver only */ 4 | #ifndef __CPLANE_PROT_TYPES_H__ 5 | #define __CPLANE_PROT_TYPES_H__ 6 | 7 | /*! This file provides definitions are specific to given address resolution 8 | * scenario. For example two versions of this header may be used to deal 9 | * with explicit ARP protocols and with "raw" socket ARP use. 10 | * 11 | * In the (distant?) future ICMPv6 support may be added here. 12 | * 13 | * The prefix cicppl is used for definitions in this header: 14 | * ci - our main prefix 15 | * cp - control plane 16 | * pl - protocols 17 | */ 18 | 19 | /*---------------------------------------------------------------------------- 20 | * O/S-specific Address Resolution MIB Data types 21 | *---------------------------------------------------------------------------*/ 22 | 23 | 24 | struct cicppl_instance { 25 | struct socket *bindtodev_raw_sock; 26 | struct socket *bindtodev_raw_sock_ip6; 27 | ci_ifid_t bindtodevice_ifindex; 28 | struct oo_cplane_handle *cp; 29 | }; 30 | 31 | 32 | #endif /* __CPLANE_PROT_TYPES_H__ */ 33 | -------------------------------------------------------------------------------- /src/include/onload/drv/dump_to_user.h: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | #ifndef __ONLOAD_DRV_DUMP_TO_USER_H__ 4 | #define __ONLOAD_DRV_DUMP_TO_USER_H__ 5 | 6 | 7 | typedef void (*oo_dump_log_fn_t)(void* log_fn_arg, const char* fmt, ...) 8 | __attribute__((format(printf,2,3))); 9 | 10 | typedef void (*oo_dump_fn_t)(void* oo_dump_fn_arg, oo_dump_log_fn_t log, 11 | void* log_arg); 12 | 13 | extern int oo_dump_to_user(oo_dump_fn_t, void* dump_fn_arg, 14 | void* user_buf, int user_buf_len); 15 | 16 | 17 | #endif /* __ONLOAD_DRV_DUMP_TO_USER_H__ */ 18 | -------------------------------------------------------------------------------- /src/include/onload/dshm.h: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | /** 4 | * \file Kernel interface to "donation" shared memory. 5 | */ 6 | 7 | #ifndef __OO_DSHM_H__ 8 | #define __OO_DSHM_H__ 9 | 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | 15 | enum { 16 | OO_DSHM_CLASS_ZF_STACK, 17 | OO_DSHM_CLASS_ZF_PACKETS, 18 | OO_DSHM_CLASS_COUNT, 19 | }; 20 | 21 | 22 | #ifdef __KERNEL__ 23 | 24 | extern int 25 | oo_dshm_register_impl(ci_int32 shm_class, ci_user_ptr_t user_addr, 26 | ci_uint32 length, ci_int32* buffer_id_out, 27 | ci_dllist* handle_list); 28 | 29 | extern int 30 | oo_dshm_list_impl(ci_int32 shm_class, ci_user_ptr_t buffer_ids, 31 | ci_uint32* count_in_out); 32 | 33 | extern void 34 | oo_dshm_init(void); 35 | 36 | extern void 37 | oo_dshm_fini(void); 38 | 39 | extern int 40 | oo_dshm_free_handle_list(ci_dllist*); 41 | 42 | #ifdef OO_MMAP_TYPE_DSHM 43 | extern int 44 | oo_dshm_mmap_impl(struct vm_area_struct*); 45 | #endif 46 | 47 | #endif 48 | 49 | 50 | #ifdef __cplusplus 51 | } 52 | #endif 53 | 54 | #endif /* ! defined(__OO_DSHM_H__) */ 55 | 56 | -------------------------------------------------------------------------------- /src/include/onload/dup2_lock.h: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | #ifndef __ONLOAD_DUP2_LOCK_H__ 4 | #define __ONLOAD_DUP2_LOCK_H__ 5 | 6 | #include 7 | 8 | 9 | extern oo_rwlock citp_dup2_lock CI_HV; 10 | 11 | 12 | #endif /* __ONLOAD_DUP2_LOCK_H__ */ 13 | -------------------------------------------------------------------------------- /src/include/onload/ioctl_base.h: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | #ifndef __ONLOAD_IOCTL_BASE_H__ 4 | #define __ONLOAD_IOCTL_BASE_H__ 5 | 6 | #include 7 | 8 | 9 | /* Worth changing this base whenever you change an ioctl in an incompatible 10 | ** way, so we can catch the error more easily... 11 | */ 12 | # define OO_LINUX_IOC_BASE 90 13 | # if OO_LINUX_IOC_BASE > 254 14 | # error "OO_LINUX_IOC_BASE should be one byte" 15 | # endif 16 | 17 | # define OO_IOC_NONE(XXX) _IO(OO_LINUX_IOC_BASE, OO_OP_##XXX) 18 | # define OO_IOC_R(XXX, t) _IOR(OO_LINUX_IOC_BASE, OO_OP_##XXX, t) 19 | # define OO_IOC_W(XXX, t) _IOW(OO_LINUX_IOC_BASE, OO_OP_##XXX, t) 20 | # define OO_IOC_RW(XXX, t) _IOWR(OO_LINUX_IOC_BASE, OO_OP_##XXX, t) 21 | 22 | 23 | 24 | #endif /* __ONLOAD_IOCTL_BASE_H__ */ 25 | -------------------------------------------------------------------------------- /src/include/onload/nic.h: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | #ifndef __ONLOAD_NIC_H__ 4 | #define __ONLOAD_NIC_H__ 5 | 6 | 7 | #define OO_NIC_BLACKLIST 0x1 8 | #define OO_NIC_WHITELIST 0x2 9 | 10 | 11 | struct oo_nic { 12 | struct efrm_client* efrm_client; 13 | #define OO_NIC_UP 0x00000001u /* Interface is currently IFF_UP. */ 14 | #define OO_NIC_UNPLUGGED 0x00000002u /* Interface has been hot-unplugged. */ 15 | unsigned oo_nic_flags; 16 | }; 17 | 18 | 19 | extern int oo_n_nics; 20 | extern struct oo_nic oo_nics[]; 21 | 22 | extern void oo_nic_failover_from_hwport(int hwport); 23 | 24 | extern struct oo_nic* oo_nic_add(const struct net_device* dev); 25 | 26 | extern struct oo_nic* oo_nic_find_dev(const struct net_device* dev); 27 | 28 | extern int oo_nic_hwport(struct oo_nic*); 29 | 30 | extern int oo_check_nic_suitable_for_onload(struct oo_nic* onic); 31 | 32 | extern void oo_nic_shutdown(void); 33 | 34 | #endif /* __ONLOAD_NIC_H__ */ 35 | -------------------------------------------------------------------------------- /src/include/onload/oo_pipe.h: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | 4 | #ifndef __ONLOAD_OO_PIPE_H__ 5 | #define __ONLOAD_OO_PIPE_H__ 6 | 7 | #if !CI_CFG_USERSPACE_PIPE 8 | #error "Do not include oo_pipe.h when pipe is not enabled" 9 | #endif 10 | 11 | #define oo_pipe_data_len(_p) \ 12 | ((_p)->bytes_added - (_p)->bytes_removed) 13 | 14 | /* The write pointer is invalidated when a pipe is filled, but to avoid races 15 | * it is not reset when space becomes available, and so we must check for space 16 | * explicitly when the pipe is marked as being full. */ 17 | #define oo_pipe_has_space(_p) \ 18 | ((_p)->write_ptr.pp_wait != OO_ACCESS_ONCE((_p)->read_ptr.pp)) 19 | 20 | /* A pipe is considered writable (for, e.g., select()) even if further buffers 21 | * would have to be allocated. */ 22 | #define oo_pipe_is_writable(_p) (oo_pipe_has_space(_p) || \ 23 | (_p)->bufs_num < (_p)->bufs_max) 24 | 25 | 26 | #ifdef __KERNEL__ 27 | void oo_pipe_wake_peer(ci_netif* ni, struct oo_pipe* p, unsigned wake); 28 | #endif 29 | 30 | extern void oo_pipe_buf_clear_state(ci_netif* ni, struct oo_pipe* p); 31 | 32 | #endif /* __ONLOAD_OO_PIPE_H__ */ 33 | -------------------------------------------------------------------------------- /src/include/onload/oof_hw_filter.h: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | #ifndef __ONLOAD_OOF_HW_FILTER_H__ 4 | #define __ONLOAD_OOF_HW_FILTER_H__ 5 | 6 | #include 7 | 8 | struct tcp_helper_resource_s; 9 | struct tcp_helper_cluster_s; 10 | 11 | 12 | struct oo_hw_filter { 13 | struct tcp_helper_resource_s* trs; 14 | struct tcp_helper_cluster_s* thc; 15 | unsigned dlfilter_handle; 16 | int filter_id[CI_CFG_MAX_HWPORTS]; 17 | }; 18 | 19 | 20 | #endif /* __ONLOAD_OOF_HW_FILTER_H__ */ 21 | -------------------------------------------------------------------------------- /src/include/onload/pkt_p.h: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | #ifndef __ONLOAD_PKT_P_H__ 4 | #define __ONLOAD_PKT_P_H__ 5 | 6 | 7 | /********************************************************************** 8 | * Pointers to packets. 9 | */ 10 | 11 | 12 | typedef ci_int32 oo_pkt_p; 13 | 14 | /* Convert to and from integer id. Users of this are probably depending on 15 | * the implementation. 16 | */ 17 | #define OO_PP_ID(pp) ((int) (pp)) 18 | #define OO_PP_INIT(ni, pp, iid) ((pp) = (ci_int32) (iid)) 19 | #define OO_PP_ID_NULL ((ci_int32) -1) 20 | #define OO_PP_ID_INVALID ((ci_int32) -2) 21 | #define OO_PKT_ID(pkt) ((int) (pkt)->pp) 22 | #define OO_PKT_PP_INIT(pkt, iid) ((pkt)->pp = (ci_int32) (iid)) 23 | 24 | /* Public interface. */ 25 | #define OO_PP_IS_NULL(pp) ((pp) < 0) 26 | #define OO_PP_NOT_NULL(pp) ((pp) >= 0) 27 | #define OO_PP_EQ(ppa, ppb) ((ppa) == (ppb)) 28 | #define OO_PP_FMT(pp) OO_PP_ID(pp) 29 | #define OO_PKT_FMT(pkt) OO_PP_FMT((pkt)->pp) 30 | #define OO_PKT_P(pkt) ((pkt)->pp) 31 | 32 | #define OO_PP_NULL -1 33 | #define OO_PP_INVALID -2 34 | 35 | 36 | 37 | #endif /* __ONLOAD_PKT_P_H__ */ 38 | -------------------------------------------------------------------------------- /src/include/onload/primitive_types.h: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | #ifndef __ONLOAD_PRIMITIVE_TYPES_H__ 4 | #define __ONLOAD_PRIMITIVE_TYPES_H__ 5 | 6 | #include 7 | 8 | 9 | typedef struct ci_netif_s ci_netif; 10 | typedef struct ci_netif_state_s ci_netif_state; 11 | typedef struct ci_ip_pkt_fmt_s ci_ip_pkt_fmt; 12 | typedef struct ci_sock_cmn_s ci_sock_cmn; 13 | typedef struct ci_tcp_state_s ci_tcp_state; 14 | typedef struct ci_tcp_socket_listen_s ci_tcp_socket_listen; 15 | typedef struct ci_udp_state_s ci_udp_state; 16 | typedef union citp_waitable_obj_u citp_waitable_obj; 17 | typedef struct citp_socket_s citp_socket; 18 | typedef struct ci_active_wild_s ci_active_wild; 19 | 20 | 21 | /*! The stack's measure of time. In ticks. */ 22 | typedef ci_uint32 ci_iptime_t; 23 | 24 | 25 | /* Fixed width type equivalent of struct timeval */ 26 | struct oo_timeval { 27 | ci_int32 tv_sec; 28 | ci_int32 tv_usec; 29 | }; 30 | 31 | typedef struct { 32 | volatile ci_uint32 n; 33 | } oo_atomic_t; 34 | 35 | 36 | #include 37 | #include 38 | #include 39 | 40 | 41 | #endif /* __ONLOAD_PRIMITIVE_TYPES_H__ */ 42 | -------------------------------------------------------------------------------- /src/include/onload/sock_p.h: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | #ifndef __ONLOAD_SOCK_P_H__ 4 | #define __ONLOAD_SOCK_P_H__ 5 | 6 | 7 | 8 | typedef ci_int32 oo_sp; 9 | 10 | # define OO_SP_FROM_INT(ni, id) (id) 11 | # define OO_SP_TO_INT(p) (p) 12 | 13 | # define OO_SP_IS_NULL(p) ((p) < 0) 14 | # define OO_SP_NOT_NULL(p) ((p) >= 0) 15 | # define OO_SP_EQ(pa, pb) ((pa) == (pb)) 16 | # define OO_SP_FMT(p) ((int) (p)) 17 | 18 | # define OO_SP_NULL -1 19 | # define OO_SP_INVALID -2 20 | 21 | 22 | 23 | #endif /* __ONLOAD_SOCK_P_H__ */ 24 | -------------------------------------------------------------------------------- /src/include/onload/state_p.h: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | #ifndef __ONLOAD_STATE_P_H__ 4 | #define __ONLOAD_STATE_P_H__ 5 | 6 | 7 | 8 | typedef ci_int32 oo_p; 9 | 10 | # define OO_P_INIT(p, ni, off) ((p) = (off)) 11 | # define OO_P_OFF(p) (p) 12 | 13 | # define OO_P_IS_NULL(p) ((p) < 0) 14 | # define OO_P_NOT_NULL(p) ((p) >= 0) 15 | # define OO_P_EQ(pa, pb) ((pa) == (pb)) 16 | # define OO_P_FMT(p) ((int) (p)) 17 | # define OO_P_ADD(p, off) do{ (p) += (off); }while(0) 18 | 19 | # define OO_P_NULL -1 20 | # define OO_P_INVALID -2 21 | 22 | 23 | 24 | #endif /* __ONLOAD_STATE_P_H__ */ 25 | -------------------------------------------------------------------------------- /src/include/onload/syscalls.h: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | /**************************************************************************\ 4 | *//*! \file 5 | ** 6 | ** \author David Riddoch 7 | ** \brief Declare the onload entry-points. 8 | ** \date 2011/01/06 9 | ** \cop (c) Solarflare Communications, Inc. 10 | ** 11 | *//* 12 | \**************************************************************************/ 13 | 14 | #ifndef __ONLOAD_SYSCALLS_H__ 15 | #define __ONLOAD_SYSCALLS_H__ 16 | 17 | /* 18 | * This head declares the public interface for linking directly to the 19 | * Onload library. 20 | * 21 | */ 22 | 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #if __GNUC__ >= 3 /* ?? XXX FIXME */ 32 | # include 33 | #endif 34 | 35 | /*! Generate declarations of pointers to the system calls */ 36 | #define CI_MK_DECL(ret, fn, args) extern ret onload_##fn args 37 | #include 38 | 39 | 40 | #endif /* __ONLOAD_SYSCALLS_H__ */ 41 | -------------------------------------------------------------------------------- /src/include/onload/tmpl.h: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | /**************************************************************************\ 4 | *//*! \file 5 | ** 6 | ** \author as 7 | ** \brief Templated sends definitions 8 | ** \date 2013/08/20 9 | ** \cop (c) Level 5 Networks Limited. 10 | ** 11 | *//* 12 | \**************************************************************************/ 13 | 14 | /*! \cidoxg_include_ci_internal_tmpl_types */ 15 | 16 | #ifndef __CI_INTERNAL_TMPL_TYPES_H__ 17 | #define __CI_INTERNAL_TMPL_TYPES_H__ 18 | 19 | 20 | struct oo_msg_template { 21 | /* To verify subsequent templated calls are used with the same socket */ 22 | oo_sp oomt_sock_id; 23 | }; 24 | 25 | 26 | extern void ci_tcp_tmpl_free_all(ci_netif* ni, ci_tcp_state* ts); 27 | extern void ci_tcp_tmpl_handle_nic_reset(ci_netif* ni); 28 | 29 | 30 | #endif /* __CI_INTERNAL_TMPL_TYPES_H__ */ 31 | /*! \cidoxg_end */ 32 | -------------------------------------------------------------------------------- /src/include/onload/version.h: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | /**************************************************************************\ 4 | *//*! \file 5 | ** 6 | ** \author djr 7 | ** \brief Onload version. 8 | ** \date 2009/07/22 9 | ** \cop (c) Solarflare Communications Inc. 10 | ** 11 | *//* 12 | \**************************************************************************/ 13 | 14 | #ifndef __ONLOAD_VERSION_H__ 15 | #define __ONLOAD_VERSION_H__ 16 | 17 | 18 | #ifndef ONLOAD_VERSION 19 | # define ONLOAD_VERSION "7.1.0.265" 20 | #endif 21 | 22 | #define ONLOAD_PRODUCT "Onload" 23 | 24 | #define ONLOAD_COPYRIGHT "Copyright 2019-2020 Xilinx, 2006-2019 Solarflare Communications, 2002-2005 Level 5 Networks" 25 | 26 | /* Max length of version string used for version skew checking. */ 27 | enum { OO_VER_STR_LEN = 40 }; 28 | 29 | 30 | /* We use an md5sum over certain headers to ensure that userland and kernel 31 | * drivers are built against a compatible interface. 32 | */ 33 | enum { CI_CHSUM_STR_LEN = 32 }; 34 | 35 | 36 | typedef struct oo_version_check_s { 37 | char in_version[OO_VER_STR_LEN + 1]; 38 | char in_uk_intf_ver[CI_CHSUM_STR_LEN + 1]; 39 | int32_t debug; 40 | } oo_version_check_t; 41 | 42 | 43 | #endif /* __ONLOAD_VERSION_H__ */ 44 | -------------------------------------------------------------------------------- /src/include/zf/sysdep/x86.h: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: Solarflare-Binary */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | /**************************************************************************\ 4 | *//*! \file 5 | ** \brief TCPDirect x86-specific definitions 6 | ** 7 | ** This file contains system-dependent code that is used by the other header 8 | ** files. It has no end-user API. 9 | ** 10 | *//*! \cond NODOC 11 | *//* 12 | \**************************************************************************/ 13 | 14 | #ifndef __ZF_SYSDEP_X86_H__ 15 | #define __ZF_SYSDEP_X86_H__ 16 | 17 | /*! \brief Cache line size for the x86 architecture */ 18 | #define ZF_CACHE_LINE_SIZE 64u 19 | 20 | #endif /* __ZF_SYSDEP_X86_H__*/ 21 | /** @} 22 | * \endcond NODOC 23 | */ 24 | -------------------------------------------------------------------------------- /src/include/zf/zf.h: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: Solarflare-Binary */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | /**************************************************************************\ 4 | *//*! \file 5 | ** \brief TCPDirect top-level API 6 | ** 7 | ** This file should be included in TCPDirect clients. It includes any other 8 | ** TCPDirect header files that are required. 9 | ** 10 | *//*! \cond NODOC 11 | *//* 12 | \**************************************************************************/ 13 | 14 | #ifndef __ZF_TOP_H__ 15 | #define __ZF_TOP_H__ 16 | #define __IN_ZF_TOP_H__ 17 | 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | 29 | #undef __IN_ZF_TOP_H__ 30 | #endif /* __ZF_TOP_H__ */ 31 | /** @} 32 | * \endcond NODOC 33 | */ 34 | -------------------------------------------------------------------------------- /src/lib/ciapp/ctimer.c: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | /**************************************************************************\ 4 | *//*! \file 5 | ** 6 | ** \author 7 | ** \brief 8 | ** \date 9 | ** \cop (c) Level 5 Networks Limited. 10 | ** 11 | *//* 12 | \**************************************************************************/ 13 | 14 | /*! \cidoxg_lib_ciapp */ 15 | 16 | #include 17 | 18 | 19 | /********************************************************************** 20 | * ci_ctimer_calibrate() 21 | */ 22 | 23 | void ci_ctimer_calibrate(ci_ctimer_inf* i) 24 | { 25 | int n = 20; 26 | ci_int64 min = 1000; 27 | ci_ctimer t; 28 | i->overhead = 0; 29 | 30 | while( n-- ) { 31 | ci_ctimer_start_accurate(&t); 32 | ci_ctimer_stop_accurate(i, &t); 33 | 34 | if( i == 0 || ci_ctimer_cycles(&t) < min ) 35 | min = ci_ctimer_cycles(&t); 36 | } 37 | 38 | i->overhead = min; 39 | } 40 | 41 | 42 | /********************************************************************** 43 | * ci_ctimer_init() 44 | */ 45 | 46 | int ci_ctimer_init(ci_ctimer_inf* i) 47 | { 48 | int rc; 49 | unsigned khz; 50 | 51 | rc = ci_get_cpu_khz(&khz); 52 | if( rc < 0 ) return rc; 53 | 54 | i->hz = (ci_int64) khz * 1000u; 55 | ci_ctimer_calibrate(i); 56 | 57 | return 0; 58 | } 59 | 60 | /*! \cidoxg_end */ 61 | -------------------------------------------------------------------------------- /src/lib/ciapp/dump_select_set.c: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | /**************************************************************************\ 4 | *//*! \file 5 | ** 6 | ** \author djr 7 | ** \brief Dump contents of select set. 8 | ** \date 2005/01/12 9 | ** \cop (c) Level 5 Networks Limited. 10 | ** 11 | *//* 12 | \**************************************************************************/ 13 | 14 | /*! \cidoxg_lib_ciapp */ 15 | #include 16 | 17 | 18 | #define INLINE_BUF_SIZE 256 19 | 20 | 21 | void ci_dump_select_set(ci_log_fn_t log_fn, const fd_set* fds) 22 | { 23 | char stack_s[256]; 24 | char* s = stack_s; 25 | int i, n = 0, si; 26 | 27 | /* We assume the caller ain't too worried about performance. So we find 28 | ** out in advance whether we can format the string into [stack_s], or 29 | ** need to malloc() a buffer. 30 | */ 31 | for( i = 0; i < FD_SETSIZE; ++i ) 32 | if( FD_ISSET(i, fds) ) ++n; 33 | 34 | if( n * 4 + 3 >= INLINE_BUF_SIZE ) 35 | /* Hope this doesn't fail... */ 36 | CI_TEST(s = (char*) malloc(n * 4 + 3)); 37 | 38 | si = sprintf(s, "["); 39 | for( i = 0; i < FD_SETSIZE; ++i ) 40 | if( FD_ISSET(i, fds) ) 41 | si += sprintf(s + si, i ? " %d":"%d", i); 42 | 43 | ci_assert(s != stack_s || si < n * 4 + 3); 44 | log_fn(s); 45 | 46 | if( s != stack_s ) free(s); 47 | } 48 | 49 | /*! \cidoxg_end */ 50 | -------------------------------------------------------------------------------- /src/lib/ciapp/errno.c: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | /**************************************************************************\ 4 | *//*! \file 5 | ** 6 | ** \author 7 | ** \brief 8 | ** \date 9 | ** \cop (c) Level 5 Networks Limited. 10 | ** 11 | *//* 12 | \**************************************************************************/ 13 | 14 | /*! \cidoxg_lib_ciapp */ 15 | 16 | #include 17 | 18 | /* CI support for multi-platform error codes */ 19 | 20 | 21 | 22 | 23 | /* sockets */ 24 | ci_sock_err_t CI_SOCK_OK = { 0 }; 25 | ci_sock_err_t CI_SOCK_INVALID = { INVALID_SOCKET }; 26 | ci_sock_err_t CI_SOCK_EWOULDBLOCK = { EWOULDBLOCK }; 27 | ci_sock_err_t CI_SOCK_EMSGSIZE = { EMSGSIZE }; 28 | ci_sock_err_t CI_SOCK_ETIMEDOUT = { ETIMEDOUT }; 29 | ci_sock_err_t CI_SOCK_ECONNREFUSED = { ECONNREFUSED }; 30 | ci_sock_err_t CI_SOCK_ECONNABORTED = { ECONNABORTED }; 31 | ci_sock_err_t CI_SOCK_ENOBUFS = { ENOBUFS }; 32 | ci_sock_err_t CI_SOCK_EOPNOTSUPP = { EOPNOTSUPP }; 33 | 34 | 35 | /*! \cidoxg_end */ 36 | -------------------------------------------------------------------------------- /src/lib/ciapp/fork_filter.c: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | /**************************************************************************\ 4 | *//*! \file 5 | ** 6 | ** \author 7 | ** \brief 8 | ** \date 9 | ** \cop (c) Level 5 Networks Limited. 10 | ** 11 | *//* 12 | \**************************************************************************/ 13 | 14 | /*! \cidoxg_lib_ciapp */ 15 | 16 | 17 | #include 18 | #include 19 | 20 | 21 | int ci_fork_filter(char* const argv[]) 22 | { 23 | int fd[2], rc; 24 | 25 | CI_TRY_RET(pipe(fd)); 26 | CI_TRY_RET(rc = fork()); 27 | 28 | if( rc == 0 ) { /* child */ 29 | CI_TRY_RET(dup2(fd[1], STDOUT_FILENO)); 30 | CI_TRY_RET(close(fd[0])); 31 | CI_TRY_RET(close(fd[1])); 32 | CI_TRY_RET(execvp(argv[0], argv)); 33 | } 34 | else { /* parent */ 35 | CI_TRY_RET(dup2(fd[0], STDIN_FILENO)); 36 | CI_TRY_RET(close(fd[0])); 37 | CI_TRY_RET(close(fd[1])); 38 | } 39 | 40 | return 0; 41 | } 42 | 43 | 44 | /*! \cidoxg_end */ 45 | -------------------------------------------------------------------------------- /src/lib/ciapp/get_record.c: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | /**************************************************************************\ 4 | *//*! \file 5 | ** 6 | ** \author 7 | ** \brief 8 | ** \date 9 | ** \cop (c) Level 5 Networks Limited. 10 | ** 11 | *//* 12 | \**************************************************************************/ 13 | 14 | /*! \cidoxg_lib_ciapp */ 15 | 16 | #include 17 | 18 | 19 | int ci_app_get_record(int fileno, void* buf, int buf_len, size_t* bytes_out) 20 | { 21 | ci_uint32 rlen; 22 | int n; 23 | 24 | ci_assert(buf); 25 | ci_assert(buf_len > 0); 26 | ci_assert(bytes_out); 27 | 28 | n = ci_read_exact(fileno, &rlen, 4); 29 | if( n == 0 ) { 30 | *bytes_out = 0; 31 | return 0; 32 | } 33 | if( n != 4 ) return -1; 34 | 35 | rlen = CI_BSWAP_LE32(rlen); 36 | 37 | /* consume the record, and return error */ 38 | if( (int) rlen > buf_len ) { 39 | while( rlen ) { 40 | n = read(fileno, buf, buf_len); 41 | if( n <= 0 ) break; 42 | rlen -= n; 43 | } 44 | return -E2BIG; 45 | } 46 | 47 | if( ci_read_exact(fileno, buf, rlen) != (int) rlen ) return -1; 48 | 49 | *bytes_out = rlen; 50 | return 0; 51 | } 52 | 53 | /*! \cidoxg_end */ 54 | -------------------------------------------------------------------------------- /src/lib/ciapp/iarray_mean_and_limits.c: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | /**************************************************************************\ 4 | *//*! \file 5 | ** 6 | ** \author 7 | ** \brief 8 | ** \date 9 | ** \cop (c) Level 5 Networks Limited. 10 | ** 11 | *//* 12 | \**************************************************************************/ 13 | 14 | /*! \cidoxg_lib_ciapp */ 15 | 16 | #include 17 | 18 | 19 | void ci_iarray_mean_and_limits(const int* start, const int* end, 20 | int* mean_out, int* min_out, int* max_out) 21 | { 22 | int min, max; 23 | ci_int64 sum; 24 | const int* i; 25 | 26 | ci_iarray_assert_valid(start, end); 27 | ci_assert(end - start > 0); 28 | 29 | sum = 0; 30 | min = max = *start; 31 | 32 | for( i = start; i != end; ++i ) { 33 | if( *i < min ) min = *i; 34 | else 35 | if( *i > max ) max = *i; 36 | sum += *i; 37 | } 38 | 39 | if( mean_out ) *mean_out = (int) (sum / (end - start)); 40 | if( min_out ) *min_out = min; 41 | if( max_out ) *max_out = max; 42 | } 43 | 44 | /*! \cidoxg_end */ 45 | -------------------------------------------------------------------------------- /src/lib/ciapp/iarray_median.c: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | /**************************************************************************\ 4 | *//*! \file 5 | ** 6 | ** \author 7 | ** \brief 8 | ** \date 9 | ** \cop (c) Level 5 Networks Limited. 10 | ** 11 | *//* 12 | \**************************************************************************/ 13 | 14 | /*! \cidoxg_lib_ciapp */ 15 | 16 | #include 17 | 18 | 19 | void ci_iarray_median(const int* start, const int* end, int* median_out) 20 | { 21 | ci_iarray_assert_valid(start, end); 22 | ci_assert(end - start > 0); 23 | ci_iarray_assert_sorted(start, end); 24 | 25 | if( (end - start) & 1 ) 26 | *median_out = start[(end - start) / 2]; 27 | else 28 | *median_out = (start[(end-start)/2] + start[(end-start)/2-1]) / 2; 29 | } 30 | 31 | /*! \cidoxg_end */ 32 | -------------------------------------------------------------------------------- /src/lib/ciapp/iarray_mode.c: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | /**************************************************************************\ 4 | *//*! \file 5 | ** 6 | ** \author 7 | ** \brief 8 | ** \date 9 | ** \cop (c) Level 5 Networks Limited. 10 | ** 11 | *//* 12 | \**************************************************************************/ 13 | 14 | /*! \cidoxg_lib_ciapp */ 15 | 16 | #include 17 | 18 | 19 | void ci_iarray_mode(const int* start, const int* end, int* mode_out) 20 | { 21 | int current_v, mode, current_n, mode_n; 22 | const int* i; 23 | 24 | ci_iarray_assert_valid(start, end); 25 | ci_assert(end - start > 0); 26 | ci_assert(mode_out); 27 | 28 | current_v = mode = *start; 29 | current_n = mode_n = 1; 30 | 31 | for( i = start + 1; i != end; ++i ) { 32 | if( *i != current_v ) { 33 | if( current_n > mode_n ) { 34 | mode_n = current_n; 35 | mode = current_v; 36 | } 37 | current_v = *i; 38 | current_n = 0; 39 | } 40 | ++current_n; 41 | } 42 | if( current_n > mode_n ) { 43 | mode_n = current_n; 44 | mode = current_v; 45 | } 46 | 47 | *mode_out = mode; 48 | } 49 | 50 | /*! \cidoxg_end */ 51 | -------------------------------------------------------------------------------- /src/lib/ciapp/iarray_variance.c: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | /**************************************************************************\ 4 | *//*! \file 5 | ** 6 | ** \author 7 | ** \brief 8 | ** \date 9 | ** \cop (c) Level 5 Networks Limited. 10 | ** 11 | *//* 12 | \**************************************************************************/ 13 | 14 | /*! \cidoxg_lib_ciapp */ 15 | 16 | #include 17 | 18 | 19 | void ci_iarray_variance(const int* start, const int* end, 20 | int mean, ci_int64* variance_out) 21 | { 22 | ci_int64 sumsq, diff; 23 | const int* i; 24 | 25 | ci_iarray_assert_valid(start, end); 26 | ci_assert(end - start > 0); 27 | ci_assert(variance_out); 28 | 29 | if( end - start < 2 ) { 30 | *variance_out = 0; 31 | return; 32 | } 33 | 34 | sumsq = 0; 35 | 36 | for( i = start; i != end; ++i ) { 37 | diff = *i - mean; 38 | sumsq += diff * diff; 39 | } 40 | 41 | *variance_out = sumsq / (end - start - 1); 42 | } 43 | 44 | /*! \cidoxg_end */ 45 | -------------------------------------------------------------------------------- /src/lib/ciapp/mmake.mk: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-2.0 2 | # X-SPDX-Copyright-Text: (c) Solarflare Communications Inc 3 | 4 | TARGET := $(CIAPP_LIB) 5 | MMAKE_TYPE := LIB 6 | 7 | LIB_SRCS := \ 8 | testapp.c \ 9 | net.c \ 10 | bytepattern.c \ 11 | ctimer.c \ 12 | stats.c \ 13 | iarray_mean_and_limits.c \ 14 | iarray_median.c \ 15 | iarray_mode.c \ 16 | iarray_variance.c \ 17 | qsort_compare_int.c \ 18 | testpattern.c \ 19 | select.c \ 20 | errno.c \ 21 | read_exact.c \ 22 | write_exact.c \ 23 | recv_exact.c \ 24 | getinput.c \ 25 | put_record.c \ 26 | get_record.c \ 27 | testethpkt.c \ 28 | rawpkt.c \ 29 | fork_filter.c \ 30 | dump_select_set.c \ 31 | rate_thread.c \ 32 | sys_info.c \ 33 | dummy_work.c \ 34 | dump_tcp_info.c \ 35 | onload_info.c 36 | 37 | ifeq ($(LINUX),1) 38 | LIB_SRCS += ifindex.c 39 | endif 40 | 41 | 42 | MMAKE_OBJ_PREFIX := ci_app_ 43 | LIB_OBJS := $(LIB_SRCS:%.c=$(MMAKE_OBJ_PREFIX)%.o) 44 | 45 | 46 | all: $(TARGET) 47 | 48 | lib: $(TARGET) 49 | 50 | clean: 51 | @$(MakeClean) 52 | 53 | 54 | $(TARGET): $(LIB_OBJS) 55 | $(MMakeLinkStaticLib) 56 | 57 | -------------------------------------------------------------------------------- /src/lib/ciapp/put_record.c: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | /**************************************************************************\ 4 | *//*! \file 5 | ** 6 | ** \author 7 | ** \brief 8 | ** \date 9 | ** \cop (c) Level 5 Networks Limited. 10 | ** 11 | *//* 12 | \**************************************************************************/ 13 | 14 | /*! \cidoxg_lib_ciapp */ 15 | 16 | #include 17 | 18 | 19 | int ci_app_put_record(int fileno, const void* buf, int bytes) 20 | { 21 | ci_uint32 rlen; 22 | 23 | ci_assert(buf); 24 | ci_assert(bytes >= 0); 25 | 26 | rlen = CI_BSWAP_LE32(bytes); 27 | if( ci_write_exact(fileno, &rlen, 4) != 4 || 28 | ci_write_exact(fileno, buf, bytes) != bytes ) 29 | return -errno; 30 | 31 | return 0; 32 | } 33 | 34 | /*! \cidoxg_end */ 35 | -------------------------------------------------------------------------------- /src/lib/ciapp/qsort_compare_int.c: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | /**************************************************************************\ 4 | *//*! \file 5 | ** 6 | ** \author 7 | ** \brief 8 | ** \date 9 | ** \cop (c) Level 5 Networks Limited. 10 | ** 11 | *//* 12 | \**************************************************************************/ 13 | 14 | /*! \cidoxg_lib_ciapp */ 15 | 16 | #include 17 | 18 | 19 | int ci_qsort_compare_int(const void* pa, const void* pb) 20 | { 21 | ci_assert(pa); ci_assert(pb); 22 | 23 | return *(int*) pa - *(int*) pb; 24 | } 25 | 26 | /*! \cidoxg_end */ 27 | 28 | -------------------------------------------------------------------------------- /src/lib/ciapp/rate_thread.c: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | /**************************************************************************\ 4 | *//*! \file 5 | ** 6 | ** \author djr 7 | ** \brief Thread function to measure rate of change. 8 | ** \date 2004/12/06 9 | ** \cop (c) Level 5 Networks Limited. 10 | ** 11 | *//* 12 | \**************************************************************************/ 13 | 14 | /*! \cidoxg_lib_ciapp */ 15 | #include 16 | 17 | void* ci_rate_thread_fn(void* p_ci_rate_thread_cfg) 18 | { 19 | ci_rate_thread_cfg* cfg = (ci_rate_thread_cfg*) p_ci_rate_thread_cfg; 20 | struct timeval t_now, t_prev; 21 | unsigned val_now = 0, val_prev = 0, ms; 22 | 23 | gettimeofday(&t_prev, 0); 24 | if( cfg->pval ) val_prev = *cfg->pval; 25 | 26 | while( 1 ) { 27 | ci_sleep(cfg->interval_msec); 28 | if( cfg->stop ) break; 29 | 30 | gettimeofday(&t_now, 0); 31 | if( cfg->pval ) val_now = *cfg->pval; 32 | 33 | ms = (t_now.tv_sec - t_prev.tv_sec) * 1000; 34 | ms += (t_now.tv_usec - t_prev.tv_usec) / 1000; 35 | 36 | cfg->action(cfg, val_now, val_prev, ms); 37 | 38 | t_prev = t_now; 39 | val_prev = val_now; 40 | } 41 | 42 | return 0; 43 | } 44 | 45 | /*! \cidoxg_end */ 46 | -------------------------------------------------------------------------------- /src/lib/ciapp/read_exact.c: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | /**************************************************************************\ 4 | *//*! \file 5 | ** 6 | ** \author 7 | ** \brief 8 | ** \date 9 | ** \cop (c) Level 5 Networks Limited. 10 | ** 11 | *//* 12 | \**************************************************************************/ 13 | 14 | /*! \cidoxg_lib_ciapp */ 15 | 16 | #include 17 | 18 | 19 | int ci_read_exact(int fileno, void* buf, int bytes) 20 | { 21 | int n = 0, rc; 22 | 23 | ci_assert(buf); 24 | ci_assert(bytes >= 0); 25 | 26 | while( bytes ) { 27 | rc = read(fileno, buf, bytes); 28 | if( rc <= 0 ) return n; 29 | 30 | buf = (char*) buf + rc; 31 | n += rc; 32 | bytes -= rc; 33 | } 34 | 35 | return n; 36 | } 37 | 38 | /*! \cidoxg_end */ 39 | -------------------------------------------------------------------------------- /src/lib/ciapp/recv_exact.c: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | /**************************************************************************\ 4 | *//*! \file 5 | ** 6 | ** \author djr 7 | ** \brief Receive an exact number of bytes from a socket. 8 | ** \date 2004/12/06 9 | ** \cop (c) Level 5 Networks Limited. 10 | ** 11 | *//* 12 | \**************************************************************************/ 13 | 14 | /*! \cidoxg_lib_ciapp */ 15 | 16 | #include 17 | 18 | 19 | int ci_recv_exact(int sock, void* buf, size_t len, int flags) 20 | { 21 | int n = 0, rc; 22 | 23 | ci_assert(buf); 24 | ci_assert(len >= 0); 25 | 26 | while( len ) { 27 | rc = recv(sock, buf, len, flags); 28 | if( rc <= 0 ) return n; 29 | 30 | buf = (char*) buf + rc; 31 | n += rc; 32 | len -= rc; 33 | } 34 | 35 | return n; 36 | } 37 | 38 | /*! \cidoxg_end */ 39 | -------------------------------------------------------------------------------- /src/lib/ciapp/stats.c: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | /**************************************************************************\ 4 | *//*! \file 5 | ** 6 | ** \author 7 | ** \brief 8 | ** \date 9 | ** \cop (c) Level 5 Networks Limited. 10 | ** 11 | *//* 12 | \**************************************************************************/ 13 | 14 | /*! \cidoxg_lib_ciapp */ 15 | 16 | #include 17 | 18 | 19 | #if CI_INCLUDE_ASSERT_VALID 20 | void ci_iarray_assert_valid(const int* start, const int* end) 21 | { 22 | ci_assert(start); 23 | ci_assert(end); 24 | ci_assert((((char*) end - (char*) start) & (sizeof(*start) - 1)) == 0); 25 | } 26 | 27 | 28 | void ci_iarray_assert_sorted(const int* start, const int* end) 29 | { 30 | while( start + 1 != end ) 31 | ci_assert(start[0] <= start[1]); 32 | } 33 | #endif 34 | 35 | /*! \cidoxg_end */ 36 | -------------------------------------------------------------------------------- /src/lib/ciapp/write_exact.c: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | /**************************************************************************\ 4 | *//*! \file 5 | ** 6 | ** \author 7 | ** \brief 8 | ** \date 9 | ** \cop (c) Level 5 Networks Limited. 10 | ** 11 | *//* 12 | \**************************************************************************/ 13 | 14 | /*! \cidoxg_lib_ciapp */ 15 | 16 | #include 17 | 18 | 19 | int ci_write_exact(int fileno, const void* buf, int bytes) 20 | { 21 | int n = 0, rc; 22 | 23 | ci_assert(buf); 24 | ci_assert(bytes >= 0); 25 | 26 | while( bytes ) { 27 | rc = write(fileno, buf, bytes); 28 | if( rc <= 0 ) return n; 29 | 30 | buf = (const char*) buf + rc; 31 | n += rc; 32 | bytes -= rc; 33 | } 34 | 35 | return n; 36 | } 37 | 38 | /*! \cidoxg_end */ 39 | -------------------------------------------------------------------------------- /src/lib/citools/buffer.c: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | /**************************************************************************\ 4 | *//*! \file 5 | ** 6 | ** \author 7 | ** \brief 8 | ** \date 9 | ** \cop (c) Level 5 Networks Limited. 10 | ** 11 | *//* 12 | \**************************************************************************/ 13 | 14 | /*! \cidoxg_lib_citools */ 15 | 16 | #include "citools_internal.h" 17 | 18 | 19 | #if CI_INCLUDE_ASSERT_VALID 20 | void ci_buffer_assert_valid(ci_buffer* b) 21 | { 22 | ci_assert(b); 23 | ci_assert(b->ptr <= b->end); 24 | } 25 | #endif 26 | 27 | /*! \cidoxg_end */ 28 | -------------------------------------------------------------------------------- /src/lib/citools/bufrange.c: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | /**************************************************************************\ 4 | *//*! \file 5 | ** 6 | ** \author 7 | ** \brief 8 | ** \date 9 | ** \cop (c) Level 5 Networks Limited. 10 | ** 11 | *//* 12 | \**************************************************************************/ 13 | 14 | /*! \cidoxg_lib_citools */ 15 | 16 | #include "citools_internal.h" 17 | 18 | 19 | #if CI_INCLUDE_ASSERT_VALID 20 | void ci_bufrange_assert_valid(ci_bufrange* b) 21 | { 22 | ci_assert(b); 23 | ci_assert(b->start <= b->ptr); 24 | ci_assert(b->ptr <= b->end); 25 | } 26 | #endif 27 | 28 | /*! \cidoxg_end */ 29 | -------------------------------------------------------------------------------- /src/lib/citools/cithread.c: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | /**************************************************************************\ 4 | *//*! \file 5 | ** 6 | ** \author 7 | ** \brief 8 | ** \date 9 | ** \cop (c) Level 5 Networks Limited. 10 | ** 11 | *//* 12 | \**************************************************************************/ 13 | 14 | /*! \cidoxg_lib_citools */ 15 | 16 | #include "citools_internal.h" 17 | 18 | 19 | 20 | /*! \cidoxg_end */ 21 | -------------------------------------------------------------------------------- /src/lib/citools/citools_internal.h: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | /**************************************************************************\ 4 | *//*! \file 5 | ** 6 | ** \author 7 | ** \brief 8 | ** \date 9 | ** \cop (c) Level 5 Networks Limited. 10 | ** 11 | *//* 12 | \**************************************************************************/ 13 | 14 | /*! \cidoxg_lib_citools */ 15 | 16 | #ifndef __INTERNAL_H__ 17 | #define __INTERNAL_H__ 18 | 19 | 20 | #include 21 | #include 22 | 23 | 24 | extern const char* ci_log_prefix CI_HF; 25 | 26 | 27 | #endif /* __INTERNAL_H__ */ 28 | 29 | /*! \cidoxg_end */ 30 | -------------------------------------------------------------------------------- /src/lib/citools/crc16.c: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | /**************************************************************************\ 4 | *//*! \file 5 | ** 6 | ** \author 7 | ** \brief 8 | ** \date 9 | ** \cop (c) Level 5 Networks Limited. 10 | ** 11 | *//* 12 | \**************************************************************************/ 13 | 14 | /*! \cidoxg_lib_citools */ 15 | 16 | #include "citools_internal.h" 17 | 18 | 19 | /* 20 | ** 16-bit CRCs: 21 | ** 22 | ** http://www.monitor-computing.pwp.blueyonder.co.uk/projects/crc16/ 23 | ** http://www.repairfaq.org/filipg/LINK/F_crc_v35.html 24 | ** http://www.geocities.com/SiliconValley/Pines/6639/docs/crc.html 25 | ** http://www.microconsultants.com/tips/crc/crc.txt 26 | ** http://www.ross.net/crc/ 27 | */ 28 | 29 | 30 | unsigned ci_crc16_add8(unsigned old_crc, unsigned poly, unsigned data) 31 | { 32 | int i = 8; 33 | 34 | old_crc ^= (data << 8u); 35 | 36 | while( i-- ) { 37 | if( old_crc & 0x8000 ) old_crc = (old_crc << 1u) ^ poly; 38 | else old_crc <<= 1u; 39 | } 40 | 41 | return old_crc; 42 | } 43 | 44 | /*! \cidoxg_end */ 45 | -------------------------------------------------------------------------------- /src/lib/citools/csum_copy2.c: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | /**************************************************************************\ 4 | *//*! \file 5 | ** 6 | ** \author djr 7 | ** \brief Data copy with Internet checksum. 8 | ** \date 2004/01/06 9 | ** \cop (c) Level 5 Networks Limited. 10 | ** 11 | *//* 12 | \**************************************************************************/ 13 | 14 | /*! \cidoxg_lib_citools */ 15 | 16 | #include "citools_internal.h" 17 | 18 | 19 | typedef union { 20 | ci_uint16 u16; 21 | char c[2]; 22 | } ci_uint16_bytes; 23 | 24 | 25 | /* Length must be a multiple of half-words */ 26 | unsigned ci_ip_csum_copy2(void* dest, const void* src, int n, unsigned sum) 27 | { 28 | ci_uint32* d4 = (ci_uint32*) dest; 29 | const ci_uint32 *es4, *s4 = (const ci_uint32*) src; 30 | ci_uint32 v; 31 | 32 | ci_assert(dest || n == 0); 33 | ci_assert(src || n == 0); 34 | ci_assert(n >= 0); 35 | ci_assert(CI_OFFSET(n, 2) == 0); 36 | 37 | es4 = s4 + (n >> 2); 38 | 39 | while( s4 != es4 ) { 40 | *d4++ = v = *s4++; 41 | ci_add_carry32(sum, v); 42 | } 43 | 44 | if( n & 2 ) { 45 | v = *(const ci_uint16*) s4; 46 | ci_add_carry32(sum, v); 47 | *(ci_uint16*) d4 = v; 48 | } 49 | 50 | return sum; 51 | } 52 | 53 | /*! \cidoxg_end */ 54 | -------------------------------------------------------------------------------- /src/lib/citools/dllist.c: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | /**************************************************************************\ 4 | *//*! \file 5 | ** 6 | ** \author 7 | ** \brief 8 | ** \date 9 | ** \cop (c) Level 5 Networks Limited. 10 | ** 11 | *//* 12 | \**************************************************************************/ 13 | 14 | /*! \cidoxg_lib_citools */ 15 | 16 | #include "citools_internal.h" 17 | 18 | 19 | #if CI_INCLUDE_ASSERT_VALID 20 | void ci_dllist_assert_valid(ci_dllist* list) 21 | { 22 | ci_dllink* l; 23 | 24 | ci_assert(list); 25 | ci_assert(list->l.next); 26 | ci_assert(list->l.prev); 27 | 28 | for( l = list->l.next; l != &list->l; l = l->next ) { 29 | ci_assert(l); 30 | ci_assert(l->prev); 31 | } 32 | } 33 | #endif 34 | 35 | /*! \cidoxg_end */ 36 | -------------------------------------------------------------------------------- /src/lib/citools/drv_log_fn.c: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | /**************************************************************************\ 4 | *//*! \file 5 | ** 6 | ** \author 7 | ** \brief 8 | ** \date 9 | ** \cop (c) Level 5 Networks Limited. 10 | ** 11 | *//* 12 | \**************************************************************************/ 13 | 14 | /*! \cidoxg_lib_citools */ 15 | 16 | #include "citools_internal.h" 17 | 18 | 19 | 20 | #include 21 | #include 22 | 23 | void ci_log_syslog(const char* msg) 24 | { 25 | printk(KERN_ERR "%s\n", msg); 26 | } 27 | 28 | 29 | 30 | /*! \cidoxg_end */ 31 | -------------------------------------------------------------------------------- /src/lib/citools/eth_addr.c: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | /**************************************************************************\ 4 | *//*! \file 5 | ** 6 | ** \author 7 | ** \brief 8 | ** \date 9 | ** \cop (c) Level 5 Networks Limited. 10 | ** 11 | *//* 12 | \**************************************************************************/ 13 | 14 | /*! \cidoxg_lib_citools */ 15 | 16 | #include "citools_internal.h" 17 | 18 | 19 | int ci_format_eth_addr(char* buf, const void* eth_mac_addr, char sep) 20 | { 21 | const unsigned char* p; 22 | p = (const unsigned char*) eth_mac_addr; 23 | 24 | ci_assert(buf); 25 | ci_assert(eth_mac_addr); 26 | 27 | if( sep == 0 ) sep = ':'; 28 | 29 | return ci_sprintf(buf, "%02X%c%02X%c%02X%c%02X%c%02X%c%02X", 30 | (unsigned) p[0], sep, (unsigned) p[1], sep, 31 | (unsigned) p[2], sep, (unsigned) p[3], sep, 32 | (unsigned) p[4], sep, (unsigned) p[5]); 33 | } 34 | 35 | /*! \cidoxg_end */ 36 | -------------------------------------------------------------------------------- /src/lib/citools/internal.h: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | /**************************************************************************\ 4 | *//*! \file 5 | ** 6 | ** \author 7 | ** \brief 8 | ** \date 9 | ** \cop (c) Level 5 Networks Limited. 10 | ** 11 | *//* 12 | \**************************************************************************/ 13 | 14 | /*! \cidoxg_lib_citools */ 15 | 16 | #ifndef __INTERNAL_H__ 17 | #define __INTERNAL_H__ 18 | 19 | 20 | #include 21 | #include 22 | 23 | 24 | extern const char* ci_log_prefix CI_HF; 25 | 26 | 27 | #endif /* __INTERNAL_H__ */ 28 | 29 | /*! \cidoxg_end */ 30 | -------------------------------------------------------------------------------- /src/lib/citools/ip_addr.c: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | /**************************************************************************\ 4 | *//*! \file 5 | ** 6 | ** \author 7 | ** \brief 8 | ** \date 9 | ** \cop (c) Level 5 Networks Limited. 10 | ** 11 | *//* 12 | \**************************************************************************/ 13 | 14 | /*! \cidoxg_lib_citools */ 15 | 16 | #include 17 | #include "citools_internal.h" 18 | 19 | 20 | int ci_format_ip4_addr(char* buf, unsigned addr_be32) 21 | { 22 | const unsigned char* p; 23 | p = (const unsigned char*) &addr_be32; 24 | 25 | ci_assert(buf); 26 | 27 | return ci_sprintf(buf, "%u.%u.%u.%u", 28 | (unsigned) p[0], (unsigned) p[1], 29 | (unsigned) p[2], (unsigned) p[3]); 30 | } 31 | 32 | /*! \cidoxg_end */ 33 | -------------------------------------------------------------------------------- /src/lib/citools/ip_csum_partial.c: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | /**************************************************************************\ 4 | *//*! \file 5 | ** 6 | ** \author djr 7 | ** \brief Compute Internet checksums. 8 | ** \date 2003/01/05 9 | ** \cop (c) Level 5 Networks Limited. 10 | ** 11 | *//* 12 | \**************************************************************************/ 13 | 14 | /*! \cidoxg_lib_citools */ 15 | 16 | #include "citools_internal.h" 17 | #include 18 | 19 | 20 | unsigned ci_ip_csum_partial(unsigned sum, const volatile void* in_buf, 21 | int bytes) 22 | { 23 | const ci_uint16* buf = (const ci_uint16*) in_buf; 24 | 25 | ci_assert(in_buf || bytes == 0); 26 | ci_assert(bytes >= 0); 27 | 28 | while( bytes > 1 ) { 29 | sum += *buf++; 30 | bytes -= 2; 31 | } 32 | 33 | /* If there's a lone final byte, it needs to be treated as if it was 34 | * padded by an extra zero byte. Casting to ci_uint8* introduces an 35 | * implicit CI_BSWAP_LE16 which needs to be reversed. */ 36 | sum += bytes ? CI_BSWAP_LE16(*(ci_uint8*) buf) : 0; 37 | 38 | return sum; 39 | } 40 | 41 | /*! \cidoxg_end */ 42 | -------------------------------------------------------------------------------- /src/lib/citools/ip_csum_precompute.c: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | /**************************************************************************\ 4 | *//*! \file 5 | ** 6 | ** \author djr 7 | ** \brief Precompute partial checksum for IP header. 8 | ** \date 2004/01/21 9 | ** \cop (c) Level 5 Networks Limited. 10 | ** 11 | *//* 12 | \**************************************************************************/ 13 | 14 | /*! \cidoxg_lib_citools */ 15 | 16 | #include "citools_internal.h" 17 | #include 18 | 19 | 20 | unsigned ci_ip_csum_precompute(const ci_ip4_hdr* ip) 21 | { 22 | const ci_uint16* p = (const ci_uint16*) ip; 23 | unsigned csum; 24 | 25 | ci_assert(ip); 26 | ci_assert(CI_PTR_OFFSET(ip, 4) == 0); 27 | 28 | csum = p[0]; /* ip_ihl_version, ip_tos */ 29 | csum += p[3]; /* ip_frag_off_be16 */ 30 | csum += p[4]; /* ip_ttl, ip_protocol */ 31 | csum += p[6]; /* ip_saddr_be32 */ 32 | csum += p[7]; 33 | csum += p[8]; /* ip_daddr_be32 */ 34 | csum += p[9]; 35 | return csum; 36 | } 37 | 38 | /*! \cidoxg_end */ 39 | -------------------------------------------------------------------------------- /src/lib/citools/log_file.c: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | /**************************************************************************\ 4 | *//*! \file 5 | ** 6 | ** \author 7 | ** \brief 8 | ** \date 9 | ** \cop (c) Level 5 Networks Limited. 10 | ** 11 | *//* 12 | \**************************************************************************/ 13 | 14 | /*! \cidoxg_lib_citools */ 15 | 16 | #include "citools_internal.h" 17 | 18 | # include 19 | 20 | int ci_log_file_fd = STDERR_FILENO; 21 | 22 | 23 | 24 | void ci_log_file(const char* msg) 25 | { 26 | struct iovec v[2]; 27 | 28 | v[0].iov_base = (void*) msg; 29 | v[0].iov_len = strlen(msg); 30 | v[1].iov_base = "\n"; 31 | v[1].iov_len = 1; 32 | 33 | writev(ci_log_file_fd, v, 2); 34 | } 35 | 36 | /*! \cidoxg_end */ 37 | -------------------------------------------------------------------------------- /src/lib/citools/log_fn.c: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | /**************************************************************************\ 4 | *//*! \file 5 | ** 6 | ** \author 7 | ** \brief 8 | ** \date 9 | ** \cop (c) Level 5 Networks Limited. 10 | ** 11 | *//* 12 | \**************************************************************************/ 13 | 14 | /*! \cidoxg_lib_citools */ 15 | #include "citools_internal.h" 16 | 17 | #include 18 | 19 | # include 20 | 21 | 22 | void ci_log_stderr(const char* msg) 23 | { 24 | struct iovec v[2]; 25 | 26 | v[0].iov_base = (void*) msg; 27 | v[0].iov_len = strlen(msg); 28 | v[1].iov_base = (char*) "\n"; 29 | v[1].iov_len = 1; 30 | 31 | writev(STDERR_FILENO, v, 2); 32 | } 33 | 34 | 35 | void ci_log_stdout(const char* msg) 36 | { 37 | struct iovec v[2]; 38 | 39 | v[0].iov_base = (void*) msg; 40 | v[0].iov_len = strlen(msg); 41 | v[1].iov_base = (char*) "\n"; 42 | v[1].iov_len = 1; 43 | 44 | writev(STDOUT_FILENO, v, 2); 45 | } 46 | 47 | 48 | void ci_log_syslog(const char* msg) 49 | { 50 | syslog(LOG_INFO, "%s\n", msg); 51 | } 52 | 53 | 54 | void ci_log_null(const char* msg) 55 | { 56 | } 57 | 58 | /*! \cidoxg_end */ 59 | -------------------------------------------------------------------------------- /src/lib/citools/log_nth.c: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | /**************************************************************************\ 4 | *//*! \file 5 | ** 6 | ** \author 7 | ** \brief 8 | ** \date 9 | ** \cop (c) Level 5 Networks Limited. 10 | ** 11 | *//* 12 | \**************************************************************************/ 13 | 14 | /*! \cidoxg_lib_citools */ 15 | 16 | #include "citools_internal.h" 17 | 18 | #ifndef CI_LOG_FN_DEFAULT 19 | # define CI_LOG_FN_DEFAULT ci_log_stderr 20 | #endif 21 | 22 | void (*__ci_log_nth_fn)(const char* msg) = CI_LOG_FN_DEFAULT; 23 | int ci_log_nth_n = 100; 24 | 25 | 26 | void __ci_log_nth(const char* msg) 27 | { 28 | static int n = 0; 29 | 30 | /* Avoid the obvious loop. Other loops possible though... */ 31 | if( __ci_log_nth_fn == ci_log_fn ) return; 32 | 33 | if( n % ci_log_nth_n == 0 ) __ci_log_nth_fn(msg); 34 | ++n; 35 | } 36 | 37 | /*! \cidoxg_end */ 38 | -------------------------------------------------------------------------------- /src/lib/citools/sys_fail.c: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | /**************************************************************************\ 4 | *//*! \file 5 | ** 6 | ** \author 7 | ** \brief 8 | ** \date 9 | ** \cop (c) Level 5 Networks Limited. 10 | ** 11 | *//* 12 | \**************************************************************************/ 13 | 14 | /*! \cidoxg_lib_citools */ 15 | 16 | #include "citools_internal.h" 17 | 18 | 19 | void __ci_sys_fail(const char* fn, int rc, const char* file, int line) 20 | { 21 | ci_log("*** UNEXPECTED ERROR ***"); 22 | ci_log(" what: %s", fn); 23 | ci_log(" called from: %s:%d", file, line); 24 | ci_log(" return code: %d", rc); 25 | #ifndef __KERNEL__ 26 | ci_log(" errno: %d", errno); 27 | ci_log(" strerror: %s", strerror(errno)); 28 | #endif 29 | ci_fail((" ")); 30 | } 31 | 32 | /*! \cidoxg_end */ 33 | -------------------------------------------------------------------------------- /src/lib/citools/udp_checksum.c: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | /**************************************************************************\ 4 | *//*! \file 5 | ** 6 | ** \author djr 7 | ** \brief Compute Internet checksums. 8 | ** \date 2003/01/05 9 | ** \cop (c) Level 5 Networks Limited. 10 | ** 11 | *//* 12 | \**************************************************************************/ 13 | 14 | /*! \cidoxg_lib_citools */ 15 | 16 | #include "citools_internal.h" 17 | #include 18 | #include 19 | 20 | unsigned ci_udp_checksum(const ci_ip4_hdr* ip, const ci_udp_hdr* udp, 21 | const ci_iovec *iov, int iovlen) 22 | { 23 | return ef_udp_checksum((struct iphdr*)ip, (struct udphdr*)udp, iov, iovlen); 24 | } 25 | 26 | unsigned ci_ip6_udp_checksum(const ci_ip6_hdr* ip6, const ci_udp_hdr* udp, 27 | const ci_iovec *iov, int iovlen) 28 | { 29 | return ef_udp_checksum_ip6(ip6, (struct udphdr*)udp, iov, iovlen); 30 | } 31 | 32 | /*! \cidoxg_end */ 33 | -------------------------------------------------------------------------------- /src/lib/citools/udp_csum_precompute.c: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | /**************************************************************************\ 4 | *//*! \file 5 | ** 6 | ** \author djr 7 | ** \brief Precompute partial checksum for UDP packet. 8 | ** \date 2004/01/21 9 | ** \cop (c) Level 5 Networks Limited. 10 | ** 11 | *//* 12 | \**************************************************************************/ 13 | 14 | /*! \cidoxg_lib_citools */ 15 | 16 | #include "citools_internal.h" 17 | #include 18 | 19 | 20 | unsigned ci_udp_csum_precompute(const ci_ip4_hdr* ip, const ci_udp_hdr* udp) 21 | { 22 | ci_ip4_pseudo_hdr ph; 23 | const ci_uint16* p; 24 | unsigned csum; 25 | 26 | ci_assert(ip); 27 | ci_assert(udp); 28 | ci_assert(CI_PTR_OFFSET(ip, 4) == 0); 29 | ci_assert(CI_PTR_OFFSET(udp, 4) == 0); 30 | 31 | p = (const ci_uint16*) ip; 32 | csum = p[6]; /* ip_saddr_be32 */ 33 | csum += p[7]; 34 | csum += p[8]; /* ip_daddr_be32 */ 35 | csum += p[9]; 36 | ph.zero = 0; 37 | ph.ip_protocol = IPPROTO_UDP; 38 | p = (const ci_uint16*) &ph; 39 | csum += p[4]; /* zero, ip_protocol */ 40 | 41 | csum += udp->udp_source_be16; 42 | csum += udp->udp_dest_be16; 43 | 44 | return csum; 45 | } 46 | 47 | /*! \cidoxg_end */ 48 | -------------------------------------------------------------------------------- /src/lib/ciul/ef10_hw_defs.h: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: LGPL-2.1 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | #ifndef EF10_HW_DEFS_H 4 | #define EF10_HW_DEFS_H 5 | 6 | #include 7 | 8 | #endif /* EF10_HW_DEFS_H */ 9 | -------------------------------------------------------------------------------- /src/lib/ciul/ef_vi_ef10.h: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: LGPL-2.1 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | 4 | #ifndef __EF_VI_EF10_H__ 5 | #define __EF_VI_EF10_H__ 6 | 7 | #include "ef10_hw_defs.h" 8 | #include 9 | 10 | #endif /* __EF_VI_EF10_H__ */ 11 | -------------------------------------------------------------------------------- /src/lib/ciul/event_q_put.c: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: LGPL-2.1 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | /**************************************************************************\ 4 | *//*! \file 5 | ** 6 | ** \author djr 7 | ** \brief ef_eventq_put() 8 | ** \date 2004/05/20 9 | ** \cop (c) Level 5 Networks Limited. 10 | ** 11 | *//* 12 | \**************************************************************************/ 13 | 14 | /*! \cidoxg_lib_ef */ 15 | #include "ef_vi_internal.h" 16 | #include "driver_access.h" 17 | #include 18 | 19 | 20 | int ef_eventq_put(unsigned evq_id, ef_driver_handle fd, unsigned ev) 21 | { 22 | ci_resource_op_t op; 23 | int64_t ev64; 24 | 25 | EF_VI_BUG_ON((ev & EFVI_FALCON_EVENT_SW_DATA_MASK) != ev); 26 | ev64 = ev; 27 | 28 | op.op = CI_RSOP_EVENTQ_PUT; 29 | op.id = efch_make_resource_id(evq_id); 30 | op.u.evq_put.ev = cpu_to_le64(ev64); 31 | return ci_resource_op(fd, &op); 32 | } 33 | -------------------------------------------------------------------------------- /src/lib/ciul/logging.h: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: LGPL-2.1 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | /**************************************************************************\ 4 | *//*! \file 5 | ** 6 | ** \author stg 7 | ** \brief Logging functions. 8 | ** \date 2007/05/18 9 | ** \cop (c) Solarflare Communications Inc. 10 | ** 11 | *//* 12 | \**************************************************************************/ 13 | 14 | /*! \cidoxg_include_ci_ul */ 15 | #ifndef __EF_VI_LOGGING_H__ 16 | #define __EF_VI_LOGGING_H__ 17 | 18 | 19 | #if !defined(__KERNEL__) 20 | extern int ef_log_level; 21 | #endif 22 | 23 | extern __printf(1, 2) void ef_log(const char* fmt, ...); 24 | 25 | #ifdef __KERNEL__ 26 | # define EF_VI_LOG(l,x) 27 | #else 28 | # define EF_VI_LOG(l,x) do{ if(unlikely(ef_log_level>=(l))) {x;} }while(0) 29 | #endif 30 | 31 | #define LOGAV(x) EF_VI_LOG(1,x) 32 | #ifdef NDEBUG 33 | # define LOG(x) 34 | # define LOGV(x) 35 | # define LOGVV(x) 36 | # define LOGVVV(x) 37 | #else 38 | # define LOG(x) do { x; } while(0) 39 | # define LOGV(x) EF_VI_LOG(1,x) 40 | # define LOGVV(x) EF_VI_LOG(2,x) 41 | # define LOGVVV(x) EF_VI_LOG(3,x) 42 | #endif 43 | 44 | 45 | #endif /* __EF_VI_LOGGING_H__ */ 46 | -------------------------------------------------------------------------------- /src/lib/ciul/open.c: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: LGPL-2.1 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | /**************************************************************************\ 4 | *//*! \file 5 | ** 6 | ** \author 7 | ** \brief 8 | ** \date 9 | ** \cop (c) Level 5 Networks Limited. 10 | ** 11 | *//* 12 | \**************************************************************************/ 13 | 14 | /*! \cidoxg_lib_ef */ 15 | #include 16 | #include "ef_vi_internal.h" 17 | #include "logging.h" 18 | #include 19 | #include 20 | 21 | 22 | int ef_driver_open(ef_driver_handle* pfd) 23 | { 24 | int rc; 25 | rc = open("/dev/sfc_char", O_RDWR); 26 | if( rc >= 0 ) { 27 | *pfd = rc; 28 | return 0; 29 | } 30 | return -errno; 31 | } 32 | 33 | 34 | int ef_driver_close(ef_driver_handle dh) 35 | { 36 | return close(dh); 37 | } 38 | 39 | /*! \cidoxg_end */ 40 | -------------------------------------------------------------------------------- /src/lib/ciul/pt_rx.c: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: LGPL-2.1 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | 4 | /*! \cidoxg_lib_ef */ 5 | #include "ef_vi_internal.h" 6 | 7 | 8 | int ef_vi_receive_post(ef_vi* vi, ef_addr addr, ef_request_id dma_id) 9 | { 10 | int rc = ef_vi_receive_init(vi, addr, dma_id); 11 | if( rc == 0 ) ef_vi_receive_push(vi); 12 | return rc; 13 | } 14 | 15 | 16 | int ef_vi_receive_unbundle(ef_vi* vi, const ef_event* ev, 17 | ef_request_id* ids) 18 | { 19 | ef_request_id* ids_in = ids; 20 | ef_vi_rxq* q = &vi->vi_rxq; 21 | ef_vi_rxq_state* qs = &vi->ep_state->rxq; 22 | unsigned i; 23 | 24 | EF_VI_BUG_ON( EF_EVENT_TYPE(*ev) != EF_EVENT_TYPE_RX_MULTI && 25 | EF_EVENT_TYPE(*ev) != EF_EVENT_TYPE_RX_MULTI_DISCARD ); 26 | EF_VI_BUG_ON( ev->rx_multi.n_descs > EF_VI_RECEIVE_BATCH ); 27 | 28 | for( i = 0; i < ev->rx_multi.n_descs; ++i ) { 29 | unsigned di = qs->removed & q->mask; 30 | ++(qs->removed); 31 | if( q->ids[di] != EF_REQUEST_ID_MASK ) { 32 | *ids++ = q->ids[di]; 33 | q->ids[di] = EF_REQUEST_ID_MASK; 34 | } 35 | } 36 | 37 | /* Check we didn't remove more than we've added. */ 38 | EF_VI_ASSERT( qs->added - qs->removed <= q->mask ); 39 | 40 | return (int) (ids - ids_in); 41 | } 42 | 43 | /*! \cidoxg_end */ 44 | -------------------------------------------------------------------------------- /src/lib/ciul/vi_prime.c: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: LGPL-2.1 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | /**************************************************************************\ 4 | *//*! \file 5 | ** 6 | ** \author Akhi Singhania 7 | ** \brief FD priming support 8 | ** \date 2014/05/19 9 | ** \cop (c) Level 5 Networks Limited. 10 | ** 11 | *//* 12 | \**************************************************************************/ 13 | 14 | #include "ef_vi_internal.h" 15 | #include "driver_access.h" 16 | 17 | 18 | int ef_vi_prime(ef_vi* vi, ef_driver_handle dh, unsigned current_ptr) 19 | { 20 | ci_resource_prime_op_t op; 21 | op.crp_id = efch_make_resource_id(vi->vi_resource_id); 22 | op.crp_current_ptr = current_ptr; 23 | return ci_resource_prime(dh, &op); 24 | } 25 | -------------------------------------------------------------------------------- /src/lib/cplane/version.c: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 OR Solarflare-Binary */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | #include 4 | 5 | #include "cp_intf_ver.h" 6 | 7 | #ifdef __CI_INTERNAL_TRANSPORT_CONFIG_OPT_H__ 8 | #error "don't include ci/internal/transport_config_opt.h from binary-only code" 9 | #endif 10 | 11 | 12 | /* This will be statically linked into the cplane server */ 13 | oo_cp_version_check_t oo_cplane_api_version = { 14 | .in_cp_intf_ver = OO_CP_INTF_VER 15 | }; 16 | 17 | #ifdef __KERNEL__ 18 | int oo_cp_check_version(struct ci_private_s* priv, void* arg) 19 | { 20 | oo_cp_version_check_t* vc = arg; 21 | (void)vc; 22 | (void)priv; 23 | 24 | if( strnlen(vc->in_cp_intf_ver, CP_CHSUM_STR_LEN + 1) > CP_CHSUM_STR_LEN ) 25 | return -EINVAL; 26 | 27 | if( strncmp(vc->in_cp_intf_ver, OO_CP_INTF_VER, CP_CHSUM_STR_LEN + 1) ) { 28 | ci_log("ERROR: user/driver cplane interface mismatch"); 29 | ci_log(" user-interface: %s", vc->in_cp_intf_ver); 30 | ci_log(" driver-interface: %s", OO_CP_INTF_VER); 31 | return -ELIBACC; 32 | } 33 | 34 | return 0; 35 | } 36 | #endif 37 | -------------------------------------------------------------------------------- /src/lib/efhw/mmake.mk: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-2.0 2 | # X-SPDX-Copyright-Text: (c) Solarflare Communications Inc 3 | 4 | TARGET := $(EFHW_LIB) 5 | MMAKE_TYPE := LIB 6 | 7 | LIB_SRCS := nic.c \ 8 | eeprom.c \ 9 | eventq.c \ 10 | falcon.c \ 11 | falcon_mac.c \ 12 | falcon_spi.c \ 13 | ef10.c 14 | 15 | ifndef MMAKE_NO_RULES 16 | 17 | MMAKE_OBJ_PREFIX := ef_hw_ 18 | LIB_OBJS := $(LIB_SRCS:%.c=$(MMAKE_OBJ_PREFIX)%.o) 19 | 20 | all: $(TARGET) 21 | 22 | lib: $(TARGET) 23 | 24 | clean: 25 | @$(MakeClean) 26 | 27 | $(TARGET): $(LIB_OBJS) 28 | $(MMakeLinkStaticLib) 29 | endif 30 | 31 | 32 | ###################################################### 33 | # linux kbuild support 34 | # 35 | ifdef MMAKE_USE_KBUILD 36 | all: 37 | $(MAKE) $(MMAKE_KBUILD_ARGS) KBUILD_EXTMOD=$(BUILDPATH)/lib/efhw 38 | clean: 39 | @$(MakeClean) 40 | rm -f lib.a 41 | endif 42 | 43 | ifdef MMAKE_IN_KBUILD 44 | LIB_OBJS := $(LIB_SRCS:%.c=%.o) 45 | lib-y := $(LIB_OBJS) 46 | endif 47 | -------------------------------------------------------------------------------- /src/lib/efrm/mmake.mk: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-2.0 2 | # X-SPDX-Copyright-Text: (c) Solarflare Communications Inc 3 | 4 | TARGET := $(EFRM_LIB) 5 | MMAKE_TYPE := LIB 6 | 7 | LIB_SRCS := assert_valid.c \ 8 | buffer_table.c \ 9 | efrm_vi_set.c \ 10 | efrm_pd.c \ 11 | efrm_pio.c \ 12 | iobufset_resource.c \ 13 | resource_manager.c \ 14 | resources.c \ 15 | vi_resource_alloc.c \ 16 | vi_resource_event.c \ 17 | vi_resource_flush.c \ 18 | vi_resource_manager.c \ 19 | vi_resource_info.c \ 20 | vi_allocator.c \ 21 | buddy.c \ 22 | kfifo.c \ 23 | driver_object.c \ 24 | licensing.c 25 | 26 | 27 | ifndef MMAKE_NO_RULES 28 | 29 | MMAKE_OBJ_PREFIX := ef_rm_ 30 | LIB_OBJS := $(LIB_SRCS:%.c=$(MMAKE_OBJ_PREFIX)%.o) 31 | 32 | all: $(TARGET) 33 | 34 | lib: $(TARGET) 35 | 36 | clean: 37 | @$(MakeClean) 38 | 39 | $(TARGET): $(LIB_OBJS) $(LIB_OBJS1) 40 | $(MMakeLinkStaticLib) 41 | endif 42 | 43 | 44 | ###################################################### 45 | # linux kbuild support 46 | # 47 | ifdef MMAKE_USE_KBUILD 48 | all: 49 | $(MAKE) $(MMAKE_KBUILD_ARGS) KBUILD_EXTMOD=$(BUILDPATH)/lib/efrm 50 | clean: 51 | @$(MakeClean) 52 | rm -f lib.a 53 | endif 54 | 55 | ifdef MMAKE_IN_KBUILD 56 | LIB_OBJS := $(LIB_SRCS:%.c=%.o) 57 | lib-y := $(LIB_OBJS) 58 | endif 59 | -------------------------------------------------------------------------------- /src/lib/efthrm/oof_tproxy_ipproto.h: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | #ifndef __OOF_TPROXY_IPPROTO_H__ 4 | #define __OOF_TPROXY_IPPROTO_H__ 5 | 6 | #define ETHERTYPE_IP 0x0800 7 | #define ETHERTYPE_IP6 0x86DD 8 | 9 | static const ci_uint16 oof_tproxy_ipprotos[][2] = { 10 | {ETHERTYPE_IP, IPPROTO_ICMP}, 11 | {ETHERTYPE_IP, IPPROTO_IGMP}, 12 | {ETHERTYPE_IP, IPPROTO_UDP}, 13 | #if CI_CFG_IPV6 14 | {ETHERTYPE_IP6, IPPROTO_ICMPV6}, 15 | {ETHERTYPE_IP6, IPPROTO_UDP}, 16 | #endif 17 | }; 18 | 19 | #define OOF_TPROXY_IPPROTO_FILTER_COUNT (sizeof(oof_tproxy_ipprotos) / \ 20 | sizeof(oof_tproxy_ipprotos[0])) 21 | 22 | #define OOF_TPROXY_GLOBAL_FILTER_COUNT OOF_TPROXY_IPPROTO_FILTER_COUNT 23 | 24 | 25 | #endif /* __TPROXY_IPPROTO_IMPL_H__ */ 26 | -------------------------------------------------------------------------------- /src/lib/efthrm/tcp_filters_deps.h: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | #ifndef __TCP_FILTERS_DEPS_H__ 4 | #define __TCP_FILTERS_DEPS_H__ 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include "oo_hw_filter.h" 15 | #include 16 | #include 17 | 18 | #endif /* __TCP_FILTERS_DEPS_H__ */ 19 | 20 | -------------------------------------------------------------------------------- /src/lib/efthrm/tcp_filters_internal.h: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | /**************************************************************************\ 4 | *//*! \file 5 | ** 6 | ** \author djr 7 | ** \brief Helpers for filter code. 8 | ** \date 20090317 9 | ** \cop (c) Solarflare Communications Inc. 10 | ** 11 | *//* 12 | \**************************************************************************/ 13 | 14 | #ifndef __TCP_FILTERS_INTERNAL_H__ 15 | #define __TCP_FILTERS_INTERNAL_H__ 16 | 17 | 18 | #define FMT_PROTOCOL(p) ((p) == IPPROTO_TCP ? "TCP": \ 19 | (p) == IPPROTO_UDP ? "UDP" : "???") 20 | 21 | #define FMT_PORT(p) ((int) CI_BSWAP_BE16(p)) 22 | 23 | #define IP_FMT CI_IP_PRINTF_FORMAT 24 | #define IP_ARG(ip) CI_IP_PRINTF_ARGS(&(ip)) 25 | 26 | #define IPPORT_FMT IP_FMT":%d" 27 | #define IPPORT_ARG(ip,p) IP_ARG(ip), FMT_PORT(p) 28 | 29 | #endif /* __TCP_FILTERS_INTERNAL_H__ */ 30 | -------------------------------------------------------------------------------- /src/lib/efthrm/tcp_helper_resource.h: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | #ifndef __TCP_HELPER_RESOURCE_H__ 4 | #define __TCP_HELPER_RESOURCE_H__ 5 | 6 | struct vi_allocate_info { 7 | int try_rx_ts; 8 | int try_tx_ts; 9 | int retry_without_rx_ts; 10 | int retry_without_tx_ts; 11 | int wakeup_cpu_core; 12 | 13 | struct efrm_client *client; 14 | struct efrm_vi_set *vi_set; 15 | struct efrm_pd *pd; 16 | struct efrm_vf* vf; 17 | const char *name; 18 | unsigned ef_vi_flags; 19 | unsigned efhw_flags; 20 | unsigned oo_vi_flags; 21 | unsigned int hwport_flags; 22 | int evq_capacity; 23 | int txq_capacity; 24 | int rxq_capacity; 25 | int wakeup_channel; 26 | struct efrm_vi **virs; 27 | tcp_helper_cluster_t* cluster; 28 | unsigned vi_mem_mmap_bytes; 29 | unsigned vi_io_mmap_bytes; 30 | unsigned vi_ctpio_mmap_bytes; 31 | unsigned ctpio_threshold; 32 | int try_ctpio; 33 | int retry_without_ctpio; 34 | 35 | int release_pd; 36 | int log_resource_warnings; 37 | int intf_i; 38 | }; 39 | 40 | #endif /* __TCP_HELPER_RESOURCE_H__ */ 41 | -------------------------------------------------------------------------------- /src/lib/mmake.mk: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-2.0 OR Solarflare-Binary 2 | # X-SPDX-Copyright-Text: (c) Solarflare Communications Inc 3 | 4 | SUBDIRS := citools ciapp 5 | 6 | ifeq ($(LINUX),1) 7 | DRIVER_SUBDIRS := citools ciul cplane transport 8 | OTHER_SUBDIRS := spektor 9 | SUBDIRS += sfcaffinity onload_ext 10 | endif 11 | 12 | ifeq ($(GNU),1) 13 | # N.B.: The order matters here. 14 | SUBDIRS += ciul kcompat 15 | SUBDIRS += cplane transport 16 | ifneq ($(ONLOAD_ONLY),1) 17 | ifeq (${PLATFORM},gnu_x86_64) 18 | ifndef PREBUILD_ZF 19 | ifneq ($(NO_ZF),1) 20 | SUBDIRS += zf 21 | endif 22 | endif 23 | endif 24 | endif 25 | endif 26 | 27 | 28 | all: 29 | +@(export MMAKE_NO_CSTYLE=1; $(MakeSubdirs)) 30 | 31 | clean: 32 | @$(MakeClean) 33 | 34 | -------------------------------------------------------------------------------- /src/lib/onload_ext/mmake.mk: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: BSD-2-Clause 2 | # X-SPDX-Copyright-Text: (c) Solarflare Communications Inc 3 | 4 | # dynamic shared lib 5 | DLIB_SRCS := onload_ext.c 6 | DLIB_OBJS := $(DLIB_SRCS:%.c=%.o) 7 | 8 | # static lib 9 | ONLOAD_EXT_STATIC := libonload_ext.a 10 | SLIB_SRCS := onload_ext_static.c 11 | SLIB_OBJS := $(SLIB_SRCS:%.c=%.o) 12 | 13 | TARGETS := $(ONLOAD_EXT_REALNAME) 14 | TARGETS += $(ONLOAD_EXT_SONAME) 15 | TARGETS += $(ONLOAD_EXT_LINKNAME) 16 | TARGETS += $(ONLOAD_EXT_STATIC) 17 | 18 | MMAKE_CFLAGS += -DONLOAD_EXT_VERSION_MAJOR=$(ONLOAD_EXT_VERSION_MAJOR) 19 | MMAKE_CFLAGS += -DONLOAD_EXT_VERSION_MINOR=$(ONLOAD_EXT_VERSION_MINOR) 20 | MMAKE_CFLAGS += -DONLOAD_EXT_VERSION_MICRO=$(ONLOAD_EXT_VERSION_MICRO) 21 | 22 | 23 | MMAKE_TYPE := DLL 24 | 25 | 26 | all: $(TARGETS) 27 | 28 | lib: $(TARGETS) 29 | 30 | clean: 31 | @$(MakeClean) 32 | 33 | 34 | $(ONLOAD_EXT_REALNAME): $(DLIB_OBJS) 35 | @(soname="$(ONLOAD_EXT_SONAME)"; $(MMakeLinkDynamicLib)) 36 | 37 | $(ONLOAD_EXT_SONAME): $(ONLOAD_EXT_REALNAME) 38 | ln -fs $(shell basename $^) $@ 39 | 40 | $(ONLOAD_EXT_LINKNAME): $(ONLOAD_EXT_REALNAME) 41 | ln -fs $(shell basename $^) $@ 42 | 43 | $(ONLOAD_EXT_STATIC): $(SLIB_OBJS) 44 | $(MMakeLinkStaticLib) 45 | -------------------------------------------------------------------------------- /src/lib/sfcaffinity/mmake.mk: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-2.0 2 | # X-SPDX-Copyright-Text: (c) Solarflare Communications Inc 3 | 4 | TARGETS := libsfcaffinity.so 5 | MMAKE_TYPE := DLL 6 | 7 | 8 | all: $(TARGETS) 9 | 10 | lib: $(TARGETS) 11 | 12 | clean: 13 | @$(MakeClean) 14 | 15 | 16 | lib%.so: %.o 17 | @(libs="-ldl"; $(MMakeLinkPreloadLib)) 18 | -------------------------------------------------------------------------------- /src/lib/transport/common/lock.c: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | /**************************************************************************\ 4 | *//*! \file lock.c 5 | ** 6 | ** \author al 7 | ** \brief Interface to common user-level lock 8 | ** \date 2005/09/22 9 | ** \cop (c) Level 5 Networks Limited. 10 | ** 11 | *//* 12 | \**************************************************************************/ 13 | 14 | /*! \cidoxg_lib_transport_common */ 15 | 16 | #include 17 | 18 | /* *************************** 19 | * Global vars 20 | */ 21 | 22 | /*! Common user-level lock */ 23 | citp_ul_lock_t citp_ul_lock; 24 | 25 | 26 | /*! \cidoxg_end */ 27 | -------------------------------------------------------------------------------- /src/lib/transport/common/log.c: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | /**************************************************************************\ 4 | *//*! \file pcap.c 5 | ** 6 | ** \author ak 7 | ** \brief Interface to common transport logging functions 8 | ** \date 2005/09/22 9 | ** \cop (c) Level 5 Networks Limited. 10 | ** 11 | *//* 12 | \**************************************************************************/ 13 | 14 | /*! \cidoxg_lib_transport_common */ 15 | 16 | #include 17 | 18 | /* *************************** 19 | * Global vars 20 | */ 21 | 22 | /*! Current logging level/mask */ 23 | unsigned citp_log_level = CI_UL_LOG_E | CI_UL_LOG_U; 24 | 25 | 26 | /*! \cidoxg_end */ 27 | -------------------------------------------------------------------------------- /src/lib/transport/common/mmake.mk: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-2.0 2 | # X-SPDX-Copyright-Text: (c) Solarflare Communications Inc 3 | TARGET := $(CITPCOMMON_LIB) 4 | MMAKE_TYPE := LIB 5 | 6 | LIB_SRCS := \ 7 | log.c \ 8 | netif_init.c \ 9 | lock.c 10 | 11 | MMAKE_OBJ_PREFIX := ci_tp_common_ 12 | LIB_OBJS := $(LIB_SRCS:%.c=$(MMAKE_OBJ_PREFIX)%.o) 13 | 14 | all: $(TARGET) 15 | 16 | lib: $(TARGET) 17 | 18 | clean: 19 | @$(MakeClean) 20 | 21 | $(TARGET): $(LIB_OBJS) 22 | $(MMakeLinkStaticLib) 23 | -------------------------------------------------------------------------------- /src/lib/transport/ip/init.c: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | /**************************************************************************\ 4 | *//*! \file 5 | ** 6 | ** \author djr 7 | ** \brief 8 | ** \date 2003/06/03 9 | ** \cop (c) Level 5 Networks Limited. 10 | ** 11 | *//* 12 | \**************************************************************************/ 13 | 14 | /*! \cidoxg_lib_transport_ip */ 15 | 16 | #include "ip_internal.h" 17 | #include 18 | 19 | 20 | /* By default, log anything unexpected that happens. */ 21 | unsigned ci_tp_log = CI_TP_LOG_DEFAULT; 22 | unsigned ci_tp_max_dump = 80; 23 | 24 | 25 | int ci_tp_init(citp_init_thread_callback cb) 26 | { 27 | const char* s; 28 | 29 | #ifndef NDEBUG 30 | static int done = 0; 31 | ci_assert(!done); 32 | done = 1; 33 | #endif 34 | 35 | /*! ?? \TODO setup config options etc. */ 36 | if( (s = getenv("TP_LOG")) ) sscanf(s, "%x", &ci_tp_log); 37 | LOG_S(log("TP_LOG = %x", ci_tp_log)); 38 | 39 | init_thread_callback = cb; 40 | oo_per_thread_init(); 41 | 42 | return 0; 43 | } 44 | 45 | /*! \cidoxg_end */ 46 | -------------------------------------------------------------------------------- /src/lib/transport/ip/netif_table.h: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | #ifndef __NETIF_TABLE_H__ 4 | #define __NETIF_TABLE_H__ 5 | 6 | #define LPF "tcp_table: " 7 | #define LPFU "udp_table: " 8 | 9 | 10 | #if CI_CFG_IPV6 11 | int 12 | ci_ip6_netif_filter_insert(ci_ip6_netif_filter_table* tbl, 13 | ci_netif* netif, oo_sp tcp_id, 14 | const ci_addr_t laddr, unsigned lport, 15 | const ci_addr_t raddr, unsigned rport, 16 | unsigned protocol) CI_HF; 17 | 18 | void 19 | ci_ip6_netif_filter_remove(ci_ip6_netif_filter_table* tbl, 20 | ci_netif* netif, oo_sp sock_p, 21 | const ci_addr_t laddr, unsigned lport, 22 | const ci_addr_t raddr, unsigned rport, 23 | unsigned protocol) CI_HF; 24 | 25 | void ci_ip6_netif_filter_dump(ci_netif* ni); 26 | 27 | #endif 28 | 29 | 30 | ci_inline int ci_sock_intf_check(ci_netif* ni, ci_sock_cmn* s, 31 | int intf_i, int vlan) 32 | { 33 | ci_hwport_id_t hwport = ni->state->intf_i_to_hwport[intf_i]; 34 | return ((s->rx_bind2dev_hwports & (1ull << hwport)) != 0 && 35 | s->rx_bind2dev_vlan == vlan); 36 | } 37 | 38 | 39 | #endif /* __NETIF_TABLE_H__ */ 40 | -------------------------------------------------------------------------------- /src/lib/transport/ip/sockerr.c: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | /**************************************************************************\ 4 | *//*! \file 5 | ** 6 | ** \author stg 7 | ** \brief Per-socket error handler 8 | ** \date 2004/6/30 9 | ** \cop (c) Level 5 Networks Limited. 10 | ** 11 | *//* 12 | \**************************************************************************/ 13 | 14 | /*! \cidoxg_lib_transport_ip */ 15 | 16 | #include "ip_internal.h" 17 | 18 | 19 | 20 | /*! \cidoxg_end */ 21 | -------------------------------------------------------------------------------- /src/lib/transport/ip/syscall.c: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | /**************************************************************************\ 4 | *//*! \file 5 | ** 6 | ** \author stg 7 | ** \brief Access to sys calls 8 | ** \date 2007/05/16 9 | ** \cop (c) Solarflare Communications Inc 10 | ** 11 | *//* 12 | \**************************************************************************/ 13 | 14 | /*! \cidoxg_lib_ef */ 15 | 16 | 17 | /* This is required to get pread() and pwrite() defined in */ 18 | #define _GNU_SOURCE 19 | # include 20 | 21 | #include 22 | #include 23 | //??#include "ef_vi_internal.h" 24 | //??#include "ef_vi_internal2.h" 25 | 26 | #include 27 | /* define the ci_sys_ pointers */ 28 | # define CI_MK_DECL(ret, fn, args) ret (*ci_sys_##fn) args = fn 29 | # include 30 | 31 | 32 | /*! \cidoxg_end */ 33 | -------------------------------------------------------------------------------- /src/lib/transport/ip/tcp_driver_ops.c: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | /**************************************************************************\ 4 | *//*! \file 5 | ** 6 | ** \author djr 7 | ** \brief TCP helper dependent driver / kernel specifics for libef. 8 | ** \date 2006/06/13 9 | ** \cop (c) Level 5 Networks Limited. 10 | ** 11 | *//* 12 | \**************************************************************************/ 13 | 14 | /*! \cidoxg_lib_ef */ 15 | 16 | #include 17 | #include 18 | #include 19 | 20 | #ifndef __KERNEL__ 21 | # error "kernel-only source file" 22 | #endif 23 | 24 | int ci_tcp_helper_more_bufs(ci_netif* ni) 25 | { 26 | return efab_tcp_helper_more_bufs(netif2tcp_helper_resource(ni)); 27 | } 28 | 29 | int ci_tcp_helper_more_socks(ci_netif* ni) 30 | { 31 | return efab_tcp_helper_more_socks(netif2tcp_helper_resource(ni)); 32 | } 33 | 34 | /*! \cidoxg_end */ 35 | -------------------------------------------------------------------------------- /src/lib/transport/ip/udp_misc.c: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | /**************************************************************************\ 4 | *//*! \file 5 | ** 6 | ** \author djr 7 | ** \brief Misc stuff for UDP sockets. 8 | ** \date 2005/02/01 9 | ** \cop (c) Level 5 Networks Limited. 10 | ** 11 | *//* 12 | \**************************************************************************/ 13 | 14 | /*! \cidoxg_lib_transport_ip */ 15 | #include "ip_internal.h" 16 | #include "udp_internal.h" 17 | #include 18 | 19 | #define VERB(x) 20 | 21 | 22 | void ci_udp_state_free(ci_netif* ni, ci_udp_state* us) 23 | { 24 | ci_assert(ci_netif_is_locked(ni)); 25 | ci_assert(us->s.b.state == CI_TCP_STATE_UDP); 26 | ci_assert(ci_ni_dllist_is_self_linked(ni, &us->s.b.post_poll_link)); 27 | 28 | #if CI_CFG_TIMESTAMPING 29 | ci_udp_recv_q_drop(ni, &us->timestamp_q); 30 | #endif 31 | 32 | citp_waitable_obj_free(ni, &us->s.b); 33 | } 34 | 35 | 36 | int ci_udp_try_to_free_pkts(ci_netif* ni, ci_udp_state* us, int desperation) 37 | { 38 | /* Reap should be called before this. There is nothing else we can do. */ 39 | return 0; 40 | } 41 | 42 | void ci_udp_perform_deferred_socket_work(ci_netif* ni, ci_udp_state* us) 43 | { 44 | ci_assert(us->s.b.state == CI_TCP_STATE_UDP); 45 | 46 | ci_udp_sendmsg_send_async_q(ni, us); 47 | } 48 | 49 | /*! \cidoxg_end */ 50 | -------------------------------------------------------------------------------- /src/lib/transport/mmake.mk: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-2.0 2 | # X-SPDX-Copyright-Text: (c) Solarflare Communications Inc 3 | SUBDIRS := ip common unix 4 | DRIVER_SUBDIRS := ip 5 | 6 | 7 | all: 8 | +@$(MakeSubdirs) 9 | 10 | clean: 11 | @$(MakeClean) 12 | 13 | -------------------------------------------------------------------------------- /src/lib/transport/unix/exec.c: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | /**************************************************************************\ 4 | *//*! \file 5 | ** 6 | ** \author Elena Vengerova 7 | ** \brief Restore information about TCP helper(s) and endpoints after exec() 8 | ** \date 9 | ** \cop (c) Level 5 Networks Limited. 10 | ** 11 | *//* 12 | \**************************************************************************/ 13 | 14 | /*! \cidoxg_lib_transport_unix */ 15 | 16 | 17 | /*! \cidoxg_end */ 18 | 19 | -------------------------------------------------------------------------------- /src/lib/transport/unix/mapfile.ilp32: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | L5 { 4 | global: 5 | level5_copyright_msg; 6 | setrlimit; 7 | setrlimit64; 8 | socket; 9 | bind; 10 | listen; 11 | shutdown; 12 | getsockname; 13 | getpeername; 14 | getsockopt; 15 | setsockopt; 16 | readv; 17 | writev; 18 | ioctl; 19 | dup; 20 | dup2; 21 | accept; 22 | connect; 23 | recv; 24 | recvfrom; 25 | recvmsg; 26 | send; 27 | sendto; 28 | sendmsg; 29 | sendfile; 30 | sendfile64; 31 | sendfilev; 32 | read; 33 | write; 34 | close; 35 | fcntl; 36 | fcntl64; 37 | vfork; 38 | poll; 39 | select; 40 | open; 41 | open64; 42 | creat; 43 | creat64; 44 | socketpair; 45 | pipe; 46 | bsd_signal; 47 | signal; 48 | sigaction; 49 | chroot; 50 | _fxstat; 51 | aio_read; 52 | aio_write; 53 | aio_error; 54 | aio_return; 55 | aio_cancel; 56 | aio_suspend; 57 | aio_fsync; 58 | lio_listio; 59 | aio_read64; 60 | aio_write64; 61 | aio_error64; 62 | aio_return64; 63 | aio_cancel64; 64 | aio_suspend64; 65 | aio_fsync64; 66 | lio_listio64; 67 | local: 68 | *; 69 | }; 70 | -------------------------------------------------------------------------------- /src/lib/transport/unix/mapfile.lp64: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | L5 { 4 | global: 5 | level5_copyright_msg; 6 | setrlimit; 7 | socket; 8 | bind; 9 | listen; 10 | shutdown; 11 | getsockname; 12 | getpeername; 13 | getsockopt; 14 | setsockopt; 15 | readv; 16 | writev; 17 | ioctl; 18 | dup; 19 | dup2; 20 | accept; 21 | connect; 22 | recv; 23 | recvfrom; 24 | recvmsg; 25 | send; 26 | sendto; 27 | sendmsg; 28 | sendfile; 29 | sendfilev; 30 | read; 31 | write; 32 | close; 33 | fcntl; 34 | fcntl64; 35 | vfork; 36 | poll; 37 | select; 38 | open; 39 | creat; 40 | socketpair; 41 | pipe; 42 | bsd_signal; 43 | signal; 44 | sigaction; 45 | chroot; 46 | fstat; 47 | aio_read; 48 | aio_write; 49 | aio_error; 50 | aio_return; 51 | aio_cancel; 52 | aio_suspend; 53 | aio_fsync; 54 | lio_listio; 55 | local: 56 | *; 57 | }; 58 | -------------------------------------------------------------------------------- /src/lib/transport/unix/ul_pipe.h: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | #ifndef __ONLOAD_PIPE_H__ 4 | #define __ONLOAD_PIPE_H__ 5 | 6 | #if !CI_CFG_USERSPACE_PIPE 7 | #error "Do not include ul_pipe.h when pipe is not enabled" 8 | #endif 9 | 10 | #include "internal.h" 11 | 12 | typedef struct { 13 | citp_fdinfo fdinfo; 14 | struct oo_pipe* pipe; 15 | ci_netif* ni; 16 | } citp_pipe_fdi; 17 | 18 | #define fdi_to_pipe_fdi(_fdi) CI_CONTAINER(citp_pipe_fdi, fdinfo, (_fdi)) 19 | 20 | extern int citp_pipe_create(int fds[2], int flags); 21 | 22 | extern int citp_splice_pipe_pipe(citp_pipe_fdi* in_pipe_fdi, 23 | citp_pipe_fdi* out_pipe_fdi, size_t rlen, 24 | int flags); 25 | extern int citp_pipe_splice_write(citp_fdinfo* fdi, int alien_fd, 26 | loff_t* alien_off, 27 | size_t len, int flags, 28 | citp_lib_context_t* lib_context); 29 | extern int citp_pipe_splice_read(citp_fdinfo* fdi, int alien_fd, 30 | loff_t* alien_off, 31 | size_t len, int flags, 32 | citp_lib_context_t* lib_context); 33 | 34 | #endif /* ul_pipe.h */ 35 | -------------------------------------------------------------------------------- /src/lib/transport/unix/ul_select.h: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | /**************************************************************************\ 4 | *//*! \file 5 | ** 6 | ** \author djr 7 | ** \brief Support for user-level select(). 8 | ** \date 2011/02/21 9 | ** \cop (c) Solarflare Communications Inc. 10 | ** 11 | *//* 12 | \**************************************************************************/ 13 | 14 | #ifndef __UL_SELECT_H__ 15 | #define __UL_SELECT_H__ 16 | 17 | 18 | #if CI_CFG_USERSPACE_SELECT 19 | 20 | /* The events that correspond to the select() sets. */ 21 | #define SELECT_RD_SET (POLLIN | POLLRDNORM | POLLRDBAND | POLLHUP | POLLERR) 22 | #define SELECT_WR_SET (POLLOUT | POLLWRNORM | POLLWRBAND | POLLERR) 23 | #define SELECT_EX_SET (POLLPRI) 24 | 25 | 26 | struct oo_ul_select_state { 27 | fd_set *rdu, *wru, *exu; 28 | fd_set *rdk, *wrk, *exk; 29 | fd_set *rdi, *wri, *exi; 30 | int nfds_inited; 31 | int nfds_split; 32 | int is_ul_fd; 33 | int is_kernel_fd; 34 | ci_uint64 now_frc; 35 | unsigned ul_select_spin; 36 | #if CI_CFG_SPIN_STATS 37 | int stat_incremented; 38 | #endif 39 | }; 40 | 41 | #endif 42 | 43 | #endif /* __UL_SELECT_H__ */ 44 | -------------------------------------------------------------------------------- /src/tests/ef_vi/efsend_common.h: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: BSD-2-Clause */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | /* Declarations common to apps in the efsend suite. 4 | * 5 | * CUSTOMER NOTE: This code is not intended to be used outside of the efsend 6 | * suite! 7 | */ 8 | 9 | #ifndef __SENDCOMMON_H__ 10 | #define __SENDCOMMON_H__ 11 | 12 | 13 | #include "utils.h" 14 | 15 | #include 16 | #include 17 | #include 18 | #include 19 | 20 | extern void usage(void); 21 | 22 | #define CL_CHK(x) \ 23 | do{ \ 24 | if( ! (x) ) \ 25 | usage(); \ 26 | }while(0) 27 | 28 | extern int init_udp_pkt(void* pkt_buf, int paylen, ef_vi *vi, 29 | ef_driver_handle dh, int vlan); 30 | extern void common_usage(void); 31 | extern void parse_args(char *argv[], int *ifindex, int local_port, int vlan); 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /src/tests/ef_vi/mmake.mk: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: BSD-2-Clause 2 | # X-SPDX-Copyright-Text: (c) Solarflare Communications Inc 3 | 4 | EFSEND_APPS := efsend efsend_pio efsend_timestamping efsend_pio_warm 5 | TEST_APPS := efforward efrss efsink \ 6 | efsink_packed efforward_packed eflatency stats \ 7 | efjumborx $(EFSEND_APPS) 8 | 9 | ifeq (${PLATFORM},gnu_x86_64) 10 | TEST_APPS += efrink_controller efrink_consumer 11 | endif 12 | 13 | TARGETS := $(TEST_APPS:%=$(AppPattern)) 14 | 15 | 16 | MMAKE_LIBS := $(LINK_CIUL_LIB) $(LINK_CIAPP_LIB) 17 | MMAKE_LIB_DEPS := $(CIUL_LIB_DEPEND) $(CIAPP_LIB_DEPEND) 18 | 19 | 20 | all: $(TARGETS) 21 | 22 | clean: 23 | @$(MakeClean) 24 | 25 | 26 | eflatency: eflatency.o utils.o 27 | 28 | $(EFSEND_APPS): utils.o efsend_common.o 29 | 30 | efsink: efsink.o utils.o 31 | 32 | efjumborx: efjumborx.o utils.o 33 | 34 | efsink_packed: efsink_packed.o utils.o 35 | 36 | efforward_packed: efforward_packed.o utils.o 37 | 38 | efpingpong: MMAKE_LIBS := $(LINK_CITOOLS_LIB) $(MMAKE_LIBS) 39 | efpingpong: MMAKE_LIB_DEPS := $(CITOOLS_LIB_DEPEND) $(MMAKE_LIB_DEPS) 40 | 41 | $(EFSEND_APPS): MMAKE_LIBS := $(LINK_CITOOLS_LIB) $(MMAKE_LIBS) 42 | $(EFSEND_APPS): MMAKE_LIB_DEPS := $(CITOOLS_LIB_DEPEND) $(MMAKE_LIB_DEPS) 43 | 44 | eflatency: MMAKE_LIBS := $(LINK_CITOOLS_LIB) $(MMAKE_LIBS) 45 | eflatency: MMAKE_LIB_DEPS := $(CITOOLS_LIB_DEPEND) $(MMAKE_LIB_DEPS) 46 | 47 | efrink_controller: efrink_controller.o utils.o 48 | 49 | stats: stats.py 50 | cp $< $@ 51 | -------------------------------------------------------------------------------- /src/tests/mmake.mk: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: BSD-2-Clause 2 | # X-SPDX-Copyright-Text: (c) Solarflare Communications Inc 3 | ifeq ($(GNU),1) 4 | SUBDIRS := ciul \ 5 | ip \ 6 | citools \ 7 | driver \ 8 | ef_vi \ 9 | onload \ 10 | runbench_scripts \ 11 | rtt \ 12 | syscalls \ 13 | tap \ 14 | trade_sim \ 15 | 16 | OTHER_SUBDIRS := 17 | 18 | ifeq ($(ONLOAD_ONLY),1) 19 | SUBDIRS := ef_vi \ 20 | onload \ 21 | rtt \ 22 | trade_sim 23 | endif 24 | 25 | ifneq ($(NO_ZF),1) 26 | ifeq (${PLATFORM},gnu_x86_64) 27 | ifeq ($(shell $(TOP)/$(CURRENT)/zf_apps/zf_supported.sh),1) 28 | SUBDIRS += zf_apps zf_internal 29 | endif 30 | ifndef PREBUILD_ZF 31 | ifneq ($(ONLOAD_ONLY),1) 32 | OTHER_SUBDIRS += packetdrill 33 | ifdef ZF_DEVEL 34 | SUBDIRS += zf_unit 35 | endif 36 | endif 37 | endif 38 | endif 39 | endif 40 | endif 41 | 42 | DRIVER_SUBDIRS := 43 | 44 | ifeq ($(FREEBSD),1) 45 | SUBDIRS := ip 46 | DRIVER_SUBDIRS := 47 | OTHER_SUBDIRS := 48 | endif 49 | 50 | ifeq ($(MACOSX),1) 51 | SUBDIRS := ip 52 | DRIVER_SUBDIRS := 53 | OTHER_SUBDIRS := 54 | endif 55 | 56 | ifeq ($(SOLARIS),1) 57 | SUBDIRS := ip 58 | DRIVER_SUBDIRS := 59 | OTHER_SUBDIRS := 60 | endif 61 | 62 | all: 63 | +@$(MakeSubdirs) 64 | 65 | clean: 66 | @$(MakeClean) 67 | 68 | -------------------------------------------------------------------------------- /src/tests/onload/extensions/.onload_intercept: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: BSD-2-Clause 2 | # X-SPDX-Copyright-Text: (c) Solarflare Communications Inc 3 | set protocol 1 4 | set default 1 5 | name T1 E1_% 6 | name Thread1 Long_% 7 | num 2 Second 8 | -------------------------------------------------------------------------------- /src/tests/onload/extensions/onload_is_present.c: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: BSD-2-Clause */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | /* 4 | * Build the file using the following command: 5 | * $ gcc -oonload_is_present -lonload_ext onload_is_present.c 6 | * 7 | * Test by running the following two commands: 8 | * $ ./onload_is_present 9 | * Program running without Onload 10 | * $ onload ./onload_is_present 11 | * Program running with Onload 12 | * $ 13 | */ 14 | #include 15 | 16 | #include 17 | 18 | int main(void) 19 | { 20 | if( onload_is_present() ) 21 | printf("Program running with Onload\n"); 22 | else 23 | printf("Program running without Onload\n"); 24 | 25 | return 0; 26 | } 27 | -------------------------------------------------------------------------------- /src/tests/onload/hwtimestamping/mmake.mk: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: BSD-2-Clause 2 | # X-SPDX-Copyright-Text: (c) Solarflare Communications Inc 3 | TARGETS := rx_timestamping tx_timestamping cpacket_send 4 | 5 | ifneq ($(strip $(USEONLOADEXT)),) 6 | CFLAGS += -DONLOADEXT_AVAILABLE 7 | MMAKE_LIBS += $(LINK_ONLOAD_EXT_LIB) 8 | MMAKE_LIB_DEPS += $(ONLOAD_EXT_LIB_DEPEND) 9 | endif 10 | 11 | # Use the kernel timestamping headers for definition, unless they don't exist 12 | # in which case we will fall back to our own definitions. 13 | # We need both these two files to exist: 14 | ts_missing = 15 | ifeq (,$(wildcard /usr/include/linux/net_tstamp.h)) 16 | ts_missing = yes 17 | endif 18 | ifeq (,$(wildcard /usr/include/linux/sockios.h)) 19 | ts_missing = yes 20 | endif 21 | ifdef ts_missing 22 | CFLAGS += -DNO_KERNEL_TS_INCLUDE 23 | endif 24 | 25 | all: $(TARGETS) 26 | 27 | targets: 28 | @echo $(TARGETS) 29 | 30 | clean: 31 | @$(MakeClean) 32 | -------------------------------------------------------------------------------- /src/tests/onload/mmake.mk: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: BSD-2-Clause 2 | # X-SPDX-Copyright-Text: (c) Solarflare Communications Inc 3 | SUBDIRS := wire_order tproxy_preload woda_preload hwtimestamping \ 4 | sync_preload l3xudp_preload 5 | 6 | ifneq ($(ONLOAD_ONLY),1) 7 | # These tests have dependency on kernel_compat lib, 8 | # tests/tap, libmnl that are !ONLOAD_ONLY 9 | SUBDIRS += oof onload_remote_monitor 10 | ifneq ($(NO_TEAMING),1) 11 | SUBDIRS += cplane_unit cplane_sysunit 12 | endif 13 | endif 14 | 15 | OTHER_SUBDIRS := titchy_proxy thttp 16 | 17 | all: 18 | +@$(MakeSubdirs) 19 | 20 | clean: 21 | @$(MakeClean) 22 | 23 | -------------------------------------------------------------------------------- /src/tests/onload/onload_remote_monitor/mmake.mk: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: BSD-2-Clause 2 | # X-SPDX-Copyright-Text: (c) Solarflare Communications Inc 3 | SUBDIRS := internal_tests 4 | 5 | all: 6 | +@$(MakeSubdirs) 7 | 8 | clean: 9 | @$(MakeClean) 10 | 11 | -------------------------------------------------------------------------------- /src/tests/onload/onload_remote_monitor/using_collectd/README.collectd_example.txt: -------------------------------------------------------------------------------- 1 | .. SPDX-License-Identifier: BSD-2-Clause 2 | .. X-SPDX-Copyright-Text: (c) Solarflare Communications Inc 3 | This is an example of how to gather Onload stack statistics using collectd. 4 | Other configurations of Onload Remote Monitor with/without collectd are 5 | possible. 6 | 7 | 1. Install collectd (https://collectd.org) ensuring the curl_json plugin is 8 | enabled. 9 | 2. Add config to your collectd.conf to request stats from Onload. An example 10 | is provided in 11 | src/tests/onload/onload_remote_monitor/using_collectd/collectd_example.conf 12 | 3. Run the Onload Remote Monitor web server on the server you wish to monitor: 13 | orm_webserver 9000 # this runs on port 9000 14 | 4. Check web service is running by pointing a browser to 15 | http://:9000/onload/lots/ 16 | 5. Start (or restart) collectd to begin collecting Onload stack statistics. 17 | 6. With the example configuration, collectd will automatically pick up 18 | additional Onload stacks as they are created. 19 | 7. If using the suggested csv configuration, the stats will be saved to 20 | /opt/collectd/var/lib/collectd/csv//curl_json-onload_stack_stats/ 21 | -------------------------------------------------------------------------------- /src/tests/onload/wire_order/mmake.mk: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: BSD-2-Clause 2 | # X-SPDX-Copyright-Text: (c) Solarflare Communications Inc 3 | # Only build if USEONLOADEXT is defined 4 | ifneq ($(strip $(USEONLOADEXT)),) 5 | 6 | TARGETS := wire_order_client wire_order_server 7 | 8 | MMAKE_LIBS += $(LINK_ONLOAD_EXT_LIB) 9 | MMAKE_LIB_DEPS += $(ONLOAD_EXT_LIB_DEPEND) 10 | CFLAGS += -DONLOADEXT_AVAILABLE 11 | 12 | all: $(TARGETS) 13 | 14 | targets: 15 | @echo $(TARGETS) 16 | 17 | clean: 18 | @$(MakeClean) 19 | 20 | endif 21 | -------------------------------------------------------------------------------- /src/tests/onload/wire_order/wire_order.h: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: BSD-2-Clause */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | #ifndef WIRE_ORDER_H 4 | #define WIRE_ORDER_H 5 | 6 | /* Default port the server runs on */ 7 | #define DEFAULT_PORT 2048 8 | 9 | /* Default size of the listen queue */ 10 | #define DEFAULT_LISTEN_BACKLOG 100 11 | 12 | /* Default number of events to request in onload_ordered_epoll_wait() */ 13 | #define DEFAULT_MAX_EPOLL_EVENTS 10 14 | 15 | /* Flags for configuring the server setup. */ 16 | #define WIRE_ORDER_CFG_FLAGS_UDP 1 17 | 18 | #define WIRE_ORDER_CFG_LEN 8 19 | #define WIRE_ORDER_CFG_FLAGS_OFST 0 20 | #define WIRE_ORDER_CFG_N_SOCKS_OFST 4 21 | 22 | #endif /* WIRE_ORDER_H */ 23 | -------------------------------------------------------------------------------- /src/tests/rtt/mmake.mk: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-2.0 2 | # X-SPDX-Copyright-Text: (c) Solarflare Communications Inc 3 | 4 | TEST_APPS := rtt 5 | TARGETS := $(TEST_APPS:%=$(AppPattern)) 6 | 7 | 8 | all: $(TARGETS) 9 | 10 | clean: 11 | @$(MakeClean) 12 | 13 | 14 | MMAKE_LIBS := $(LINK_CIAPP_LIB) $(LINK_CITOOLS_LIB) $(LINK_CIUL_LIB) 15 | MMAKE_LIB_DEPS := $(CIAPP_LIB_DEPEND) $(CITOOLS_LIB_DEPEND) $(CIUL_LIB_DEPEND) 16 | 17 | 18 | rtt: rtt.o rtt_socket.o rtt_efvi.o 19 | -------------------------------------------------------------------------------- /src/tests/zf_apps/shared/mmake.mk: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: BSD-2-Clause 2 | # X-SPDX-Copyright-Text: (c) Solarflare Communications Inc 3 | all: 4 | 5 | clean: 6 | @$(MakeClean) 7 | -------------------------------------------------------------------------------- /src/tests/zf_apps/static/mmake.mk: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: BSD-2-Clause 2 | # X-SPDX-Copyright-Text: (c) Solarflare Communications Inc 3 | all: 4 | 5 | clean: 6 | @$(MakeClean) 7 | -------------------------------------------------------------------------------- /src/tests/zf_apps/zf_supported.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # SPDX-License-Identifier: BSD-2-Clause 3 | # X-SPDX-Copyright-Text: (c) Solarflare Communications Inc 4 | 5 | # Outputs '1' if we can build the ZF test apps, or otherwise '0'. 6 | 7 | cc -x c - -o /dev/null > /dev/null 2>&1 << EOF 8 | #include 9 | #include 10 | 11 | int main(void) 12 | { 13 | printf("EPOLLRDHUP is %d\n", EPOLLRDHUP); 14 | return 0; 15 | } 16 | EOF 17 | 18 | if [ $? -eq 0 ]; then 19 | echo 1 20 | else 21 | echo 0 22 | fi 23 | 24 | -------------------------------------------------------------------------------- /src/tools/mmake.mk: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-2.0 OR Solarflare-Binary 2 | # X-SPDX-Copyright-Text: (c) Solarflare Communications Inc 3 | 4 | ifeq ($(LINUX),1) 5 | SUBDIRS := ip sfcaffinity solar_clusterd dlopen_no_deepbind \ 6 | onload_remote_monitor 7 | ifneq ($(ONLOAD_ONLY),1) 8 | SUBDIRS += cplane unifdef misc onload_mibdump 9 | endif 10 | 11 | endif 12 | 13 | ifndef PREBUILD_ZF 14 | ifeq (${PLATFORM},gnu_x86_64) 15 | ifneq ($(ONLOAD_ONLY),1) 16 | ifneq ($(NO_ZF),1) 17 | SUBDIRS += zf 18 | endif 19 | endif 20 | endif 21 | endif 22 | 23 | all: 24 | +@$(MakeSubdirs) 25 | 26 | clean: 27 | @$(MakeClean) 28 | -------------------------------------------------------------------------------- /src/tools/onload_remote_monitor/orm_json_lib.h: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ 3 | 4 | /* flags to control which info gets output */ 5 | #define ORM_OUTPUT_NONE 0 6 | #define ORM_OUTPUT_STATS 0x1 7 | #define ORM_OUTPUT_MORE_STATS 0x2 8 | #define ORM_OUTPUT_TCP_STATS_COUNT 0x4 9 | #define ORM_OUTPUT_TCP_EXT_STATS_COUNT 0x8 10 | #define ORM_OUTPUT_STACK 0x10 11 | #define ORM_OUTPUT_SOCKETS 0x20 12 | #define ORM_OUTPUT_VIS 0x40 13 | #define ORM_OUTPUT_OPTS 0x100 14 | #define ORM_OUTPUT_EXTRA 0x100000 15 | #define ORM_OUTPUT_LOTS 0xFFFFF 16 | #define ORM_OUTPUT_SUM (ORM_OUTPUT_STATS | ORM_OUTPUT_MORE_STATS | \ 17 | ORM_OUTPUT_TCP_STATS_COUNT | \ 18 | ORM_OUTPUT_TCP_EXT_STATS_COUNT) 19 | 20 | struct orm_cfg { 21 | const char* stackname; 22 | const char* filter; 23 | bool sum; 24 | bool meta; 25 | bool flat; 26 | }; 27 | 28 | /* Convert argv[] to output_flags for orm_do_dump() 29 | * Returns -EINVAL if any unrecognised options are provided 30 | */ 31 | extern int orm_parse_output_flags(int argc, const char* const* argv); 32 | 33 | /* Generate JSON output to the given stream 34 | * Return 0 on success, or negative error code 35 | */ 36 | extern int orm_do_dump(const struct orm_cfg* cfg, int output_flags, 37 | FILE* output_stream); 38 | 39 | -------------------------------------------------------------------------------- /src/tools/sfcaffinity/mmake.mk: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-2.0 2 | # X-SPDX-Copyright-Text: (c) Solarflare Communications Inc 3 | APPS := sfcaffinity_tool 4 | 5 | TARGETS := $(APPS:%=$(AppPattern)) 6 | 7 | 8 | MMAKE_LIBS := $(LINK_CIAPP_LIB) $(LINK_CITOOLS_LIB) $(LINK_CIUL_LIB) 9 | MMAKE_LIB_DEPS := $(CIAPP_LIB_DEPEND) $(CITOOLS_LIB_DEPEND) $(CIUL_LIB_DEPEND) 10 | 11 | 12 | all: $(TARGETS) 13 | 14 | clean: 15 | @$(MakeClean) 16 | -------------------------------------------------------------------------------- /src/tools/solar_clusterd/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/majek/openonload/aff60a36ed3543446d9ff179905f47c47d1e300b/src/tools/solar_clusterd/__init__.py --------------------------------------------------------------------------------