DPDK patches and discussions
 help / color / mirror / Atom feed
From: alanrobertsonatt@gmail.com
To: cristian.dumitrescu@intel.com
Cc: dev@dpdk.org, Alan Robertson <ar771e@att.com>,
	Alan Robertson <alan.robertson@att.com>
Subject: [dpdk-dev] [PATCH v2] Allow -ve frame_overhead values
Date: Tue, 16 Jan 2018 15:31:57 +0000	[thread overview]
Message-ID: <1516116717-24297-1-git-send-email-alanrobertsonatt@gmail.com> (raw)
In-Reply-To: <1515421317-6158-1-git-send-email-alanrobertsonatt@gmail.com>

From: Alan Robertson <ar771e@att.com>

When forwarding traffic across a TDM network the ethernet header will
be replaced with a ML-PPP one thereby reducing the size of the packet.

Signed-off-by: Alan Robertson <alan.robertson@att.com>
---
 lib/librte_sched/rte_sched.c | 14 +++++++++++++-
 lib/librte_sched/rte_sched.h |  5 +++--
 2 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/lib/librte_sched/rte_sched.c b/lib/librte_sched/rte_sched.c
index ad2f7c6d5..c971fd0d4 100644
--- a/lib/librte_sched/rte_sched.c
+++ b/lib/librte_sched/rte_sched.c
@@ -187,7 +187,7 @@ struct rte_sched_port {
 	uint32_t n_pipes_per_subport;
 	uint32_t rate;
 	uint32_t mtu;
-	uint32_t frame_overhead;
+	int32_t frame_overhead;
 	uint16_t qsize[RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE];
 	uint32_t n_pipe_profiles;
 	uint32_t pipe_tc3_rate_max;
@@ -1591,6 +1591,10 @@ grinder_credits_check(struct rte_sched_port *port, uint32_t pos)
 	uint32_t pipe_tc_credits = pipe->tc_credits[tc_index];
 	int enough_credits;
 
+#ifdef RTE_SCHED_DEBUG
+	assert((int)(pkt->pkt_len + port->frame_overhead) > 0);
+#endif /* RTE_SCHED_DEBUG */
+
 	/* Check queue credits */
 	enough_credits = (pkt_len <= subport_tb_credits) &&
 		(pkt_len <= subport_tc_credits) &&
@@ -1629,6 +1633,10 @@ grinder_credits_check(struct rte_sched_port *port, uint32_t pos)
 	uint32_t pipe_tc_ov_credits = pipe_tc_ov_mask1[tc_index];
 	int enough_credits;
 
+#ifdef RTE_SCHED_DEBUG
+	assert((int)(pkt->pkt_len + port->frame_overhead) > 0);
+#endif /* RTE_SCHED_DEBUG */
+
 	/* Check pipe and subport credits */
 	enough_credits = (pkt_len <= subport_tb_credits) &&
 		(pkt_len <= subport_tc_credits) &&
@@ -1663,6 +1671,10 @@ grinder_schedule(struct rte_sched_port *port, uint32_t pos)
 	if (!grinder_credits_check(port, pos))
 		return 0;
 
+#ifdef RTE_SCHED_DEBUG
+	assert((int)(pkt->pkt_len + port->frame_overhead) > 0);
+#endif /* RTE_SCHED_DEBUG */
+
 	/* Advance port time */
 	port->time += pkt_len;
 
diff --git a/lib/librte_sched/rte_sched.h b/lib/librte_sched/rte_sched.h
index 5d2a688dc..3e135c1e5 100644
--- a/lib/librte_sched/rte_sched.h
+++ b/lib/librte_sched/rte_sched.h
@@ -190,8 +190,9 @@ struct rte_sched_port_params {
 	uint32_t mtu;                    /**< Maximum Ethernet frame size
 					  * (measured in bytes).
 					  * Should not include the framing overhead. */
-	uint32_t frame_overhead;         /**< Framing overhead per packet
-					  * (measured in bytes) */
+	int32_t frame_overhead;
+	/**< Framing overhead per packet (measured in bytes).
+	 * Can have negative value. */
 	uint32_t n_subports_per_port;    /**< Number of subports */
 	uint32_t n_pipes_per_subport;    /**< Number of pipes per subport */
 	uint16_t qsize[RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE];
-- 
2.11.0

  reply	other threads:[~2018-01-16 15:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-08 14:21 [dpdk-dev] [PATCH] " alanrobertsonatt
2018-01-16 15:31 ` alanrobertsonatt [this message]
2018-05-03 17:03   ` [dpdk-dev] [PATCH v2] " Dumitrescu, Cristian

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1516116717-24297-1-git-send-email-alanrobertsonatt@gmail.com \
    --to=alanrobertsonatt@gmail.com \
    --cc=alan.robertson@att.com \
    --cc=ar771e@att.com \
    --cc=cristian.dumitrescu@intel.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).