From: Andrew Davis <afd@ti.com>
To: <a-limaye@ti.com>, <meta-arago@lists.yoctoproject.org>
Cc: <reatmon@ti.com>, <u-kumar1@ti.com>
Subject: Re: [meta-arago][master][PATCH v3] ti-test: Add mcrc64 test application
Date: Wed, 5 Feb 2025 08:49:51 -0600 [thread overview]
Message-ID: <2cee080e-5776-40c0-bd2d-b05f28a10d4b@ti.com> (raw)
In-Reply-To: <20250204071637.4141957-1-a-limaye@ti.com>
On 2/4/25 1:16 AM, Aniket Limaye via lists.yoctoproject.org wrote:
> From: Udit Kumar <u-kumar1@ti.com>
>
> Add mcrc64 test application recipe.
> This application is documented at[0].
Why?
Also the source shouldn't be here in the yocto recipe, how do you
expect the other distros we offer to make use of this?
Put it on github, or if it specifically testing some kernel interface
then maybe in the kernel source under tools/testing/crypto/ with the
other crypto userspace tests.
Andrew
>
> [0]: https://software-dl.ti.com/jacinto7/esd/processor-sdk-linux-j722s/10_01_00_04/exports/docs/linux/Foundational_Components/Kernel/Kernel_Drivers/MCRC64.html
>
> Signed-off-by: Udit Kumar <u-kumar1@ti.com>
> Signed-off-by: Aniket Limaye <a-limaye@ti.com>
> ---
> v3:
> * Ryan:
> - Maintain aplhabetical ordering of ti-test packages
>
> v2:
> * Denys:
> - Add required SUMMARY variable as per https://docs.yoctoproject.org/next/contributor-guide/recipe-style-guide.html#required-variables
> ---
> .../recipes-core/packagegroups/ti-test.bb | 1 +
> .../recipes-kernel/mcrc64/files/mcrc64.c | 114 ++++++++++++++++++
> .../recipes-kernel/mcrc64/mcrc64.bb | 18 +++
> 3 files changed, 133 insertions(+)
> create mode 100644 meta-arago-test/recipes-kernel/mcrc64/files/mcrc64.c
> create mode 100644 meta-arago-test/recipes-kernel/mcrc64/mcrc64.bb
>
> diff --git a/meta-arago-test/recipes-core/packagegroups/ti-test.bb b/meta-arago-test/recipes-core/packagegroups/ti-test.bb
> index 814e3ea6..857e06fb 100644
> --- a/meta-arago-test/recipes-core/packagegroups/ti-test.bb
> +++ b/meta-arago-test/recipes-core/packagegroups/ti-test.bb
> @@ -31,6 +31,7 @@ TI_TEST_BASE = "\
> linuxptp \
> lmbench \
> lsof \
> + mcrc64 \
> media-ctl \
> memtester \
> mstpd \
> diff --git a/meta-arago-test/recipes-kernel/mcrc64/files/mcrc64.c b/meta-arago-test/recipes-kernel/mcrc64/files/mcrc64.c
> new file mode 100644
> index 00000000..fc7a75d6
> --- /dev/null
> +++ b/meta-arago-test/recipes-kernel/mcrc64/files/mcrc64.c
> @@ -0,0 +1,114 @@
> +/*
> + * Copyright (C) 2025 Texas Instruments Incorporated - http://www.ti.com/
> + *
> + *
> + * Redistribution and use in source and binary forms, with or without
> + * modification, are permitted provided that the following conditions
> + * are met:
> + *
> + * Redistributions of source code must retain the above copyright
> + * notice, this list of conditions and the following disclaimer.
> + *
> + * Redistributions in binary form must reproduce the above copyright
> + * notice, this list of conditions and the following disclaimer in the
> + * documentation and/or other materials provided with the
> + * distribution.
> + *
> + * Neither the name of Texas Instruments Incorporated nor the names of
> + * its contributors may be used to endorse or promote products derived
> + * from this software without specific prior written permission.
> + *
> + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
> + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
> + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
> + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
> + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
> + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
> + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
> + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
> + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
> + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
> + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
> + *
> +*/
> +
> +#include <unistd.h>
> +#include <stdio.h>
> +#include <stdlib.h>
> +#include <sys/socket.h>
> +#include <linux/if_alg.h>
> +#include <string.h>
> +
> +#define BUFFER_SIZE 4096
> +#define SECTOR 4096
> +
> +int main (int argc, char **argv) {
> +
> + int desc[2] = { -1, -1 };
> +
> + struct sockaddr_alg sock = {
> + .salg_family = AF_ALG,
> + .salg_type = "hash",
> + .salg_name = "crc64-iso3309"
> + };
> +
> + if ((desc[0] = socket(AF_ALG, SOCK_SEQPACKET, 0)) == -1 ) {
> + perror("socket");
> + return -1;
> + }
> +
> + if( bind(desc[0], (struct sockaddr *) &sock, sizeof(sock)) != 0 ) {
> + perror("bind");
> + return -1;
> + }
> +
> + if( (desc[1] = accept(desc[0], NULL, 0)) == -1 )
> + return -1;
> +
> + if (argc != 2 || strlen(argv[1]) == 0) {
> + printf("Please specify filename\n");
> + return -1; // empty string
> + }
> +
> + FILE* file;
> + unsigned char *buffer;
> + if(posix_memalign((void *)&buffer, SECTOR, BUFFER_SIZE)) {
> + perror("posix_memalign failed");
> + return -1;
> + }
> +
> + file = fopen(argv[1], "rb");
> + if(file == NULL)
> + {
> + printf("An error occured while opening file: %s\n", argv[1]);
> + free(buffer);
> + return -1;
> + }
> +
> + while(!feof(file))
> + {
> + unsigned int count = fread(buffer, sizeof(char), BUFFER_SIZE, file);
> + if(ferror(file))
> + {
> + printf("An error occurred while accessing the file: %s\n", argv[1]);
> + fclose(file);
> + free(buffer);
> + return -1;
> + }
> +
> + if (send(desc[1], buffer, count, MSG_MORE) != count) {
> + free(buffer);
> + return -1;
> + }
> + }
> +
> + long int crc64 = 0x0000000000000000;
> + if(read(desc[1], &crc64, 8) != 8) {
> + free(buffer);
> + return -1;
> + }
> +
> + printf("0x%llx\n", crc64);
> + free(buffer);
> + return 0;
> +}
> diff --git a/meta-arago-test/recipes-kernel/mcrc64/mcrc64.bb b/meta-arago-test/recipes-kernel/mcrc64/mcrc64.bb
> new file mode 100644
> index 00000000..a707430d
> --- /dev/null
> +++ b/meta-arago-test/recipes-kernel/mcrc64/mcrc64.bb
> @@ -0,0 +1,18 @@
> +SUMMARY = "Application to test MCRC64 driver"
> +LICENSE = "BSD-3-Clause"
> +LIC_FILES_CHKSUM = "file://mcrc64.c;beginline=1;endline=33;md5=070547e79367134fcfdf7fdb5e3ef7e3"
> +
> +SRC_URI = "file://mcrc64.c"
> +
> +S = "${WORKDIR}/sources"
> +UNPACKDIR = "${S}"
> +
> +do_compile() {
> + ${CC} ${CFLAGS} ${LDFLAGS} ${UNPACKDIR}/mcrc64.c -o mcrc64
> +}
> +
> +
> +do_install() {
> + install -d ${D}${bindir}
> + install -m 0755 mcrc64 ${D}${bindir}
> +}
next prev parent reply other threads:[~2025-02-05 14:49 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-04 7:16 [meta-arago][master][PATCH v3] ti-test: Add mcrc64 test application Aniket Limaye
2025-02-05 14:49 ` Andrew Davis [this message]
2025-02-05 16:49 ` [EXTERNAL] " Chirag Shilwant
2025-02-05 18:13 ` Kumar, Udit
2025-02-05 19:12 ` [EXTERNAL] " Andrew Davis
2025-02-06 16:22 ` Chirag Shilwant
2025-02-05 19:13 ` Ryan Eatmon
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=2cee080e-5776-40c0-bd2d-b05f28a10d4b@ti.com \
--to=afd@ti.com \
--cc=a-limaye@ti.com \
--cc=meta-arago@lists.yoctoproject.org \
--cc=reatmon@ti.com \
--cc=u-kumar1@ti.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.