Thread (41 messages) 41 messages, 5 authors, 2017-06-29

Re: [oss-drivers] Re: [PATCH net-next v2 7/9] nfp: add metadata to each flow offload

From: Jakub Kicinski <hidden>
Date: 2017-06-29 08:42:54

On Thu, 29 Jun 2017 10:14:29 +0200, Simon Horman wrote:
quoted
quoted
+	/* Checking if buffer is empty. */
+	if (ring->head == ring->tail) {
+		*mask_id = freed_id;
+		return -ENOENT;
+	}
+
+	memcpy(&temp_id, &ring->buf[ring->tail], NFP_FLOWER_MASK_ELEMENT_RS);
+	*mask_id = temp_id;
+	memcpy(&ring->buf[ring->tail], &freed_id, NFP_FLOWER_MASK_ELEMENT_RS);
+	ring->tail = (ring->tail + NFP_FLOWER_MASK_ELEMENT_RS) %
+		     (NFP_FLOWER_MASK_ENTRY_RS * NFP_FLOWER_MASK_ELEMENT_RS);
+
+	getnstimeofday64(&now);
+	delta = timespec64_sub(now, priv->mask_ids.last_used[*mask_id]);
+
+	if (timespec64_to_ns(&delta) < NFP_FL_MASK_REUSE_TIME_NS) {
+		nfp_release_mask_id(app, *mask_id);  
nfp_release_mask_id() will reset the time stamp and put the mask at the
end of the queue.  Is that OK?  
I discussed this with Pieter. He believes that it is ok as it would be too
early to use the entry and its better put it to the back of the list and
skip to the next one.
But we shouldn't update the "last use" time if the grace period haven't
elapsed otherwise we can live lock (I know, unlikely).  Could we simply
move the time check right after the:

	*mask_id = temp_id;

line?  I.e. move the check before we actually pick the mask off the
queue?
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help