mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Rangoju, Raju" <raju.rangoju@amd.com>
To: Jakub Kicinski <kuba@kernel.org>
Cc: netdev@vger.kernel.org, andrew+netdev@lunn.ch,
	davem@davemloft.net, edumazet@google.com, pabeni@redhat.com,
	richardcochran@gmail.com, linux-kernel@vger.kernel.org,
	Shyam-sundar.S-k@amd.com
Subject: Re: [PATCH net-next v2] amd-xgbe: Add PPS periodic output support
Date: Thu, 28 Aug 2025 13:14:45 +0530	[thread overview]
Message-ID: <9a9e7815-4af9-4e47-8137-ffe9602da06e@amd.com> (raw)
In-Reply-To: <20250825170429.0f08fa1e@kernel.org>



On 8/26/2025 5:34 AM, Jakub Kicinski wrote:
> On Fri, 22 Aug 2025 16:08:31 +0530 Raju Rangoju wrote:
>> +#define PPSx_MASK(x) ({						\
>> +	unsigned int __x = (x);					\
>> +	GENMASK(PPS_MAXIDX(__x), PPS_MINIDX(__x));		\
>> +})
>> +#define PPSCMDx(x, val) ({					\
>> +	unsigned int __x = (x);					\
>> +	GENMASK(PPS_MINIDX(__x) + 3, PPS_MINIDX(__x)) &		\
>> +	((val) << PPS_MINIDX(__x));				\
>> +})
>> +#define TRGTMODSELx(x, val) ({					\
>> +	unsigned int __x = (x);					\
>> +	GENMASK(PPS_MAXIDX(__x) - 1, PPS_MAXIDX(__x) - 2) &	\
>> +	((val) << (PPS_MAXIDX(__x) - 2));			\
>> +})
> 
> These macros are way too gnarly, please simplify them.
> For a start I'm not sure why you're making your life harder and try
> to have a shifted mask. Instead of masking the value before shifting.

Sure, will simplify them v3.

> 
>>   static int xgbe_enable(struct ptp_clock_info *info,
>>   		       struct ptp_clock_request *request, int on)
>>   {
>> -	return -EOPNOTSUPP;
>> +	struct xgbe_prv_data *pdata = container_of(info, struct xgbe_prv_data,
>> +						   ptp_clock_info);
>> +	struct xgbe_pps_config *pps_cfg;
>> +	unsigned long flags;
>> +	int ret;
>> +
>> +	dev_dbg(pdata->dev, "rq->type %d on %d\n", request->type, on);
>> +
>> +	if (request->type != PTP_CLK_REQ_PEROUT)
>> +		return -EOPNOTSUPP;
>> +
>> +	/* Reject requests with unsupported flags */
>> +	if (request->perout.flags)
>> +		return -EOPNOTSUPP;
> 
> Are you sure kernel can actually send you any flags here?
> ops->supported_perout_flags exists

Yes, it looks like ops->supported_perout_flags is already taking care of 
this. Thanks, I'll drop the above check.

> 
>> +	/* Validate index against our limit */
>> +	if (request->perout.index >= XGBE_MAX_PPS_OUT)
>> +		return -EINVAL;
> 
> Are you sure kernel can send you an index higher than what driver
> registered as supported?

looks like kernel is already handling it and this extra check isn't 
needed anymore. I'll drop it. Thanks Jakub.


      reply	other threads:[~2025-08-28  7:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-22 10:38 Raju Rangoju
2025-08-26  0:04 ` Jakub Kicinski
2025-08-28  7:44   ` Rangoju, Raju [this message]

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=9a9e7815-4af9-4e47-8137-ffe9602da06e@amd.com \
    --to=raju.rangoju@amd.com \
    --cc=Shyam-sundar.S-k@amd.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=richardcochran@gmail.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

all inboxes | Powered by JetHome®