[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAOkoqZne1uH9k1O-S8-rfgqRQtk8XEdvBYZHC4VPyDRConaRJw@mail.gmail.com>
Date: Mon, 3 Jan 2022 14:11:58 -0800
From: Dimitris Michailidis <d.michailidis@...gible.com>
To: Heiner Kallweit <hkallweit1@...il.com>
Cc: davem@...emloft.net, Jakub Kicinski <kuba@...nel.org>,
netdev@...r.kernel.org
Subject: Re: [PATCH net-next 3/8] net/funeth: probing and netdev ops
On Fri, Dec 31, 2021 at 3:15 AM Heiner Kallweit <hkallweit1@...il.com> wrote:
>
> On 30.12.2021 17:39, Dimitris Michailidis wrote:
> > This is the first part of the Fungible ethernet driver. It deals with
> > device probing, net_device creation, and netdev ops.
> >
> > Signed-off-by: Dimitris Michailidis <dmichail@...gible.com>
> > ---
> > drivers/net/ethernet/fungible/funeth/funeth.h | 153 ++
> > .../ethernet/fungible/funeth/funeth_main.c | 1772 +++++++++++++++++
> > 2 files changed, 1925 insertions(+)
> > create mode 100644 drivers/net/ethernet/fungible/funeth/funeth.h
> > create mode 100644 drivers/net/ethernet/fungible/funeth/funeth_main.c
> >
> > diff --git a/drivers/net/ethernet/fungible/funeth/funeth.h b/drivers/net/ethernet/fungible/funeth/funeth.h
> > new file mode 100644
> > index 000000000000..0c089f685c7f
> > --- /dev/null
> > +++ b/drivers/net/ethernet/fungible/funeth/funeth.h
> > @@ -0,0 +1,153 @@
> > +/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) */
> > +
> > +#ifndef _FUNETH_H
> > +#define _FUNETH_H
> > +
> > +#include <uapi/linux/if_ether.h>
> > +#include <uapi/linux/net_tstamp.h>
> > +#include <linux/seqlock.h>
> > +#include <net/devlink.h>
> > +#include "fun_dev.h"
> > +
> > +#define ADMIN_SQE_SIZE SZ_128
> > +#define ADMIN_CQE_SIZE SZ_64
> > +#define ADMIN_RSP_MAX_LEN (ADMIN_CQE_SIZE - sizeof(struct fun_cqe_info))
> > +
> > +#define FUN_MAX_MTU 9024
> > +
> > +#define SQ_DEPTH 512U
> > +#define CQ_DEPTH 1024U
> > +#define RQ_DEPTH (512U / (PAGE_SIZE / 4096))
> > +
> > +#define CQ_INTCOAL_USEC 10
> > +#define CQ_INTCOAL_NPKT 16
> > +#define SQ_INTCOAL_USEC 10
> > +#define SQ_INTCOAL_NPKT 16
> > +
> > +#define INVALID_LPORT 0xffff
> > +
> > +#define FUN_PORT_CAP_PAUSE_MASK (FUN_PORT_CAP_TX_PAUSE | FUN_PORT_CAP_RX_PAUSE)
> > +
> > +struct fun_vport_info {
> > + u8 mac[ETH_ALEN];
> > + u16 vlan;
> > + __be16 vlan_proto;
> > + u8 qos;
> > + u8 spoofchk:1;
> > + u8 trusted:1;
> > + unsigned int max_rate;
> > +};
> > +
> > +/* "subclass" of fun_dev for Ethernet functions */
> > +struct fun_ethdev {
> > + struct fun_dev fdev;
> > +
> > + /* the function's network ports */
> > + struct net_device **netdevs;
> > + unsigned int num_ports;
> > +
> > + /* configuration for the function's virtual ports */
> > + unsigned int num_vports;
> > + struct fun_vport_info *vport_info;
> > +
> > + unsigned int nsqs_per_port;
> > +};
> > +
> > +static inline struct fun_ethdev *to_fun_ethdev(struct fun_dev *p)
> > +{
> > + return container_of(p, struct fun_ethdev, fdev);
> > +}
> > +
> > +/* Per netdevice driver state, i.e., netdev_priv. */
> > +struct funeth_priv {
> > + struct fun_dev *fdev;
> > + struct pci_dev *pdev;
> > + struct net_device *netdev;
> > +
> > + struct funeth_rxq * __rcu *rxqs;
> > + struct funeth_txq **txqs;
> > + struct funeth_txq **xdpqs;
> > +
> > + struct fun_irq *irqs;
> > + unsigned int num_irqs;
> > + unsigned int num_tx_irqs;
> > +
> > + unsigned int lane_attrs;
> > + u16 lport;
> > +
> > + /* link settings */
> > + u64 port_caps;
> > + u64 advertising;
> > + u64 lp_advertising;
> > + unsigned int link_speed;
>
> Any specific reason for handling this manually?
> Why not using phylib/phylink?
Linux here doesn't have access to the MAC/PHY. They are handled
by FW. The driver for the most part sits between FW and ethtool
converting commands and state between them and these fields store
either what FW has reported or what ethtool has requested.
Powered by blists - more mailing lists