From: Jakub Kicinski <kuba@kernel.org>
To: Raju Rangoju <Raju.Rangoju@amd.com>
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: Mon, 25 Aug 2025 17:04:29 -0700 [thread overview]
Message-ID: <20250825170429.0f08fa1e@kernel.org> (raw)
In-Reply-To: <20250822103831.2044533-1-Raju.Rangoju@amd.com>
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.
> 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
> + /* 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?
--
pw-bot: cr
next prev parent reply other threads:[~2025-08-26 0:04 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-22 10:38 [PATCH net-next v2] amd-xgbe: Add PPS periodic output support Raju Rangoju
2025-08-26 0:04 ` Jakub Kicinski [this message]
2025-08-28 7:44 ` Rangoju, Raju
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=20250825170429.0f08fa1e@kernel.org \
--to=kuba@kernel.org \
--cc=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=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;
as well as URLs for NNTP newsgroup(s).