From: Leon Romanovsky <leon@kernel.org>
To: Veerasenareddy Burru <vburru@marvell.com>
Cc: davem@davemloft.net, kuba@kernel.org, corbet@lwn.net,
netdev@vger.kernel.org, linux-doc@vger.kernel.org,
linux-kernel@vger.kernel.org,
Abhijit Ayarekar <aayarekar@marvell.com>,
Satananda Burla <sburla@marvell.com>
Subject: Re: [PATCH 2/4] octeon_ep: add support for ndo ops.
Date: Sun, 13 Feb 2022 17:16:22 +0200 [thread overview]
Message-ID: <YgkgxhXrXPmdAuM2@unreal> (raw)
In-Reply-To: <20220210213306.3599-3-vburru@marvell.com>
On Thu, Feb 10, 2022 at 01:33:04PM -0800, Veerasenareddy Burru wrote:
> Add support for ndo ops to set MAC address, change MTU, get stats.
> Add control path support to set MAC address, change MTU, get stats,
> set speed, get and set link mode.
>
> Signed-off-by: Veerasenareddy Burru <vburru@marvell.com>
> Signed-off-by: Abhijit Ayarekar <aayarekar@marvell.com>
> Signed-off-by: Satananda Burla <sburla@marvell.com>
> ---
> .../marvell/octeon_ep/octep_ctrl_net.c | 105 ++++++++++++++++++
> .../ethernet/marvell/octeon_ep/octep_main.c | 67 +++++++++++
> 2 files changed, 172 insertions(+)
Please don't put "." in end of patch title.
>
> diff --git a/drivers/net/ethernet/marvell/octeon_ep/octep_ctrl_net.c b/drivers/net/ethernet/marvell/octeon_ep/octep_ctrl_net.c
> index 1f0d8ba3c8ee..be9b0f31c754 100644
> --- a/drivers/net/ethernet/marvell/octeon_ep/octep_ctrl_net.c
> +++ b/drivers/net/ethernet/marvell/octeon_ep/octep_ctrl_net.c
> @@ -87,3 +87,108 @@ int octep_get_mac_addr(struct octep_device *oct, u8 *addr)
>
> return 0;
> }
> +
> +int octep_set_mac_addr(struct octep_device *oct, u8 *addr)
> +{
> + struct octep_ctrl_mbox_msg msg = { 0 };
> + struct octep_ctrl_net_h2f_req req = { 0 };
It is enough to write {} without 0.
> +
> + req.hdr.cmd = OCTEP_CTRL_NET_H2F_CMD_MAC;
> + req.mac.cmd = OCTEP_CTRL_NET_CMD_SET;
> + memcpy(&req.mac.addr, addr, ETH_ALEN);
> +
> + msg.hdr.flags = OCTEP_CTRL_MBOX_MSG_HDR_FLAG_REQ;
> + msg.hdr.sizew = OCTEP_CTRL_NET_H2F_MAC_REQ_SZW;
> + msg.msg = &req;
> + return octep_ctrl_mbox_send(&oct->ctrl_mbox, &msg);
> +}
> +
> +int octep_set_mtu(struct octep_device *oct, int mtu)
> +{
> + struct octep_ctrl_mbox_msg msg = { 0 };
> + struct octep_ctrl_net_h2f_req req = { 0 };
> +
> + req.hdr.cmd = OCTEP_CTRL_NET_H2F_CMD_MTU;
> + req.mtu.cmd = OCTEP_CTRL_NET_CMD_SET;
> + req.mtu.val = mtu;
> +
> + msg.hdr.flags = OCTEP_CTRL_MBOX_MSG_HDR_FLAG_REQ;
> + msg.hdr.sizew = OCTEP_CTRL_NET_H2F_MTU_REQ_SZW;
> + msg.msg = &req;
> + return octep_ctrl_mbox_send(&oct->ctrl_mbox, &msg);
> +}
> +
> +int octep_get_if_stats(struct octep_device *oct)
> +{
> + struct octep_ctrl_mbox_msg msg = { 0 };
> + struct octep_ctrl_net_h2f_req req = { 0 };
> + struct octep_iface_rx_stats *iface_rx_stats;
> + struct octep_iface_tx_stats *iface_tx_stats;
> + int err;
Reversed Christmas tree, in all functions.
> +
> + req.hdr.cmd = OCTEP_CTRL_NET_H2F_CMD_GET_IF_STATS;
> + req.mac.cmd = OCTEP_CTRL_NET_CMD_GET;
> + req.get_stats.offset = oct->ctrl_mbox_ifstats_offset;
> +
> + msg.hdr.flags = OCTEP_CTRL_MBOX_MSG_HDR_FLAG_REQ;
> + msg.hdr.sizew = OCTEP_CTRL_NET_H2F_GET_STATS_REQ_SZW;
> + msg.msg = &req;
> + err = octep_ctrl_mbox_send(&oct->ctrl_mbox, &msg);
> + if (!err) {
Please use success oriented approach, in all places.
if (err)
return err;
....
> + iface_rx_stats = (struct octep_iface_rx_stats *)(oct->ctrl_mbox.barmem +
> + oct->ctrl_mbox_ifstats_offset);
> + iface_tx_stats = (struct octep_iface_tx_stats *)(oct->ctrl_mbox.barmem +
> + oct->ctrl_mbox_ifstats_offset +
> + sizeof(struct octep_iface_rx_stats)
> + );
> + memcpy(&oct->iface_rx_stats, iface_rx_stats, sizeof(struct octep_iface_rx_stats));
> + memcpy(&oct->iface_tx_stats, iface_tx_stats, sizeof(struct octep_iface_tx_stats));
> + }
> +
> + return 0;
> +}
> +
Thanks
next prev parent reply other threads:[~2022-02-13 15:16 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-10 21:33 [PATCH 0/4] Add octeon_ep driver Veerasenareddy Burru
2022-02-10 21:33 ` [PATCH 2/4] octeon_ep: add support for ndo ops Veerasenareddy Burru
2022-02-13 15:16 ` Leon Romanovsky [this message]
2022-02-10 21:33 ` [PATCH 3/4] octeon_ep: add Tx/Rx and interrupt support Veerasenareddy Burru
2022-02-10 21:33 ` [PATCH 4/4] octeon_ep: add ethtool support for Octeon PCI Endpoint NIC Veerasenareddy Burru
2022-02-11 21:40 ` Andrew Lunn
[not found] ` <20220210213306.3599-2-vburru@marvell.com>
2022-02-11 2:29 ` [PATCH 1/4] octeon_ep: Add driver framework and device initiazliation Jakub Kicinski
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=YgkgxhXrXPmdAuM2@unreal \
--to=leon@kernel.org \
--cc=aayarekar@marvell.com \
--cc=corbet@lwn.net \
--cc=davem@davemloft.net \
--cc=kuba@kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=sburla@marvell.com \
--cc=vburru@marvell.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).