From: Simon Horman <horms@kernel.org>
To: Raju Rangoju <Raju.Rangoju@amd.com>
Cc: netdev@vger.kernel.org, davem@davemloft.net, edumazet@google.com,
kuba@kernel.org, pabeni@redhat.com, Shyam-sundar.S-k@amd.com
Subject: Re: [PATCH v4 net-next 1/2] amd-xgbe: reorganize the code of XPCS access
Date: Wed, 7 Feb 2024 19:06:02 +0000 [thread overview]
Message-ID: <20240207190602.GL1297511@kernel.org> (raw)
In-Reply-To: <20240205204900.2442500-2-Raju.Rangoju@amd.com>
On Tue, Feb 06, 2024 at 02:18:59AM +0530, Raju Rangoju wrote:
> The xgbe_{read/write}_mmd_regs_v* functions have common code which can
> be moved to helper functions. Also, the xgbe_pci_probe() needs
> reorganization.
>
> Add new helper functions to calculate the mmd_address for v1/v2 of xpcs
> access. And, convert if/else statements in xgbe_pci_probe() to switch
> case. This helps code look cleaner.
>
> Signed-off-by: Raju Rangoju <Raju.Rangoju@amd.com>
Hi Raju,
it seems to me that this patch is doing two things:
1. Adding get_mmd_address() and get_pcs_index_and_offset() helpers,
and using them.
2. Refactoring xgbe_pci_probe()
I think it would be nice to split this into two patches - one thing per patch.
> ---
> drivers/net/ethernet/amd/xgbe/xgbe-dev.c | 62 ++++++++++--------------
> drivers/net/ethernet/amd/xgbe/xgbe-pci.c | 35 +++++++------
> drivers/net/ethernet/amd/xgbe/xgbe.h | 4 ++
> 3 files changed, 51 insertions(+), 50 deletions(-)
>
> diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-dev.c b/drivers/net/ethernet/amd/xgbe/xgbe-dev.c
> index f393228d41c7..ac70db54c92a 100644
> --- a/drivers/net/ethernet/amd/xgbe/xgbe-dev.c
> +++ b/drivers/net/ethernet/amd/xgbe/xgbe-dev.c
> @@ -1150,18 +1150,16 @@ static int xgbe_set_gpio(struct xgbe_prv_data *pdata, unsigned int gpio)
> return 0;
> }
>
> -static int xgbe_read_mmd_regs_v2(struct xgbe_prv_data *pdata, int prtad,
> - int mmd_reg)
> +static unsigned int get_mmd_address(struct xgbe_prv_data *pdata, int mmd_reg)
> {
> - unsigned long flags;
> - unsigned int mmd_address, index, offset;
> - int mmd_data;
> -
> - if (mmd_reg & XGBE_ADDR_C45)
> - mmd_address = mmd_reg & ~XGBE_ADDR_C45;
> - else
> - mmd_address = (pdata->mdio_mmd << 16) | (mmd_reg & 0xffff);
> + return (mmd_reg & XGBE_ADDR_C45) ?
> + mmd_reg & ~XGBE_ADDR_C45 :
> + (pdata->mdio_mmd << 16) | (mmd_reg & 0xffff);
> +}
>
> +static void get_pcs_index_and_offset(struct xgbe_prv_data *pdata, unsigned int mmd_address,
> + unsigned int *index, unsigned int *offset)
nit: Networking (still) prefers code no more than 80 columns wide.
...
next prev parent reply other threads:[~2024-02-07 19:06 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-05 20:48 [PATCH v4 net-next 0/2] amd-xgbe: add support for AMD Crater Raju Rangoju
2024-02-05 20:48 ` [PATCH v4 net-next 1/2] amd-xgbe: reorganize the code of XPCS access Raju Rangoju
2024-02-07 19:06 ` Simon Horman [this message]
2024-02-05 20:49 ` [PATCH v4 net-next 2/2] amd-xgbe: add support for Crater ethernet device Raju Rangoju
2024-02-07 19:09 ` Simon Horman
2024-02-12 11:57 ` Raju Rangoju
2024-02-17 16:03 ` Simon Horman
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=20240207190602.GL1297511@kernel.org \
--to=horms@kernel.org \
--cc=Raju.Rangoju@amd.com \
--cc=Shyam-sundar.S-k@amd.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.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.