From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f195.google.com (mail-wr0-f195.google.com [209.85.128.195]) by dpdk.org (Postfix) with ESMTP id C29B21B16C for ; Tue, 16 Jan 2018 16:32:10 +0100 (CET) Received: by mail-wr0-f195.google.com with SMTP id g21so15584838wrb.13 for ; Tue, 16 Jan 2018 07:32:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ZRgVGKHftiGeXyOT1WsovnNOwtUqhUZdZEZSwYbkfqo=; b=cVQyAfb8xYbOuGRZKgJqoAkW1TX5qez8RkWbNlYPpts3Vi1uAF7q3TyEW247842H41 N2ZWWNo/iiVPbOEroclAEmQWAWtl1A3rPvE3sXtnsMVmiCsJkVR2/S9/jfNILtz3olr+ DizILTJvy+Lk1PIA4SHuJl8Q+gVFS42iyTPKJn7oi+PQ3oYG5+YwcDF0keQLdWYXF2I6 IkEbNJfuqEmVwuMKQWSnYHOmsNpLK0ml/4DYd16EWFbdoZA7Al2TKtHzNGCzSfvBlWTV kGU1EkmkDD4+AGzfoVkThT+wRXVLOqwwQaT9xRt6cE94SemrAWWzOtDB7aOKC8HCnUOy d8Vg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ZRgVGKHftiGeXyOT1WsovnNOwtUqhUZdZEZSwYbkfqo=; b=eNa2H3BCnOI5mancerdIxU0MzJDs1sAJBbDwQXgS+GfLQIDnmTuw7D1k+8dAQxN77L 6+BSw9ClORPgJxNXRbZdLj+yLUwzbpedV4wbJInoIPvPbizCwF9OWRQA1g2NZ5Aj3pd6 zxB8iHuYbTEokuDt9r4aheHMkJYIkM+SFFjjVS52xB6AXtTKfvoZDZAK+OZvaOCtBvAw QG747kmfmmVNIJACQwGohuf0Dl+fO6GZ5I4YOClgnrWw9FJjRKmQAW+2xq9THYv17uJo 3U8xdTaIofQNLJgwMLlUyLZc+Qa03+xyCxt8cKupp6O0FDvRiJgeOELpPqtX3jeQrAdE rN6Q== X-Gm-Message-State: AKGB3mJlb0YkcmNT+drhKD/SFqh20wDJHMmVko0B1ddvxDDuRWdV+SK3 EtAexvUMzceBozJ/LTDYWx0= X-Google-Smtp-Source: ACJfBosVhzgxvYxuWLDsD9WLHDqvHkJHQS7CNF0Cb4fCrdXeZjLNKegGDnFqOo85Lhp2lrwYpmKCGw== X-Received: by 10.223.136.24 with SMTP id d24mr26709464wrd.203.1516116730533; Tue, 16 Jan 2018 07:32:10 -0800 (PST) Received: from ar771e-Precision-7520.edi.vyatta.net ([213.251.34.146]) by smtp.gmail.com with ESMTPSA id d8sm1485120wrf.88.2018.01.16.07.32.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 16 Jan 2018 07:32:09 -0800 (PST) From: alanrobertsonatt@gmail.com To: cristian.dumitrescu@intel.com Cc: dev@dpdk.org, Alan Robertson , Alan Robertson Date: Tue, 16 Jan 2018 15:31:57 +0000 Message-Id: <1516116717-24297-1-git-send-email-alanrobertsonatt@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515421317-6158-1-git-send-email-alanrobertsonatt@gmail.com> References: <1515421317-6158-1-git-send-email-alanrobertsonatt@gmail.com> Subject: [dpdk-dev] [PATCH v2] Allow -ve frame_overhead values X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Jan 2018 15:32:10 -0000 From: Alan Robertson 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 --- 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