2 // Copyright (c) 2010-2017 Intel Corporation
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
8 // http://www.apache.org/licenses/LICENSE-2.0
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
22 static inline void prefetch_nta(volatile void *p)
24 asm volatile ("prefetchnta %[p]" : [p] "+m" (*(volatile char *)p));
27 #ifdef PROX_PREFETCH_OFFSET
28 #define PREFETCH0(p) rte_prefetch0(p)
29 #define PREFETCH_OFFSET PROX_PREFETCH_OFFSET
31 #define PREFETCH0(p) do {} while (0)
32 #define PREFETCH_OFFSET 0
35 static inline void prefetch_pkts(__attribute__((unused)) struct rte_mbuf **mbufs, __attribute__((unused)) uint16_t n_pkts)
37 #ifdef PROX_PREFETCH_OFFSET
38 for (uint16_t j = 0; j < PROX_PREFETCH_OFFSET && j < n_pkts; ++j) {
41 for (uint16_t j = PROX_PREFETCH_OFFSET; j < n_pkts; ++j) {
43 PREFETCH0(rte_pktmbuf_mtod(mbufs[j - PROX_PREFETCH_OFFSET], void*));
45 for (uint16_t j = n_pkts - PROX_PREFETCH_OFFSET; j < n_pkts; ++j) {
46 PREFETCH0(rte_pktmbuf_mtod(mbufs[j], void*));
51 static inline void prefetch_first(__attribute__((unused)) struct rte_mbuf **mbufs, __attribute__((unused)) uint16_t n_pkts)
53 #ifdef PROX_PREFETCH_OFFSET
54 for (uint16_t j = 0; j < PROX_PREFETCH_OFFSET && j < n_pkts; ++j) {
57 for (uint16_t j = 1; j < PROX_PREFETCH_OFFSET && j < n_pkts; ++j) {
58 PREFETCH0(rte_pktmbuf_mtod(mbufs[j - 1], void *));
63 #endif /* _PREFETCH_H_ */