eal: introduce macro for always inline
[dpdk.git] / examples / l3fwd / l3fwd_sse.h
index 3d344d0..6cb1a64 100644 (file)
@@ -57,8 +57,8 @@
  * If we encounter invalid IPV4 packet, then set destination port for it
  * to BAD_PORT value.
  */
-static inline __attribute__((always_inline)) void
-rfc1812_process(struct ipv4_hdr *ipv4_hdr, uint32_t *dp, uint32_t ptype)
+static __rte_always_inline void
+rfc1812_process(struct ipv4_hdr *ipv4_hdr, uint16_t *dp, uint32_t ptype)
 {
        uint8_t ihl;
 
@@ -85,7 +85,7 @@ rfc1812_process(struct ipv4_hdr *ipv4_hdr, uint32_t *dp, uint32_t ptype)
  * Perform RFC1812 checks and updates for IPV4 packets.
  */
 static inline void
-processx4_step3(struct rte_mbuf *pkt[FWDSTEP], uint32_t dst_port[FWDSTEP])
+processx4_step3(struct rte_mbuf *pkt[FWDSTEP], uint16_t dst_port[FWDSTEP])
 {
        __m128i te[FWDSTEP];
        __m128i ve[FWDSTEP];
@@ -283,9 +283,9 @@ port_groupx4(uint16_t pn[FWDSTEP + 1], uint16_t *lp, __m128i dp1, __m128i dp2)
 
        /* if dest port value has changed. */
        if (v != GRPMSK) {
-               lp = pnum->u16 + gptbl[v].idx;
-               lp[0] = 1;
                pnum->u64 = gptbl[v].pnum;
+               pnum->u16[FWDSTEP] = 1;
+               lp = pnum->u16 + gptbl[v].idx;
        }
 
        return lp;
@@ -297,7 +297,7 @@ port_groupx4(uint16_t pn[FWDSTEP + 1], uint16_t *lp, __m128i dp1, __m128i dp2)
  * Perform RFC1812 checks and updates for IPV4 packets.
  */
 static inline void
-process_packet(struct rte_mbuf *pkt, uint32_t *dst_port)
+process_packet(struct rte_mbuf *pkt, uint16_t *dst_port)
 {
        struct ether_hdr *eth_hdr;
        __m128i te, ve;
@@ -314,7 +314,7 @@ process_packet(struct rte_mbuf *pkt, uint32_t *dst_port)
        _mm_storeu_si128((__m128i *)eth_hdr, te);
 }
 
-static inline __attribute__((always_inline)) void
+static __rte_always_inline void
 send_packetsx4(struct lcore_conf *qconf, uint8_t port, struct rte_mbuf *m[],
                uint32_t num)
 {
@@ -349,12 +349,15 @@ send_packetsx4(struct lcore_conf *qconf, uint8_t port, struct rte_mbuf *m[],
        case 0:
                qconf->tx_mbufs[port].m_table[len + j] = m[j];
                j++;
+               /* fall-through */
        case 3:
                qconf->tx_mbufs[port].m_table[len + j] = m[j];
                j++;
+               /* fall-through */
        case 2:
                qconf->tx_mbufs[port].m_table[len + j] = m[j];
                j++;
+               /* fall-through */
        case 1:
                qconf->tx_mbufs[port].m_table[len + j] = m[j];
                j++;
@@ -376,12 +379,15 @@ send_packetsx4(struct lcore_conf *qconf, uint8_t port, struct rte_mbuf *m[],
                case 0:
                        qconf->tx_mbufs[port].m_table[j] = m[n + j];
                        j++;
+                       /* fall-through */
                case 3:
                        qconf->tx_mbufs[port].m_table[j] = m[n + j];
                        j++;
+                       /* fall-through */
                case 2:
                        qconf->tx_mbufs[port].m_table[j] = m[n + j];
                        j++;
+                       /* fall-through */
                case 1:
                        qconf->tx_mbufs[port].m_table[j] = m[n + j];
                        j++;
@@ -395,9 +401,9 @@ send_packetsx4(struct lcore_conf *qconf, uint8_t port, struct rte_mbuf *m[],
 /**
  * Send packets burst from pkts_burst to the ports in dst_port array
  */
-static inline __attribute__((always_inline)) void
+static __rte_always_inline void
 send_packets_multi(struct lcore_conf *qconf, struct rte_mbuf **pkts_burst,
-               uint32_t dst_port[MAX_PKT_BURST], int nb_rx)
+               uint16_t dst_port[MAX_PKT_BURST], int nb_rx)
 {
        int32_t k;
        int j = 0;
@@ -464,10 +470,12 @@ send_packets_multi(struct lcore_conf *qconf, struct rte_mbuf **pkts_burst,
                process_packet(pkts_burst[j], dst_port + j);
                GROUP_PORT_STEP(dlp, dst_port, lp, pnum, j);
                j++;
+               /* fall-through */
        case 2:
                process_packet(pkts_burst[j], dst_port + j);
                GROUP_PORT_STEP(dlp, dst_port, lp, pnum, j);
                j++;
+               /* fall-through */
        case 1:
                process_packet(pkts_burst[j], dst_port + j);
                GROUP_PORT_STEP(dlp, dst_port, lp, pnum, j);