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 AF5C2A0613 for ; Thu, 26 Sep 2019 15:47:40 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 7B52531FC; Thu, 26 Sep 2019 15:47:40 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 94D942C36 for ; Thu, 26 Sep 2019 15:47:38 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Sep 2019 06:47:37 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,552,1559545200"; d="scan'208";a="364732608" Received: from irsmsx154.ger.corp.intel.com ([163.33.192.96]) by orsmga005.jf.intel.com with ESMTP; 26 Sep 2019 06:47:36 -0700 Received: from irsmsx105.ger.corp.intel.com ([169.254.7.164]) by IRSMSX154.ger.corp.intel.com ([169.254.12.160]) with mapi id 14.03.0439.000; Thu, 26 Sep 2019 14:47:35 +0100 From: "Ananyev, Konstantin" To: "Iremonger, Bernard" , "dev@dpdk.org" , "akhil.goyal@nxp.com" Thread-Topic: [PATCH 1/2] examples/ipsec-secgw: set default to IPsec library mode Thread-Index: AQHVXkgbszNKXbQ7/keW9z+FFiTcD6c+JCeg Date: Thu, 26 Sep 2019 13:47:35 +0000 Message-ID: <2601191342CEEE43887BDE71AB977258019196B20C@irsmsx105.ger.corp.intel.com> References: <1567069173-10505-1-git-send-email-bernard.iremonger@intel.com> <1567069173-10505-2-git-send-email-bernard.iremonger@intel.com> In-Reply-To: <1567069173-10505-2-git-send-email-bernard.iremonger@intel.com> Accept-Language: en-IE, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiZjRmODgxNjItOTA2YS00MmYzLTk0NmEtZTYzZDdhYjg4ODBhIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiZTlOd09RWk5tV25LWDc2ZFVLeVwvY0w0MlRVWmJCN2hReWhoQWQwcW8wblwvd20zbW0rbGxCXC8xXC9sS2RFbXlDZFUifQ== x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.2.0.6 dlp-reaction: no-action x-originating-ip: [163.33.239.181] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH 1/2] examples/ipsec-secgw: set default to IPsec library mode 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" >=20 > Set the default code path to librte_ipsec mode. > Add parameter 0 | 1 to -l option > Check for conflicting options, -w -a -e and reassembly options are > not supported in legacy mode. > Show fragment table size. > Update print_usage. > Update the ipsec-secgw guide. > Update the release notes. >=20 > Signed-off-by: Bernard Iremonger > --- > doc/guides/rel_notes/release_19_11.rst | 8 ++++++ > doc/guides/sample_app_ug/ipsec_secgw.rst | 6 +++-- > examples/ipsec-secgw/ipsec-secgw.c | 44 ++++++++++++++++++++------= ------ > 3 files changed, 40 insertions(+), 18 deletions(-) >=20 > diff --git a/doc/guides/rel_notes/release_19_11.rst b/doc/guides/rel_note= s/release_19_11.rst > index 8490d89..70143c5 100644 > --- a/doc/guides/rel_notes/release_19_11.rst > +++ b/doc/guides/rel_notes/release_19_11.rst > @@ -56,6 +56,14 @@ New Features > Also, make sure to start the actual text at the margin. > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >=20 > +* **Updated the IPsec Security Gateway application.** > + > + The ``librte_ipsec`` code path is now the default code path in > + ``ipsec-secgw`` > + > + * The ``-l`` command line option has been extended to take a 0 | 1 arg= ument. > + 0 enables the code path that uses legacy code. > + 1 enables the code path that uses ``librte_ipsec``. >=20 > Removed Items > ------------- > diff --git a/doc/guides/sample_app_ug/ipsec_secgw.rst b/doc/guides/sample= _app_ug/ipsec_secgw.rst > index ad2d79e..17b00c0 100644 > --- a/doc/guides/sample_app_ug/ipsec_secgw.rst > +++ b/doc/guides/sample_app_ug/ipsec_secgw.rst > @@ -92,7 +92,7 @@ The application has a number of command line options:: >=20 > ./build/ipsec-secgw [EAL options] -- > -p PORTMASK -P -u PORTMASK -j FRAMESIZE > - -l -w REPLAY_WINOW_SIZE -e -a > + -l 0 -w REPLAY_WINOW_SIZE -e -a > --config (port,queue,lcore)[,(port,queue,lcore] > --single-sa SAIDX > --rxoffload MASK > @@ -120,7 +120,9 @@ Where: > Minimum value: RTE_MBUF_DEFAULT_BUF_SIZE (2176) > Maximum value: UINT16_MAX (65535). >=20 > -* ``-l``: enables code-path that uses librte_ipsec. > +* ``-l 0 | 1``: Default is ``librte_ipsec`` code path. > + 0 enables the code path that uses legacy code. > + 1 enables the code path that uses ``librte_ipsec``. >=20 > * ``-w REPLAY_WINOW_SIZE``: specifies the IPsec sequence number replay= window > size for each Security Association (available only with librte_ipsec > diff --git a/examples/ipsec-secgw/ipsec-secgw.c b/examples/ipsec-secgw/ip= sec-secgw.c > index 0d1fd6a..3e4b9e0 100644 > --- a/examples/ipsec-secgw/ipsec-secgw.c > +++ b/examples/ipsec-secgw/ipsec-secgw.c > @@ -188,7 +188,7 @@ static uint32_t frame_buf_size =3D RTE_MBUF_DEFAULT_B= UF_SIZE; > static uint32_t mtu_size =3D RTE_ETHER_MTU; >=20 > /* application wide librte_ipsec/SA parameters */ > -struct app_sa_prm app_sa_prm =3D {.enable =3D 0}; > +struct app_sa_prm app_sa_prm =3D {.enable =3D 1}; >=20 > struct lcore_rx_queue { > uint16_t port_id; > @@ -1259,7 +1259,7 @@ print_usage(const char *prgname) > " [-P]" > " [-u PORTMASK]" > " [-j FRAMESIZE]" > - " [-l]" > + " [-l 0 | 1]" > " [-w REPLAY_WINDOW_SIZE]" > " [-e]" > " [-a]" > @@ -1277,7 +1277,8 @@ print_usage(const char *prgname) > " -u PORTMASK: Hexadecimal bitmask of unprotected ports\n" > " -j FRAMESIZE: Data buffer size, minimum (and default)\n" > " value: RTE_MBUF_DEFAULT_BUF_SIZE\n" > - " -l enables code-path that uses librte_ipsec\n" > + " -l 0 enables code-path that uses the legacy code\n" > + " -l 1 enables code-path that uses librte_ipsec\n" > " -w REPLAY_WINDOW_SIZE specifies IPsec SQN replay window\n" > " size for each SA\n" > " -e enables ESN\n" > @@ -1418,6 +1419,7 @@ print_app_sa_prm(const struct app_sa_prm *prm) > printf("replay window size: %u\n", prm->window_size); > printf("ESN: %s\n", (prm->enable_esn =3D=3D 0) ? "disabled" : "enabled"= ); > printf("SA flags: %#" PRIx64 "\n", prm->flags); > + printf("Fragment Table size %u\n", frag_tbl_sz); > } >=20 > static int32_t > @@ -1431,7 +1433,7 @@ parse_args(int32_t argc, char **argv) >=20 > argvopt =3D argv; >=20 > - while ((opt =3D getopt_long(argc, argvopt, "aelp:Pu:f:j:w:", > + while ((opt =3D getopt_long(argc, argvopt, "aep:Pu:f:j:w:l:", > lgopts, &option_index)) !=3D EOF) { >=20 > switch (opt) { > @@ -1483,18 +1485,28 @@ parse_args(int32_t argc, char **argv) > printf("Custom frame buffer size %u\n", frame_buf_size); > break; > case 'l': > - app_sa_prm.enable =3D 1; > + ret =3D parse_decimal(optarg); > + if (ret =3D=3D -1) { > + printf("Invalid argument l %s\n", optarg); Just as a nit, probably a bit better: printf("Invalid argument: \'%s\' for: \'%c\' option\n", optarg, opt); Apart from that: Acked-by: Konstantin Ananyev Tested-by: Konstantin Ananyev > + print_usage(prgname); > + return -1; > + } else if (ret =3D=3D 0) > + app_sa_prm.enable =3D 0; > + else if (ret =3D=3D 1) > + app_sa_prm.enable =3D 1; > + else { > + printf("Invalid argument l %d\n", ret); > + print_usage(prgname); > + return -1; > + } > break; > case 'w': > - app_sa_prm.enable =3D 1; > app_sa_prm.window_size =3D parse_decimal(optarg); > break; > case 'e': > - app_sa_prm.enable =3D 1; > app_sa_prm.enable_esn =3D 1; > break; > case 'a': > - app_sa_prm.enable =3D 1; > app_sa_prm.flags |=3D RTE_IPSEC_SAFLAG_SQN_ATOM; > break; > case CMD_LINE_OPT_CONFIG_NUM: > @@ -1579,14 +1591,14 @@ parse_args(int32_t argc, char **argv) > return -1; > } >=20 > - /* check do we need to enable multi-seg support */ > - if (multi_seg_required()) { > - /* legacy mode doesn't support multi-seg */ > - app_sa_prm.enable =3D 1; > - printf("frame buf size: %u, mtu: %u, " > - "number of reassemble entries: %u\n" > - "multi-segment support is required\n", > - frame_buf_size, mtu_size, frag_tbl_sz); > + if (app_sa_prm.enable =3D=3D 0 && > + (app_sa_prm.window_size > 0 || > + app_sa_prm.enable_esn || > + app_sa_prm.flags !=3D 0 || > + multi_seg_required())) { > + printf("-w -e -a and reassembly options are not " > + "supported in legacy mode\n"); > + return -1; > } >=20 > print_app_sa_prm(&app_sa_prm); > -- > 2.7.4