All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@intel.com>
To: Ravi Kishore Koppuravuri <ravi.kishore.koppuravuri@intel.com>,
	igt-dev@lists.freedesktop.org
Cc: riana.tauro@intel.com, anshuman.gupta@intel.com,
	mallesh.koujalagi@intel.com, raag.jadav@intel.com,
	soham.purkait@intel.com,
	Ravi Kishore Koppuravuri <ravi.kishore.koppuravuri@intel.com>
Subject: Re: [PATCH v3 03/10] lib/igt_drm_netlink: Introduce DRM RAS Netlink interface library
Date: Mon, 31 Aug 2026 11:46:30 +0300	[thread overview]
Message-ID: <c9b431c59949a9499d79e166886413591de113e4@intel.com> (raw)
In-Reply-To: <20260824164133.129138-4-ravi.kishore.koppuravuri@intel.com>

On Mon, 24 Aug 2026, Ravi Kishore Koppuravuri <ravi.kishore.koppuravuri@intel.com> wrote:
> Introduce an IGT library for communicating with DRM RAS Generic Netlink
> interface. Add helpers for Generic Netlink socket initialization and
> cleanup.
>
> Signed-off-by: Ravi Kishore Koppuravuri <ravi.kishore.koppuravuri@intel.com>
> ---
>  lib/igt_drm_netlink.c | 60 +++++++++++++++++++++++++++++++++++++++++++
>  lib/igt_drm_netlink.h | 25 ++++++++++++++++++
>  lib/meson.build       |  1 +
>  3 files changed, 86 insertions(+)
>  create mode 100644 lib/igt_drm_netlink.c
>  create mode 100644 lib/igt_drm_netlink.h
>
> diff --git a/lib/igt_drm_netlink.c b/lib/igt_drm_netlink.c
> new file mode 100644
> index 000000000..fec1639b4
> --- /dev/null
> +++ b/lib/igt_drm_netlink.c
> @@ -0,0 +1,60 @@
> +// SPDX-License-Identifier: MIT
> +/*
> + * Copyright © 2026 Intel Corporation
> + */
> +
> +#include <stdbool.h>
> +#include <stdint.h>
> +#include <stdio.h>
> +#include <stdlib.h>
> +#include <string.h>
> +
> +#include <netlink/errno.h>
> +#include <netlink/genl/ctrl.h>
> +#include <netlink/genl/genl.h>
> +#include <netlink/netlink.h>
> +
> +#include "igt_core.h"
> +#include "igt_drm_netlink.h"
> +
> +void igt_cleanup_nl_socket(struct app_context *ctx)
> +{
> +	if (!ctx || !ctx->sock)
> +		return;
> +
> +	nl_close(ctx->sock);
> +	nl_socket_free(ctx->sock);
> +	ctx->sock = NULL;
> +	ctx->family_id = -1;
> +
> +	igt_debug("Cleaned up netlink socket.\n");
> +}
> +
> +int igt_init_nl_socket(struct app_context *ctx)
> +{
> +	ctx->sock = nl_socket_alloc();
> +	if (!ctx->sock)
> +		return -1;
> +
> +	igt_debug("Socket allocation successful. Connecting to Generic Netlink...\n");
> +	if (genl_connect(ctx->sock) < 0) {
> +		igt_cleanup_nl_socket(ctx);
> +		return -1;
> +	}
> +
> +	igt_debug("Resolving Generic Netlink family '%s'...\n", DRM_RAS_FAMILY_NAME);
> +	ctx->family_id = genl_ctrl_resolve(ctx->sock, DRM_RAS_FAMILY_NAME);
> +	if (ctx->family_id < 0) {
> +		fprintf(stderr,
> +			"Failed to resolve Generic Netlink family '%s': %s. "
> +			"This may mean the running kernel does not expose DRM RAS support.\n",
> +			DRM_RAS_FAMILY_NAME,
> +			nl_geterror(ctx->family_id));
> +		igt_cleanup_nl_socket(ctx);
> +		return -1;
> +	}
> +
> +	igt_debug("Resolved Generic Netlink family '%s' with id %d.\n",
> +		  DRM_RAS_FAMILY_NAME, ctx->family_id);
> +	return 0;
> +}
> diff --git a/lib/igt_drm_netlink.h b/lib/igt_drm_netlink.h
> new file mode 100644
> index 000000000..f681a3a81
> --- /dev/null
> +++ b/lib/igt_drm_netlink.h
> @@ -0,0 +1,25 @@
> +/* SPDX-License-Identifier: MIT */
> +/*
> + * Copyright © 2026 Intel Corporation
> + */
> +
> +#ifndef IGT_DRM_NETLINK_H
> +#define IGT_DRM_NETLINK_H
> +
> +#include <stdbool.h>

