Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@intel.com>
To: "Koppuravuri, Ravi Kishore" <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
Subject: Re: [PATCH v3 04/10] lib/igt_drm_netlink: add get_error_counter support
Date: Mon, 31 Aug 2026 15:38:46 +0300	[thread overview]
Message-ID: <7ff9e8160d25444ad506b51806665924d57c1cbf@intel.com> (raw)
In-Reply-To: <cb23ad61-d462-48cc-953c-5b053c0152c8@intel.com>

On Mon, 31 Aug 2026, "Koppuravuri, Ravi Kishore" <ravi.kishore.koppuravuri@intel.com> wrote:
> On 31-08-2026 14:18, Jani Nikula wrote:
>> On Mon, 24 Aug 2026, Ravi Kishore Koppuravuri <ravi.kishore.koppuravuri@intel.com> wrote:
>>> +static int init_app_context(struct app_context *ctx)
>>> +{
>>> +	if (!ctx)
>>> +		return -EINVAL;
>>> +
>>> +	ctx->sock = NULL;
>>> +	ctx->node_id = UINT32_MAX;
>>> +	ctx->error_id = UINT32_MAX;
>>> +	ctx->error_value = 0;
>>> +	ctx->last_nl_error = 0;
>>> +	ctx->cmd_done = false;
>>> +	ctx->reply_received = false;
>>> +	ctx->ack_received = false;
>>> +	ctx->response_required = false;
>>> +	ctx->family_id = -1;
>>> +
>>> +	return 0;
>>> +}
>>> +
>>> +static void cleanup_app_context(struct app_context *ctx)
>>> +{
>>> +	if (!ctx)
>>> +		return;
>>> +
>>> +	ctx->sock = NULL;
>>> +	ctx->node_id = UINT32_MAX;
>>> +	ctx->error_id = UINT32_MAX;
>>> +	ctx->error_value = 0;
>>> +	ctx->last_nl_error = 0;
>>> +	ctx->cmd_done = false;
>>> +	ctx->reply_received = false;
>>> +	ctx->ack_received = false;
>>> +	ctx->response_required = false;
>>> +	ctx->family_id = -1;
>>> +}

Btw, the two functions above do the exact same thing. Why doesn't one
call the other?

Also, why not memset(ctx, 0, sizeof(*ctx)) and then set the non-zero
ones separately?

>>>   struct app_context {
>>>   	struct nl_sock *sock;
>>> +	uint32_t node_id;
>>> +	uint32_t error_id;
>>> +	uint32_t error_value;
>>> +	int last_nl_error;
>>> +	bool cmd_done;
>>> +	bool reply_received;
>>> +	bool ack_received;
>>> +	bool response_required;
>>>   	int family_id;
>>>   };
>>>   
>>>   void igt_cleanup_nl_socket(struct app_context *ctx);
>>>   int igt_init_nl_socket(struct app_context *ctx);
>>> +int igt_get_error_counter(struct app_context *ctx);
>> This is really inconsistent naming, though.
>
> igt_init_nl_socket() and igt_cleanup_nl_socket() are the library 
> functions to initialize and cleanup the netlink socket.
>
> igt_get_error_counter() is the library function to get the error counter.
>
> "igt_" is the prefix used for all the library functions, as suggested by 
> Kamil.
>
> I am not clear why this naming is inconsistent. Could you please 
> elaborate your suggestion here.

Point is, there are a gazillion functions starting with "igt_", and the
above don't make it any more specific. The "igt get error counter" could
refer to any error counter.

I guess I'd have named all the functions and types to have the
igt_drm_netlink_ prefix. Or similar. And then you immediately know what
this is about, without having to look up the function definitions or
documentation.

BR,
Jani.


-- 
Jani Nikula, Intel

  reply	other threads:[~2026-08-31 12:39 UTC|newest]

Thread overview: 35+ 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
2026-08-31 11:30     ` Koppuravuri, Ravi Kishore
2026-08-31 12:33       ` Jani Nikula
2026-09-01  9:41         ` Koppuravuri, Ravi Kishore
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 [this message]
2026-08-31 15:58   ` Purkait, Soham
2026-09-01  9:43     ` Koppuravuri, Ravi Kishore
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-09-01  9:44     ` Koppuravuri, Ravi Kishore
2026-08-28  3:26   ` Harish Chegondi
2026-09-01  9:45     ` Koppuravuri, Ravi Kishore
2026-08-31  8:02   ` Purkait, Soham
2026-09-01  9:46     ` Koppuravuri, Ravi Kishore
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
2026-09-01 16:48     ` Kamil Konieczny
2026-09-02 22:02 ` ✓ i915.CI.BAT: success for Xe3P GPU Error Injection Test Suite with DRM RAS Netlink Support (rev6) Patchwork
2026-09-02 22:13 ` ✓ Xe.CI.BAT: " Patchwork
2026-09-03 13:41 ` ✗ Xe.CI.FULL: failure " Patchwork
2026-09-03 17:00 ` ✗ i915.CI.Full: " Patchwork

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=7ff9e8160d25444ad506b51806665924d57c1cbf@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox