DPDK patches and discussions
 help / color / mirror / Atom feed
From: Anatoly Burakov <anatoly.burakov@intel.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH 09/10] ip_reassembly: small fixes
Date: Wed, 18 Jun 2014 15:50:36 +0100	[thread overview]
Message-ID: <f84b9b754d7383e0ebad48428434809599e7adda.1403102825.git.anatoly.burakov@intel.com> (raw)
In-Reply-To: <cover.1403102825.git.anatoly.burakov@intel.com>
In-Reply-To: <cover.1403102825.git.anatoly.burakov@intel.com>

Adding check for non-existent ports in portmask.

Also, making everything NUMA-related depend on lcore sockets, not device
sockets. This is because the init_mem() function allocates all data
structures based on NUMA nodes of the lcores in the coremask. Therefore,
when no cores are on socket 0, but there are devices on socket 0, it may
lead to segmentation faults.

Also, making ip_reassembly eat up a bit less memory.

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
 examples/ip_reassembly/main.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/examples/ip_reassembly/main.c b/examples/ip_reassembly/main.c
index 7311b29..1b60e41 100644
--- a/examples/ip_reassembly/main.c
+++ b/examples/ip_reassembly/main.c
@@ -942,15 +942,15 @@ setup_queue_tbl(struct rx_queue *rxq, uint32_t lcore, uint32_t queue)
 	}
 
 	/*
-	 * At any given moment up to <max_flow_num * (MAX_FRAG_NUM - 1)>
+	 * At any given moment up to <max_flow_num * (MAX_FRAG_NUM)>
 	 * mbufs could be stored int the fragment table.
 	 * Plus, each TX queue can hold up to <max_flow_num> packets.
 	 */
 
-	nb_mbuf = 2 * RTE_MAX(max_flow_num, 2UL * MAX_PKT_BURST) * MAX_FRAG_NUM;
+	nb_mbuf = RTE_MAX(max_flow_num, 2UL * MAX_PKT_BURST) * MAX_FRAG_NUM;
 	nb_mbuf *= (port_conf.rxmode.max_rx_pkt_len + BUF_SIZE - 1) / BUF_SIZE;
-	nb_mbuf += RTE_TEST_RX_DESC_DEFAULT + RTE_TEST_TX_DESC_DEFAULT;
 	nb_mbuf *= 2; /* ipv4 and ipv6 */
+	nb_mbuf += RTE_TEST_RX_DESC_DEFAULT + RTE_TEST_TX_DESC_DEFAULT;
 
 	nb_mbuf = RTE_MAX(nb_mbuf, (uint32_t)NB_MBUF);
 
@@ -1093,6 +1093,10 @@ MAIN(int argc, char **argv)
 	if (init_mem() < 0)
 		rte_panic("Cannot initialize memory structures!\n");
 
+	/* check if portmask has non-existent ports */
+	if (enabled_port_mask & ~(RTE_LEN2MASK(nb_ports, unsigned)))
+		rte_exit(EXIT_FAILURE, "Non-existent ports in portmask!\n");
+
 	/* initialize all ports */
 	for (portid = 0; portid < nb_ports; portid++) {
 		/* skip ports that are not enabled */
@@ -1114,7 +1118,7 @@ MAIN(int argc, char **argv)
 			qconf = &lcore_queue_conf[rx_lcore_id];
 		}
 
-		socket = rte_eth_dev_socket_id(portid);
+		socket = rte_lcore_to_socket_id(portid);
 		if (socket == SOCKET_ID_ANY)
 			socket = 0;
 
-- 
1.8.1.4

  parent reply	other threads:[~2014-06-18 14:51 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-18 14:50 [dpdk-dev] [PATCH 00/10] rte_ip_frag: various fixes for lib and examples Anatoly Burakov
2014-06-18 14:50 ` [dpdk-dev] [PATCH 01/10] ip_frag: rename RTE_IP_FRAG_ASSERT to IP_FRAG_ASSERT Anatoly Burakov
2014-06-18 14:50 ` [dpdk-dev] [PATCH 02/10] ip_frag: fix debug macros Anatoly Burakov
2014-06-18 14:50 ` [dpdk-dev] [PATCH 03/10] ip_frag: renaming rte_ip_frag_pkt to ip_frag_pkt Anatoly Burakov
2014-06-18 14:50 ` [dpdk-dev] [PATCH 04/10] ip_frag: fix stats macro, rename rte_ip_frag_tbl_stat structure Anatoly Burakov
2014-06-18 14:50 ` [dpdk-dev] [PATCH 05/10] ip_frag: small fix, replace hardcode with a macro Anatoly Burakov
2014-06-18 14:50 ` [dpdk-dev] [PATCH 06/10] ip_frag: replace memmove with custom copying Anatoly Burakov
2014-06-18 14:50 ` [dpdk-dev] [PATCH 07/10] ip_frag: fix order of arguments to key compare function Anatoly Burakov
2014-06-18 14:50 ` [dpdk-dev] [PATCH 08/10] ip_fragmentation: small fixes Anatoly Burakov
2014-06-18 14:50 ` Anatoly Burakov [this message]
2014-06-18 14:50 ` [dpdk-dev] [PATCH 10/10] rte_ip_frag: API header file fix Anatoly Burakov
2014-06-26 21:10 ` [dpdk-dev] [PATCH 00/10] rte_ip_frag: various fixes for lib and examples Thomas Monjalon

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=f84b9b754d7383e0ebad48428434809599e7adda.1403102825.git.anatoly.burakov@intel.com \
    --to=anatoly.burakov@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).