Lines Matching refs:idx

80 /* The bpf_mprog_{replace,delete}() operate on exact idx position with the
82 * case of front idx is -1, in case of back idx is bpf_mprog_total(entry).
86 * idx + before:
88 * Insert P4 before P3: idx for old array is 1, idx for new array is 2,
89 * hence we adjust target idx for the new array, so that memmove copies
90 * P1 and P2 to the new entry, and we insert P4 into idx 2. Inserting
91 * before P1 would have old idx -1 and new idx 0.
97 * idx + after:
99 * Insert P4 after P2: idx for old array is 2, idx for new array is 2.
101 * into idx 2. Inserting after P3 would have both old/new idx at 4 aka
110 struct bpf_tuple *ntuple, int idx)
116 bpf_mprog_read(entry, idx, &fp, &cp);
129 struct bpf_tuple *ntuple, int idx, u32 flags)
138 if (idx == total)
141 idx += 1;
142 bpf_mprog_entry_grow(peer, idx);
144 bpf_mprog_read(peer, idx, &fp, &cp);
153 struct bpf_tuple *dtuple, int idx)
160 if (idx == -1)
161 idx = 0;
162 else if (idx == total)
163 idx = total - 1;
164 bpf_mprog_entry_shrink(peer, idx);
238 int ret, idx = -ERANGE, tidx;
255 idx = tidx;
262 if (tidx < -1 || (idx >= -1 && tidx != idx)) {
266 idx = tidx;
270 if (tidx < -1 || (idx >= -1 && tidx != idx)) {
274 idx = tidx;
276 if (idx < -1) {
281 idx = bpf_mprog_total(entry);
284 if (idx >= bpf_mprog_max()) {
289 ret = bpf_mprog_replace(entry, entry_new, &ntuple, idx);
291 ret = bpf_mprog_insert(entry, entry_new, &ntuple, idx, flags);
298 struct bpf_tuple *tuple, int idx)
306 if (idx == -1)
307 idx = 0;
308 else if (idx == total)
309 idx = total - 1;
310 bpf_mprog_read(entry, idx, &fp, &cp);
314 * case it gets populated here based on idx, or with filled tuple
337 int ret, idx = -ERANGE, tidx;
356 idx = tidx;
360 if (tidx < -1 || (idx >= -1 && tidx != idx)) {
364 idx = tidx;
368 if (tidx < -1 || (idx >= -1 && tidx != idx)) {
372 idx = tidx;
374 if (idx < -1) {
379 idx = bpf_mprog_total(entry);
382 if (idx >= bpf_mprog_max()) {
386 ret = bpf_mprog_fetch(entry, &dtuple, idx);
389 ret = bpf_mprog_delete(entry, entry_new, &dtuple, idx);