github.com/inspektor-gadget/inspektor-gadget@v0.28.1/pkg/gadgets/top/tcp/tracer/tcptop_arm64_bpfel.go (about) 1 // Code generated by bpf2go; DO NOT EDIT. 2 //go:build arm64 3 4 package tracer 5 6 import ( 7 "bytes" 8 _ "embed" 9 "fmt" 10 "io" 11 12 "github.com/cilium/ebpf" 13 ) 14 15 type tcptopIpKeyT struct { 16 Saddr [16]uint8 17 Daddr [16]uint8 18 Mntnsid uint64 19 Pid uint32 20 Name [16]uint8 21 Lport uint16 22 Dport uint16 23 Family uint16 24 _ [6]byte 25 } 26 27 type tcptopTrafficT struct { 28 Sent uint64 29 Received uint64 30 } 31 32 // loadTcptop returns the embedded CollectionSpec for tcptop. 33 func loadTcptop() (*ebpf.CollectionSpec, error) { 34 reader := bytes.NewReader(_TcptopBytes) 35 spec, err := ebpf.LoadCollectionSpecFromReader(reader) 36 if err != nil { 37 return nil, fmt.Errorf("can't load tcptop: %w", err) 38 } 39 40 return spec, err 41 } 42 43 // loadTcptopObjects loads tcptop and converts it into a struct. 44 // 45 // The following types are suitable as obj argument: 46 // 47 // *tcptopObjects 48 // *tcptopPrograms 49 // *tcptopMaps 50 // 51 // See ebpf.CollectionSpec.LoadAndAssign documentation for details. 52 func loadTcptopObjects(obj interface{}, opts *ebpf.CollectionOptions) error { 53 spec, err := loadTcptop() 54 if err != nil { 55 return err 56 } 57 58 return spec.LoadAndAssign(obj, opts) 59 } 60 61 // tcptopSpecs contains maps and programs before they are loaded into the kernel. 62 // 63 // It can be passed ebpf.CollectionSpec.Assign. 64 type tcptopSpecs struct { 65 tcptopProgramSpecs 66 tcptopMapSpecs 67 } 68 69 // tcptopSpecs contains programs before they are loaded into the kernel. 70 // 71 // It can be passed ebpf.CollectionSpec.Assign. 72 type tcptopProgramSpecs struct { 73 IgToptcpClean *ebpf.ProgramSpec `ebpf:"ig_toptcp_clean"` 74 IgToptcpSdmsg *ebpf.ProgramSpec `ebpf:"ig_toptcp_sdmsg"` 75 } 76 77 // tcptopMapSpecs contains maps before they are loaded into the kernel. 78 // 79 // It can be passed ebpf.CollectionSpec.Assign. 80 type tcptopMapSpecs struct { 81 GadgetMntnsFilterMap *ebpf.MapSpec `ebpf:"gadget_mntns_filter_map"` 82 IpMap *ebpf.MapSpec `ebpf:"ip_map"` 83 } 84 85 // tcptopObjects contains all objects after they have been loaded into the kernel. 86 // 87 // It can be passed to loadTcptopObjects or ebpf.CollectionSpec.LoadAndAssign. 88 type tcptopObjects struct { 89 tcptopPrograms 90 tcptopMaps 91 } 92 93 func (o *tcptopObjects) Close() error { 94 return _TcptopClose( 95 &o.tcptopPrograms, 96 &o.tcptopMaps, 97 ) 98 } 99 100 // tcptopMaps contains all maps after they have been loaded into the kernel. 101 // 102 // It can be passed to loadTcptopObjects or ebpf.CollectionSpec.LoadAndAssign. 103 type tcptopMaps struct { 104 GadgetMntnsFilterMap *ebpf.Map `ebpf:"gadget_mntns_filter_map"` 105 IpMap *ebpf.Map `ebpf:"ip_map"` 106 } 107 108 func (m *tcptopMaps) Close() error { 109 return _TcptopClose( 110 m.GadgetMntnsFilterMap, 111 m.IpMap, 112 ) 113 } 114 115 // tcptopPrograms contains all programs after they have been loaded into the kernel. 116 // 117 // It can be passed to loadTcptopObjects or ebpf.CollectionSpec.LoadAndAssign. 118 type tcptopPrograms struct { 119 IgToptcpClean *ebpf.Program `ebpf:"ig_toptcp_clean"` 120 IgToptcpSdmsg *ebpf.Program `ebpf:"ig_toptcp_sdmsg"` 121 } 122 123 func (p *tcptopPrograms) Close() error { 124 return _TcptopClose( 125 p.IgToptcpClean, 126 p.IgToptcpSdmsg, 127 ) 128 } 129 130 func _TcptopClose(closers ...io.Closer) error { 131 for _, closer := range closers { 132 if err := closer.Close(); err != nil { 133 return err 134 } 135 } 136 return nil 137 } 138 139 // Do not access this directly. 140 // 141 //go:embed tcptop_arm64_bpfel.o 142 var _TcptopBytes []byte