From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5BE80A055E for ; Wed, 26 Feb 2020 07:29:55 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 240401BFB2; Wed, 26 Feb 2020 07:29:55 +0100 (CET) Received: from mail-pf1-f194.google.com (mail-pf1-f194.google.com [209.85.210.194]) by dpdk.org (Postfix) with ESMTP id 7D1631BFB2 for ; Wed, 26 Feb 2020 07:29:53 +0100 (CET) Received: by mail-pf1-f194.google.com with SMTP id n7so939626pfn.0 for ; Tue, 25 Feb 2020 22:29:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:cc:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=9Y6f8FqbQXBs+90efbRO5BI1TiysUxMpK2N7dGvGZ7A=; b=aabYVtTfLPsrvBtAwFAnHtTFqcPRW6qDt3qjP7Drvg4SieYuRb4kuEffGbqU+0cTwL Ik0gTWK5mlrwunN5yI8C4KhcpChEO/Ve/yb/zcq9bsQlF5EMeLaMNB9g9A7BZDiGTT0/ Y4K9Hg7o0La4AaZ2BHiRcw6p89CVSILhAkIs9mmBLtOmaxRmnxvAPNbcZT8H6bKQ41gc Mxcm88xT48ZwJOE75HQF3Ggl7inBkqXpafL065xohH7Xw37M9rzngIIlS8Bz2Yw5wOrt u2y0yBZlpmiAXBjyrPBLvcTkYTLKC/i+n3FglsYY5ABz7/HV+NOJoeQC5o3uWZrtiqRq 4V0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:cc:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=9Y6f8FqbQXBs+90efbRO5BI1TiysUxMpK2N7dGvGZ7A=; b=eNhxDE2K0XoUWtYQY/+UA11T2N9BITyz01RgfdyGyQFek9wrYWacFwUQ/OpXNBDrgQ b6gmUjJVTJDhp1FiU+ToQtnWfmdT48mA7wn133K+5sH5w8C1rKGlLS/ol4zzLea5WF3p dPyc5lle6TGiOatoA77J8Xe/SSz7GmBmNOuIZ2fI/GOPnxacx7BOpvwuUY9KRe7BINAR o6d04pLiEOGLV7qsF1w//MFUPlDtT7W3f8cfFAYcKECOViXhaSdrOnC80LkaN9m4pAns Uw0Ktc71rqYqALrYUHS3ZkVM1nq6OjdPO+BBAcFtCcanLW0nhv331RS3kgLhq1M0AqSF 5jqQ== X-Gm-Message-State: APjAAAWVY6coiDXrDZXF9xvZmgMvJ+bbrh9VBvt+cEc6hFpP6OeQ8a3j yjuYrxVsJFfQir83moIK+OQ= X-Google-Smtp-Source: APXvYqzW1H/zwWHfX/kKtVUcMa/Rm3WcQiAZ9IIQHiTwXU7Tpzvru6NSyXOFQ7wBONfg3hk17Y/ULg== X-Received: by 2002:a65:424d:: with SMTP id d13mr2407529pgq.128.1582698592604; Tue, 25 Feb 2020 22:29:52 -0800 (PST) Received: from mugwort.local ([192.47.164.146]) by smtp.gmail.com with ESMTPSA id 76sm1292852pfx.97.2020.02.25.22.29.50 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 25 Feb 2020 22:29:52 -0800 (PST) To: Itsuro Oda References: <20200226013746.2875-1-oda@valinux.co.jp> <20200226013746.2875-3-oda@valinux.co.jp> From: Yasufumi Ogawa Cc: spp@dpdk.org, ferruh.yigit@intel.com Message-ID: Date: Wed, 26 Feb 2020 15:29:47 +0900 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 In-Reply-To: <20200226013746.2875-3-oda@valinux.co.jp> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [spp] [PATCH 2/5] primary: suport pipe PMD X-BeenThere: spp@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Soft Patch Panel List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: spp-bounces@dpdk.org Sender: "spp" > This patch enables the primary to handle add/del request of > pipe PMD. The primary comes to return infomation of pipes in > the response of status request too. > > Signed-off-by: Itsuro Oda > --- > src/primary/main.c | 85 +++++++++++++++++++++++++++++++++++++++++----- > 1 file changed, 77 insertions(+), 8 deletions(-) > > diff --git a/src/primary/main.c b/src/primary/main.c > index d3828e8..8d6a83d 100644 > --- a/src/primary/main.c > +++ b/src/primary/main.c > @@ -27,7 +27,9 @@ > */ > #define PRI_BUF_SIZE_LCORE 128 > #define PRI_BUF_SIZE_PHY 512 This define was updated in a patch from Hideyuki, so it is failed to merge for a conflict. It might be other conflicts after that, but I haven't check it yet though. Could you update your patch with the latest code base which was updated yesterday. Thanks > -#define PRI_BUF_SIZE_RING (MSG_SIZE - PRI_BUF_SIZE_LCORE - PRI_BUF_SIZE_PHY) > +#define PRI_BUF_SIZE_PIPE 512 > +#define PRI_BUF_SIZE_RING \ > + (MSG_SIZE - PRI_BUF_SIZE_LCORE - PRI_BUF_SIZE_PHY - PRI_BUF_SIZE_PIPE) > > #define SPP_PATH_LEN 1024 /* seems enough for path of spp procs */ > #define NOF_TOKENS 48 /* seems enough to contain tokens */ > @@ -49,6 +51,7 @@ > struct port_id_map { > int port_id; > enum port_type type; > + int rx_ring_id, tx_ring_id; /* for pipe */ > }; > > struct port_id_map port_id_list[RTE_MAX_ETHPORTS]; > @@ -437,6 +440,10 @@ append_port_info_json(char *str, > sprintf(str + strlen(str), "\"memif:%u\",", > port_map[i].id); > break; > + case PIPE: > + sprintf(str + strlen(str), "\"pipe:%u\",", > + port_map[i].id); > + break; > case UNDEF: > /* TODO(yasufum) Need to remove print for undefined ? */ > sprintf(str + strlen(str), "\"udf\","); > @@ -521,6 +528,12 @@ append_patch_info_json(char *str, > "\"memif:%u\",", > port_map[i].id); > break; > + case PIPE: > + RTE_LOG(INFO, SHARED, "Type: PIPE\n"); > + sprintf(patch_str + strlen(patch_str), > + "\"pipe:%u\",", > + port_map[i].id); > + break; > case UNDEF: > RTE_LOG(INFO, PRIMARY, "Type: UDF\n"); > /* TODO(yasufum) Need to remove print for undefined ? */ > @@ -583,6 +596,12 @@ append_patch_info_json(char *str, > "\"memif:%u\"", > port_map[j].id); > break; > + case PIPE: > + RTE_LOG(INFO, SHARED, "Type: PIPE\n"); > + sprintf(patch_str + strlen(patch_str), > + "\"pipe:%u\"", > + port_map[j].id); > + break; > case UNDEF: > RTE_LOG(INFO, PRIMARY, "Type: UDF\n"); > /* > @@ -729,6 +748,34 @@ ring_port_stats_json(char *str) > return 0; > } > > +static int > +pipes_json(char *str) > +{ > + uint16_t dev_id; > + char pipe_buf[30]; /* it is enough if port_id < 1000 */ > + int find = 0; > + > + strcpy(str, "\"pipes\":["); > + for (dev_id = 0; dev_id < RTE_MAX_ETHPORTS; dev_id++) { > + if (port_id_list[dev_id].type != PIPE) > + continue; > + sprintf(pipe_buf, "{\"id\":%d,\"rx\":%d,\"tx\":%d}", > + port_id_list[dev_id].port_id, > + port_id_list[dev_id].rx_ring_id, > + port_id_list[dev_id].tx_ring_id); > + if (strlen(str) + strlen(pipe_buf) > PRI_BUF_SIZE_PIPE - 3) { > + RTE_LOG(ERR, PRIMARY, "Cannot send all of pipes\n"); > + break; > + } > + if (find) > + strcat(str, ","); > + find = 1; > + strcat(str, pipe_buf); > + } > + strcat(str, "]"); > + return 0; > +} > + > /** > * Retrieve all of statu of ports as JSON format managed by primary. > * > @@ -770,28 +817,33 @@ get_status_json(char *str) > char buf_lcores[PRI_BUF_SIZE_LCORE]; > char buf_phy_ports[PRI_BUF_SIZE_PHY]; > char buf_ring_ports[PRI_BUF_SIZE_RING]; > + char buf_pipes[PRI_BUF_SIZE_PIPE]; > memset(buf_phy_ports, '\0', PRI_BUF_SIZE_PHY); > memset(buf_ring_ports, '\0', PRI_BUF_SIZE_RING); > memset(buf_lcores, '\0', PRI_BUF_SIZE_LCORE); > + memset(buf_pipes, '\0', PRI_BUF_SIZE_PIPE); > > append_lcore_info_json(buf_lcores, lcore_id_used); > phy_port_stats_json(buf_phy_ports); > ring_port_stats_json(buf_ring_ports); > + pipes_json(buf_pipes); > > - RTE_LOG(INFO, PRIMARY, "%s, %s\n", buf_phy_ports, buf_ring_ports); > + RTE_LOG(INFO, PRIMARY, "%s, %s, %s\n", buf_phy_ports, buf_ring_ports, > + buf_pipes); > > if (get_forwarding_flg() == 1) { > char tmp_buf[512]; > memset(tmp_buf, '\0', sizeof(tmp_buf)); > forwarder_status_json(tmp_buf); > > - sprintf(str, "{%s,%s,%s,%s}", > + sprintf(str, "{%s,%s,%s,%s,%s}", > buf_lcores, tmp_buf, buf_phy_ports, > - buf_ring_ports); > + buf_ring_ports, buf_pipes); > > } else { > - sprintf(str, "{%s,%s,%s}", > - buf_lcores, buf_phy_ports, buf_ring_ports); > + sprintf(str, "{%s,%s,%s,%s}", > + buf_lcores, buf_phy_ports, buf_ring_ports, > + buf_pipes); > } > > return 0; > @@ -803,7 +855,7 @@ get_status_json(char *str) > */ > /* TODO(yasufum) consider to merge do_add in nfv/commands.h */ > static int > -add_port(char *p_type, int p_id) > +add_port(char *p_type, int p_id, char **token_list) > { > uint16_t dev_id; > uint16_t port_id; > @@ -840,6 +892,17 @@ add_port(char *p_type, int p_id) > res = add_null_pmd(p_id); > port_id_list[cnt].port_id = p_id; > port_id_list[cnt].type = NULLPMD; > + } else if (!strcmp(p_type, "pipe")) { > + char *dummy; > + res = add_pipe_pmd(p_id, token_list[0], token_list[1]); > + if (res < 0) > + return -1; > + port_id_list[cnt].port_id = p_id; > + port_id_list[cnt].type = PIPE; > + parse_resource_uid(token_list[0], &dummy, > + &port_id_list[cnt].rx_ring_id); > + parse_resource_uid(token_list[1], &dummy, > + &port_id_list[cnt].tx_ring_id); > } > > if (res < 0) > @@ -922,6 +985,12 @@ del_port(char *p_type, int p_id) > if (dev_id == PORT_RESET) > return -1; > dev_detach_by_port_id(dev_id); > + > + } else if (!strcmp(p_type, "pipe")) { > + dev_id = find_ethdev_id(p_id, PIPE); > + if (dev_id == PORT_RESET) > + return -1; > + dev_detach_by_port_id(dev_id); > } > > port_id_list[dev_id].port_id = PORT_RESET; > @@ -1022,7 +1091,7 @@ parse_command(char *str) > return ret; > } > > - if (add_port(p_type, p_id) < 0) { > + if (add_port(p_type, p_id, &token_list[2]) < 0) { > RTE_LOG(ERR, PRIMARY, "Failed to add_port()\n"); > sprintf(result, "%s", "\"failed\""); > } else >