net/octeontx2: support link status
[dpdk.git] / drivers / net / octeontx2 / otx2_rx.h
index f29a054..257492a 100644 (file)
@@ -49,6 +49,8 @@ struct otx2_timesync_info {
        uint64_t        rx_tstamp;
        rte_iova_t      tx_tstamp_iova;
        uint64_t        *tx_tstamp;
+       uint64_t        rx_tstamp_dynflag;
+       int             tstamp_dynfield_offset;
        uint8_t         tx_ready;
        uint8_t         rx_ready;
 } __rte_cache_aligned;
@@ -63,6 +65,14 @@ union mbuf_initializer {
        uint64_t value;
 };
 
+static inline rte_mbuf_timestamp_t *
+otx2_timestamp_dynfield(struct rte_mbuf *mbuf,
+               struct otx2_timesync_info *info)
+{
+       return RTE_MBUF_DYNFIELD(mbuf,
+               info->tstamp_dynfield_offset, rte_mbuf_timestamp_t *);
+}
+
 static __rte_always_inline void
 otx2_nix_mbuf_to_tstamp(struct rte_mbuf *mbuf,
                        struct otx2_timesync_info *tstamp, const uint16_t flag,
@@ -77,15 +87,18 @@ otx2_nix_mbuf_to_tstamp(struct rte_mbuf *mbuf,
                /* Reading the rx timestamp inserted by CGX, viz at
                 * starting of the packet data.
                 */
-               mbuf->timestamp = rte_be_to_cpu_64(*tstamp_ptr);
+               *otx2_timestamp_dynfield(mbuf, tstamp) =
+                               rte_be_to_cpu_64(*tstamp_ptr);
                /* PKT_RX_IEEE1588_TMST flag needs to be set only in case
                 * PTP packets are received.
                 */
                if (mbuf->packet_type == RTE_PTYPE_L2_ETHER_TIMESYNC) {
-                       tstamp->rx_tstamp = mbuf->timestamp;
+                       tstamp->rx_tstamp =
+                                       *otx2_timestamp_dynfield(mbuf, tstamp);
                        tstamp->rx_ready = 1;
                        mbuf->ol_flags |= PKT_RX_IEEE1588_PTP |
-                               PKT_RX_IEEE1588_TMST | PKT_RX_TIMESTAMP;
+                               PKT_RX_IEEE1588_TMST |
+                               tstamp->rx_tstamp_dynflag;
                }
        }
 }
@@ -202,6 +215,7 @@ nix_cqe_xtract_mseg(const struct nix_rx_parse_s *rx,
                        iova_list = (const rte_iova_t *)(iova_list + 1);
                }
        }
+       mbuf->next = NULL;
 }
 
 static __rte_always_inline uint16_t
@@ -241,12 +255,12 @@ nix_rx_sec_mbuf_update(const struct nix_cqe_hdr_s *cq, struct rte_mbuf *m,
        spi = cq->tag & 0xFFFFF;
 
        sa = nix_rx_sec_sa_get(lookup_mem, spi, m->port);
-       m->udata64 = (uint64_t)sa->userdata;
+       *rte_security_dynfield(m) = sa->udata64;
 
        data = rte_pktmbuf_mtod(m, char *);
 
        if (sa->replay_win_sz) {
-               if (cpt_ipsec_antireplay_check(sa, data) < 0)
+               if (cpt_ipsec_ip_antireplay_check(sa, data) < 0)
                        return PKT_RX_SEC_OFFLOAD | PKT_RX_SEC_OFFLOAD_FAILED;
        }
 
@@ -317,10 +331,12 @@ otx2_nix_cqe_to_mbuf(const struct nix_cqe_hdr_s *cq, const uint32_t tag,
        *(uint64_t *)(&mbuf->rearm_data) = val;
        mbuf->pkt_len = len;
 
-       if (flag & NIX_RX_MULTI_SEG_F)
+       if (flag & NIX_RX_MULTI_SEG_F) {
                nix_cqe_xtract_mseg(rx, mbuf, val);
-       else
+       } else {
                mbuf->data_len = len;
+               mbuf->next = NULL;
+       }
 }
 
 #define CKSUM_F NIX_RX_OFFLOAD_CHECKSUM_F