Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F159186659
D55320.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
D55320.diff
View Options
diff --git a/sys/dev/dpaa2/dpaa2_ni.c b/sys/dev/dpaa2/dpaa2_ni.c
--- a/sys/dev/dpaa2/dpaa2_ni.c
+++ b/sys/dev/dpaa2/dpaa2_ni.c
@@ -192,6 +192,9 @@
#define DPAA2_NI_FD_ERR_SHIFT (0)
#define DPAA2_NI_FD_SL_MASK (0x1u)
#define DPAA2_NI_FD_SL_SHIFT (14)
+#define DPAA2_NI_FD_PTA_SHIFT (55-32)
+#define DPAA2_NI_FD_ASAL_SHIFT (48-32)
+#define DPAA2_NI_FD_ASAL_MASK (0xf)
#define DPAA2_NI_FD_LEN_MASK (0x3FFFFu)
#define DPAA2_NI_FD_OFFSET_MASK (0x0FFFu)
@@ -432,6 +435,9 @@
static int dpaa2_ni_fd_format(struct dpaa2_fd *);
static bool dpaa2_ni_fd_short_len(struct dpaa2_fd *);
static int dpaa2_ni_fd_offset(struct dpaa2_fd *);
+static bool dpaa2_ni_fd_pta(struct dpaa2_fd *);
+static size_t dpaa2_ni_fd_asal(struct dpaa2_fd *);
+static uint32_t dpaa2_ni_fd_frc(struct dpaa2_fd *);
/* Various subroutines */
static int dpaa2_ni_cmp_api_version(struct dpaa2_ni_softc *, uint16_t, uint16_t);
@@ -3142,8 +3148,9 @@
struct mbuf *m;
device_t bpdev;
bus_addr_t released[DPAA2_SWP_BUFS_PER_CMD];
- void *buf_data;
+ uint8_t *buf_data, *hdr;
int buf_len, error, released_n = 0;
+ bool check_asa;
KASSERT(fa->magic == DPAA2_MAGIC, ("%s: wrong magic", __func__));
/*
@@ -3170,11 +3177,14 @@
switch (dpaa2_ni_fd_format(fd)) {
case DPAA2_FD_SINGLE:
sc->rx_single_buf_frames++;
+ check_asa = true;
break;
case DPAA2_FD_SG:
sc->rx_sg_buf_frames++;
+ check_asa = true;
break;
default:
+ check_asa = false;
break;
}
@@ -3185,7 +3195,9 @@
bus_dmamap_unload(buf->dmat, buf->dmap);
m = buf->m;
buf_len = dpaa2_ni_fd_data_len(fd);
+ hdr = (uint8_t *)buf->vaddr;
buf_data = (uint8_t *)buf->vaddr + dpaa2_ni_fd_offset(fd);
+
/* Prepare buffer to be re-cycled */
buf->m = NULL;
buf->paddr = 0;
@@ -3196,6 +3208,75 @@
mtx_unlock(&bch->dma_mtx);
+ if (hdr != NULL && check_asa) {
+ size_t asal;
+ uint32_t frc;
+
+ /*
+ * If Accelerator-Specific Annotation Length is unset,
+ * there is not much for us to look at.
+ */
+ asal = dpaa2_ni_fd_asal(fd);
+ if (asal == 0)
+ goto skip_asal;
+
+ frc = dpaa2_ni_fd_frc(fd);
+ /*
+ * Check this is WRIOP information.
+ * Beware bit order in 7.30.2 WRIOP FD frame context (FRC).
+ */
+ if (((frc >> 28) & 0x2) != 0x2)
+ goto skip_asal;
+
+ /*
+ * Check if there are 64bit of software frame annotation
+ * and skip if there.
+ */
+ hdr += dpaa2_ni_fd_pta(fd) ? 64 : 0;
+
+ /*
+ * We are really only interested in FAS currently.
+ * Once this gets more, we should use a struct and
+ * also check that p + sizeof(struct ...) <= buf_data!.
+ */
+ if (hdr + sizeof(uint64_t) > (uint8_t *)buf_data)
+ goto skip_asal;
+
+ /* Hardware frame annotation. */
+
+ /*
+ * Check if FAS is valid on this frame.
+ * IOP_IFISPFF_<i>[ASAR] -> FD[FRC].FASV.
+ */
+ if ((frc & (1<<15)) != 0) {
+ uint64_t fas;
+
+ fas = *(uint64_t *)hdr;
+ /*
+ * Beware bit order in 7.33.3 Frame annotation status
+ * word (FAS).
+ */
+ /* L3CV */
+ if ((fas & (1ul<<35)) != 0) {
+ m->m_pkthdr.csum_flags |= CSUM_L3_CALC;
+ /* L3CE */
+ if ((fas & (1ul<<34)) == 0)
+ m->m_pkthdr.csum_flags |= CSUM_L3_VALID;
+ }
+
+ /* L4CV */
+ if ((fas & (1ul<<33)) != 0) {
+ m->m_pkthdr.csum_flags |= CSUM_L4_CALC;
+ m->m_pkthdr.csum_data = 0xffff;
+ /* L4CE */
+ if ((fas & (1ul<<32)) == 0)
+ m->m_pkthdr.csum_flags |= CSUM_L4_VALID;
+ }
+ }
+skip_asal:
+ ;
+ }
+
m->m_flags |= M_PKTHDR;
m->m_data = buf_data;
m->m_len = buf_len;
@@ -3467,6 +3548,24 @@
return (fd->offset_fmt_sl & DPAA2_NI_FD_OFFSET_MASK);
}
+static bool
+dpaa2_ni_fd_pta(struct dpaa2_fd *fd)
+{
+ return (((fd->ctrl >> DPAA2_NI_FD_PTA_SHIFT) & 0x1) != 0);
+}
+
+static size_t
+dpaa2_ni_fd_asal(struct dpaa2_fd *fd)
+{
+ return (((fd->ctrl >> DPAA2_NI_FD_ASAL_SHIFT) & DPAA2_NI_FD_ASAL_MASK) * 64);
+}
+
+static uint32_t
+dpaa2_ni_fd_frc(struct dpaa2_fd *fd)
+{
+ return (fd->frame_ctx);
+}
+
/**
* @brief Collect statistics of the network interface.
*/
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Jun 12, 2:09 AM (6 h, 19 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
33897224
Default Alt Text
D55320.diff (3 KB)
Attached To
Mode
D55320: dpaa2: dpaa2_ni_rx() RX checksum EN/ERR information for L3/4
Attached
Detach File
Event Timeline
Log In to Comment