There are no bools here?

> +#include <stdint.h>

There are no stdints here?

> +
> +#include <netlink/netlink.h>

You could get away with a forward declaration.

> +
> +#include <drm-uapi/drm_ras.h>

You're not using that here.

> +
> +struct app_context {

Why doesn't the name indicate netlink in any way?

> +	struct nl_sock *sock;
> +	int family_id;
> +};
> +
> +void igt_cleanup_nl_socket(struct app_context *ctx);
> +int igt_init_nl_socket(struct app_context *ctx);

IMO "nl" is the wrong place to abbreviate.

> +
> +#endif /* IGT_DRM_NETLINK_H */
> +
> diff --git a/lib/meson.build b/lib/meson.build
> index 7248bbc2d..70da9a4a0 100644
> --- a/lib/meson.build
> +++ b/lib/meson.build
> @@ -27,6 +27,7 @@ lib_sources = [
>  	'igt_device_scan.c',
>  	'igt_drm_clients.h',
>  	'igt_drm_fdinfo.c',
> +	'igt_drm_netlink.c',
>          'igt_fs.c',
>  	'igt_aux.c',
>  	'igt_dp.c',

-- 
Jani Nikula, Intel

  reply	other threads:[~2026-08-31  8:47 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-24 16:41 [PATCH v3 00/10] Xe3P GPU Error Injection Test Suite with DRM RAS Netlink Support Ravi Kishore Koppuravuri
2026-08-24 16:41 ` [PATCH v3 01/10] drm-uapi/drm_ras: Add DRM RAS UAPI header Ravi Kishore Koppuravuri
2026-08-31  8:43   ` Jani Nikula
2026-08-24 16:41 ` [PATCH v3 02/10] lib/meson: Add libnl dependencies for DRM RAS support Ravi Kishore Koppuravuri
2026-08-24 16:41 ` [PATCH v3 03/10] lib/igt_drm_netlink: Introduce DRM RAS Netlink interface library Ravi Kishore Koppuravuri
2026-08-31  8:46   ` Jani Nikula [this message]
2026-08-31 11:30     ` Koppuravuri, Ravi Kishore
2026-08-31 12:33       ` Jani Nikula
2026-08-24 16:41 ` [PATCH v3 04/10] lib/igt_drm_netlink: add get_error_counter support Ravi Kishore Koppuravuri
2026-08-31  8:48   ` Jani Nikula
2026-08-31 11:23     ` Koppuravuri, Ravi Kishore
2026-08-31 12:38       ` Jani Nikula
2026-08-24 16:41 ` [PATCH v3 05/10] lib/igt_drm_netlink: add get_error_threshold command support Ravi Kishore Koppuravuri
2026-08-24 16:41 ` [PATCH v3 06/10] lib/igt_drm_netlink: add set_error_threshold " Ravi Kishore Koppuravuri
2026-08-24 16:41 ` [PATCH v3 07/10] tests/intel/xe_err_injection: Add GT UC Unicast GAM Walker Command Parity Error Injection Ravi Kishore Koppuravuri
2026-08-26  9:18   ` Purkait, Soham
2026-08-26 13:33     ` Koppuravuri, Ravi Kishore
2026-08-28  3:26   ` Harish Chegondi
2026-08-31  8:02   ` Purkait, Soham
2026-08-24 16:41 ` [PATCH v3 08/10] lib/igt_drm_netlink: add event notify subscription and event wait support Ravi Kishore Koppuravuri
2026-08-24 16:41 ` [PATCH v3 09/10] tests/intel/xe_err_injection: Add tests for L2 bank Corr err threshold scenarios Ravi Kishore Koppuravuri
2026-08-24 16:41 ` [PATCH v3 10/10] tests/intel/xe_err_injection: add CRI GPU requirement check Ravi Kishore Koppuravuri
2026-08-27 20:22 ` [PATCH v3 00/10] Xe3P GPU Error Injection Test Suite with DRM RAS Netlink Support Harish Chegondi
2026-08-28  4:03   ` Koppuravuri, Ravi Kishore

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=c9b431c59949a9499d79e166886413591de113e4@intel.com \
    --to=jani.nikula@intel.com \
    --cc=anshuman.gupta@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=mallesh.koujalagi@intel.com \
    --cc=raag.jadav@intel.com \
    --cc=ravi.kishore.koppuravuri@intel.com \
    --cc=riana.tauro@intel.com \
    --cc=soham.purkait@intel.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.