DPDK patches and discussions
 help / color / mirror / Atom feed
From: Apeksha Gupta <apeksha.gupta@nxp.com>
To: Ferruh Yigit <ferruh.yigit@intel.com>,
	"david.marchand@redhat.com" <david.marchand@redhat.com>,
	"andrew.rybchenko@oktetlabs.ru" <andrew.rybchenko@oktetlabs.ru>
Cc: "dev@dpdk.org" <dev@dpdk.org>,
	Sachin Saxena <sachin.saxena@nxp.com>,
	Hemant Agrawal <hemant.agrawal@nxp.com>
Subject: Re: [dpdk-dev] [EXT] Re: [PATCH v7 2/5] net/enetfec: add UIO support
Date: Mon, 8 Nov 2021 20:24:03 +0000	[thread overview]
Message-ID: <PAXPR04MB944501F9FE2F1A31F61992CFEF919@PAXPR04MB9445.eurprd04.prod.outlook.com> (raw)
In-Reply-To: <ce208ac4-0875-df37-a034-f3d5e3f10a78@intel.com>



> -----Original Message-----
> From: Ferruh Yigit <ferruh.yigit@intel.com>
> Sent: Thursday, November 4, 2021 11:56 PM
> To: Apeksha Gupta <apeksha.gupta@nxp.com>; david.marchand@redhat.com;
> andrew.rybchenko@oktetlabs.ru
> Cc: dev@dpdk.org; Sachin Saxena <sachin.saxena@nxp.com>; Hemant Agrawal
> <hemant.agrawal@nxp.com>
> Subject: [EXT] Re: [PATCH v7 2/5] net/enetfec: add UIO support
> 
> Caution: EXT Email
> 
> On 11/3/2021 7:20 PM, Apeksha Gupta wrote:
> > Implemented the fec-uio driver in kernel. enetfec PMD uses
> > UIO interface to interact with "fec-uio" driver implemented in
> > kernel for PHY initialisation and for mapping the allocated memory
> > of register & BD from kernel to DPDK which gives access to
> > non-cacheable memory for BD.
> >
> > Signed-off-by: Sachin Saxena <sachin.saxena@nxp.com>
> > Signed-off-by: Apeksha Gupta <apeksha.gupta@nxp.com>
> > ---
> >   drivers/net/enetfec/enet_ethdev.c | 227 ++++++++++++++++++++++++
> >   drivers/net/enetfec/enet_ethdev.h |  14 ++
> >   drivers/net/enetfec/enet_regs.h   | 106 ++++++++++++
> >   drivers/net/enetfec/enet_uio.c    | 278 ++++++++++++++++++++++++++++++
> >   drivers/net/enetfec/enet_uio.h    |  64 +++++++
> >   drivers/net/enetfec/meson.build   |   3 +-
> >   6 files changed, 691 insertions(+), 1 deletion(-)
> >   create mode 100644 drivers/net/enetfec/enet_regs.h
> >   create mode 100644 drivers/net/enetfec/enet_uio.c
> >   create mode 100644 drivers/net/enetfec/enet_uio.h
> >
> > diff --git a/drivers/net/enetfec/enet_ethdev.c
> b/drivers/net/enetfec/enet_ethdev.c
> > index a6c4bcbf2e..410c395039 100644
> > --- a/drivers/net/enetfec/enet_ethdev.c
> > +++ b/drivers/net/enetfec/enet_ethdev.c
> > @@ -13,16 +13,212 @@
> >   #include <rte_bus_vdev.h>
> >   #include <rte_dev.h>
> >   #include <rte_ether.h>
> > +#include <rte_io.h>
> >   #include "enet_pmd_logs.h"
> >   #include "enet_ethdev.h"
> > +#include "enet_regs.h"
> > +#include "enet_uio.h"
> >
> >   #define ENETFEC_NAME_PMD                net_enetfec
> >   #define ENETFEC_CDEV_INVALID_FD         -1
> > +#define BIT(nr)                              (1u << (nr))
> 
> We already have 'RTE_BIT32' macro, it can be used instead of defining
> a new macro.
[Apeksha] sure, we will use RTE_BIT32 macro.

> 
> > +
> > +/* FEC receive acceleration */
> > +#define ENETFEC_RACC_IPDIS           BIT(1)
> > +#define ENETFEC_RACC_PRODIS          BIT(2)
> > +#define ENETFEC_RACC_SHIFT16         BIT(7)
> > +#define ENETFEC_RACC_OPTIONS         (ENETFEC_RACC_IPDIS | \
> > +                                             ENETFEC_RACC_PRODIS)
> > +
> > +#define ENETFEC_PAUSE_FLAG_AUTONEG   0x1
> > +#define ENETFEC_PAUSE_FLAG_ENABLE    0x2
> > +
> > +/* Pause frame field and FIFO threshold */
> > +#define ENETFEC_FCE                  BIT(5)
> > +#define ENETFEC_RSEM_V                       0x84
> > +#define ENETFEC_RSFL_V                       16
> > +#define ENETFEC_RAEM_V                       0x8
> > +#define ENETFEC_RAFL_V                       0x8
> > +#define ENETFEC_OPD_V                        0xFFF0
> > +
> > +#define NUM_OF_BD_QUEUES             6
> > +
> > +static uint32_t enetfec_e_cntl;
> > +
> 
> Again, question on the usage of this global variable in previous version
> is not answered, let me copy/paste here:
> 
> 
> Is this global variable really needed, most of the times what you need is
> per port varible.
> For example I can see this variable is updated based on port start/stop,
> what if you have multiple ports and they are different start/stop state,
> will the value of variable still be correct?
[Apeksha] This driver is implemented for IMX8MM board which has only one port. 
So implemented accordingly. We will check when multiple ports supported.

> 
> > +/*
> > + * This function is called to start or restart the ENETFEC during a link
> > + * change, transmit timeout, or to reconfigure the ENETFEC. The network
> > + * packet processing for this device must be stopped before this call.
> > + */
> > +static void
> > +enetfec_restart(struct rte_eth_dev *dev)
> > +{
> > +     struct enetfec_private *fep = dev->data->dev_private;
> > +     uint32_t temp_mac[2];
> > +     uint32_t rcntl = OPT_FRAME_SIZE | 0x04;
> > +     uint32_t ecntl = ENETFEC_ETHEREN;
> > +
> > +     /* default mac address */
> > +     struct rte_ether_addr addr = {
> > +             .addr_bytes = {0x1, 0x2, 0x3, 0x4, 0x5, 0x6} };
> 
> This mac address is set on device, but device data, 'dev->data->mac_addrs',
> doesn't have it.
> - Is MAC set required on each restart?
> - What about save the MAC address to 'dev->data->mac_addrs', and use that
> value in restart? In that case the MAC value device data and acual device
> config matches.
[Apeksha] MAC set is not required on each restart. So we will remove this unwanted code.
MAC address will set from probe function only.

> 
> > +     uint32_t val;
> > +
> > +     /*
> > +      * enet-mac reset will reset mac address registers too,
> > +      * so need to reconfigure it.
> > +      */
> > +     memcpy(&temp_mac, addr.addr_bytes, ETH_ALEN);
> > +     rte_write32(rte_cpu_to_be_32(temp_mac[0]),
> > +             (uint8_t *)fep->hw_baseaddr_v + ENETFEC_PALR);
> > +     rte_write32(rte_cpu_to_be_32(temp_mac[1]),
> > +             (uint8_t *)fep->hw_baseaddr_v + ENETFEC_PAUR);
> > +
> > +     /* Clear any outstanding interrupt. */
> > +     writel(0xffffffff, (uint8_t *)fep->hw_baseaddr_v + ENETFEC_EIR);
> > +
> > +     /* Enable MII mode */
> > +     if (fep->full_duplex == FULL_DUPLEX) {
> > +             /* FD enable */
> > +             rte_write32(rte_cpu_to_le_32(0x04),
> > +                     (uint8_t *)fep->hw_baseaddr_v + ENETFEC_TCR);
> > +     } else {
> > +     /* No Rcv on Xmit */
> > +             rcntl |= 0x02;
> > +             rte_write32(0, (uint8_t *)fep->hw_baseaddr_v + ENETFEC_TCR);
> > +     }
> > +
> > +     if (fep->quirks & QUIRK_RACC) {
> > +             val = rte_read32((uint8_t *)fep->hw_baseaddr_v + ENETFEC_RACC);
> > +             /* align IP header */
> > +             val |= ENETFEC_RACC_SHIFT16;
> > +             val &= ~ENETFEC_RACC_OPTIONS;
> > +             rte_write32(rte_cpu_to_le_32(val),
> > +                     (uint8_t *)fep->hw_baseaddr_v + ENETFEC_RACC);
> > +             rte_write32(rte_cpu_to_le_32(PKT_MAX_BUF_SIZE),
> > +                     (uint8_t *)fep->hw_baseaddr_v + ENETFEC_FRAME_TRL);
> > +     }
> > +
> > +     /*
> > +      * The phy interface and speed need to get configured
> > +      * differently on enet-mac.
> > +      */
> > +     if (fep->quirks & QUIRK_HAS_ENETFEC_MAC) {
> > +             /* Enable flow control and length check */
> > +             rcntl |= 0x40000000 | 0x00000020;
> > +
> > +             /* RGMII, RMII or MII */
> > +             rcntl |= BIT(6);
> > +             ecntl |= BIT(5);
> > +     }
> > +
> > +     /* enable pause frame*/
> > +     if ((fep->flag_pause & ENETFEC_PAUSE_FLAG_ENABLE) ||
> > +             ((fep->flag_pause & ENETFEC_PAUSE_FLAG_AUTONEG)
> > +             /*&& ndev->phydev && ndev->phydev->pause*/)) {
> > +             rcntl |= ENETFEC_FCE;
> > +
> > +             /* set FIFO threshold parameter to reduce overrun */
> > +             rte_write32(rte_cpu_to_le_32(ENETFEC_RSEM_V),
> > +                     (uint8_t *)fep->hw_baseaddr_v + ENETFEC_R_FIFO_SEM);
> > +             rte_write32(rte_cpu_to_le_32(ENETFEC_RSFL_V),
> > +                     (uint8_t *)fep->hw_baseaddr_v + ENETFEC_R_FIFO_SFL);
> > +             rte_write32(rte_cpu_to_le_32(ENETFEC_RAEM_V),
> > +                     (uint8_t *)fep->hw_baseaddr_v + ENETFEC_R_FIFO_AEM);
> > +             rte_write32(rte_cpu_to_le_32(ENETFEC_RAFL_V),
> > +                     (uint8_t *)fep->hw_baseaddr_v + ENETFEC_R_FIFO_AFL);
> > +
> > +             /* OPD */
> > +             rte_write32(rte_cpu_to_le_32(ENETFEC_OPD_V),
> > +                     (uint8_t *)fep->hw_baseaddr_v + ENETFEC_OPD);
> > +     } else {
> > +             rcntl &= ~ENETFEC_FCE;
> > +     }
> > +
> > +     rte_write32(rte_cpu_to_le_32(rcntl),
> > +             (uint8_t *)fep->hw_baseaddr_v + ENETFEC_RCR);
> > +
> > +     rte_write32(0, (uint8_t *)fep->hw_baseaddr_v + ENETFEC_IAUR);
> > +     rte_write32(0, (uint8_t *)fep->hw_baseaddr_v + ENETFEC_IALR);
> > +
> > +     if (fep->quirks & QUIRK_HAS_ENETFEC_MAC) {
> > +             /* enable ENETFEC endian swap */
> > +             ecntl |= (1 << 8);
> > +             /* enable ENETFEC store and forward mode */
> > +             rte_write32(rte_cpu_to_le_32(1 << 8),
> > +                     (uint8_t *)fep->hw_baseaddr_v + ENETFEC_TFWR);
> > +     }
> > +     if (fep->bufdesc_ex)
> > +             ecntl |= (1 << 4);
> > +     if (fep->quirks & QUIRK_SUPPORT_DELAYED_CLKS &&
> > +             fep->rgmii_txc_delay)
> > +             ecntl |= ENETFEC_TXC_DLY;
> > +     if (fep->quirks & QUIRK_SUPPORT_DELAYED_CLKS &&
> > +             fep->rgmii_rxc_delay)
> > +             ecntl |= ENETFEC_RXC_DLY;
> > +     /* Enable the MIB statistic event counters */
> > +     rte_write32(0, (uint8_t *)fep->hw_baseaddr_v + ENETFEC_MIBC);
> > +
> > +     ecntl |= 0x70000000;
> > +     enetfec_e_cntl = ecntl;
> > +     /* And last, enable the transmit and receive processing */
> > +     rte_write32(rte_cpu_to_le_32(ecntl),
> > +             (uint8_t *)fep->hw_baseaddr_v + ENETFEC_ECR);
> > +     rte_delay_us(10);
> > +}
> > +
> > +static int
> > +enetfec_eth_configure(__rte_unused struct rte_eth_dev *dev)
> 
> unnecessary '__rte_unused'


  reply	other threads:[~2021-11-08 20:24 UTC|newest]

Thread overview: 91+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-01 11:42 [dpdk-dev] [PATCH v4 0/5] drivers/net: add NXP ENETFEC driver Apeksha Gupta
2021-10-01 11:42 ` [dpdk-dev] [PATCH v4 1/5] net/enetfec: introduce " Apeksha Gupta
2021-10-19 18:39   ` [dpdk-dev] [PATCH v5 0/5] drivers/net: add " Apeksha Gupta
2021-10-19 18:39     ` [dpdk-dev] [PATCH v5 1/5] net/enetfec: introduce " Apeksha Gupta
2021-10-21  4:46       ` [dpdk-dev] [PATCH v6 0/5] drivers/net: add " Apeksha Gupta
2021-10-21  4:46         ` [dpdk-dev] [PATCH v6 1/5] net/enetfec: introduce " Apeksha Gupta
2021-10-21  5:24           ` Hemant Agrawal
2021-10-27 14:18           ` Ferruh Yigit
2021-11-08 18:42             ` [dpdk-dev] [EXT] " Apeksha Gupta
2021-11-03 19:20           ` [dpdk-dev] [PATCH v7 0/5] drivers/net: add " Apeksha Gupta
2021-11-03 19:20             ` [dpdk-dev] [PATCH v7 1/5] net/enetfec: introduce " Apeksha Gupta
2021-11-03 23:27               ` Ferruh Yigit
2021-11-04 18:24               ` Ferruh Yigit
2021-11-08 19:13                 ` [dpdk-dev] [EXT] " Apeksha Gupta
2021-11-09 11:34               ` [dpdk-dev] [PATCH v8 0/5] drivers/net: add " Apeksha Gupta
2021-11-09 11:34                 ` [dpdk-dev] [PATCH v8 1/5] net/enetfec: introduce " Apeksha Gupta
2021-11-09 11:34                 ` [dpdk-dev] [PATCH v8 2/5] net/enetfec: add UIO support Apeksha Gupta
2021-11-09 11:34                 ` [dpdk-dev] [PATCH v8 3/5] net/enetfec: support queue configuration Apeksha Gupta
2021-11-09 11:34                 ` [dpdk-dev] [PATCH v8 4/5] net/enetfec: add Rx/Tx support Apeksha Gupta
2021-11-09 11:34                 ` [dpdk-dev] [PATCH v8 5/5] net/enetfec: add features Apeksha Gupta
2021-11-10  7:48                   ` [dpdk-dev] [PATCH v9 0/5] drivers/net: add NXP ENETFEC driver Apeksha Gupta
2021-11-10  7:48                     ` [dpdk-dev] [PATCH v9 1/5] net/enetfec: introduce " Apeksha Gupta
2021-11-10 13:53                       ` Ferruh Yigit
2021-11-13  4:31                       ` [PATCH v10 0/5] drivers/net: add " Apeksha Gupta
2021-11-13  4:31                         ` [PATCH v10 1/5] net/enetfec: introduce " Apeksha Gupta
2021-11-15  7:19                           ` [PATCH v11 0/5] drivers/net: add " Apeksha Gupta
2021-11-15  7:19                             ` [PATCH v11 1/5] net/enetfec: introduce " Apeksha Gupta
2021-11-15 10:07                               ` Ferruh Yigit
2023-03-21 18:03                               ` Ferruh Yigit
2023-03-23  6:00                                 ` Sachin Saxena (OSS)
2023-03-23 11:07                                   ` Ferruh Yigit
2023-03-23 11:09                                     ` Sachin Saxena (OSS)
2021-11-15  7:19                             ` [PATCH v11 2/5] net/enetfec: add UIO support Apeksha Gupta
2021-11-15  7:19                             ` [PATCH v11 3/5] net/enetfec: support queue configuration Apeksha Gupta
2021-11-15 10:11                               ` Ferruh Yigit
2021-11-15 10:24                                 ` Ferruh Yigit
2021-11-15 11:15                                   ` Ferruh Yigit
2021-11-15  7:19                             ` [PATCH v11 4/5] net/enetfec: add Rx/Tx support Apeksha Gupta
2021-11-15  7:19                             ` [PATCH v11 5/5] net/enetfec: add features Apeksha Gupta
2021-11-15  9:44                             ` [PATCH v11 0/5] drivers/net: add NXP ENETFEC driver Ferruh Yigit
2021-11-15 15:05                             ` Ferruh Yigit
2021-11-25 16:52                               ` Ferruh Yigit
2021-11-13  4:31                         ` [PATCH v10 2/5] net/enetfec: add UIO support Apeksha Gupta
2021-11-13  4:31                         ` [PATCH v10 3/5] net/enetfec: support queue configuration Apeksha Gupta
2021-11-13 17:11                           ` Stephen Hemminger
2021-11-13  4:31                         ` [PATCH v10 4/5] net/enetfec: add Rx/Tx support Apeksha Gupta
2021-11-13 17:10                           ` Stephen Hemminger
2021-11-13  4:31                         ` [PATCH v10 5/5] net/enetfec: add features Apeksha Gupta
2021-11-10  7:48                     ` [dpdk-dev] [PATCH v9 2/5] net/enetfec: add UIO support Apeksha Gupta
2021-11-10  7:48                     ` [dpdk-dev] [PATCH v9 3/5] net/enetfec: support queue configuration Apeksha Gupta
2021-11-10 13:54                       ` Ferruh Yigit
2021-11-13  5:00                         ` [EXT] " Apeksha Gupta
2021-11-15 10:06                         ` Ferruh Yigit
2021-11-15 10:23                           ` Ferruh Yigit
2021-11-15 10:29                             ` Ferruh Yigit
2021-11-10  7:48                     ` [dpdk-dev] [PATCH v9 4/5] net/enetfec: add Rx/Tx support Apeksha Gupta
2021-11-10 13:56                       ` Ferruh Yigit
2021-11-10  7:48                     ` [dpdk-dev] [PATCH v9 5/5] net/enetfec: add features Apeksha Gupta
2021-11-10 13:57                       ` Ferruh Yigit
2021-11-03 19:20             ` [dpdk-dev] [PATCH v7 2/5] net/enetfec: add UIO support Apeksha Gupta
2021-11-04 18:25               ` Ferruh Yigit
2021-11-08 20:24                 ` Apeksha Gupta [this message]
2021-11-08 21:51                   ` [dpdk-dev] [EXT] " Ferruh Yigit
2021-11-03 19:20             ` [dpdk-dev] [PATCH v7 3/5] net/enetfec: support queue configuration Apeksha Gupta
2021-11-04 18:26               ` Ferruh Yigit
2021-11-03 19:20             ` [dpdk-dev] [PATCH v7 4/5] net/enetfec: add Rx/Tx support Apeksha Gupta
2021-11-04 18:28               ` Ferruh Yigit
2021-11-09 16:20                 ` [dpdk-dev] [EXT] " Apeksha Gupta
2021-11-03 19:20             ` [dpdk-dev] [PATCH v7 5/5] net/enetfec: add features Apeksha Gupta
2021-11-04 18:31             ` [dpdk-dev] [PATCH v7 0/5] drivers/net: add NXP ENETFEC driver Ferruh Yigit
2021-10-21  4:46         ` [dpdk-dev] [PATCH v6 2/5] net/enetfec: add UIO support Apeksha Gupta
2021-10-27 14:21           ` Ferruh Yigit
2021-11-08 18:44             ` [dpdk-dev] [EXT] " Apeksha Gupta
2021-10-21  4:46         ` [dpdk-dev] [PATCH v6 3/5] net/enetfec: support queue configuration Apeksha Gupta
2021-10-27 14:23           ` Ferruh Yigit
2021-11-08 18:45             ` [dpdk-dev] [EXT] " Apeksha Gupta
2021-10-21  4:46         ` [dpdk-dev] [PATCH v6 4/5] net/enetfec: add enqueue and dequeue support Apeksha Gupta
2021-10-27 14:25           ` Ferruh Yigit
2021-11-08 18:47             ` [dpdk-dev] [EXT] " Apeksha Gupta
2021-10-21  4:47         ` [dpdk-dev] [PATCH v6 5/5] net/enetfec: add features Apeksha Gupta
2021-10-27 14:26           ` Ferruh Yigit
2021-10-27 14:15         ` [dpdk-dev] [PATCH v6 0/5] drivers/net: add NXP ENETFEC driver Ferruh Yigit
2021-10-19 18:40     ` [dpdk-dev] [PATCH v5 2/5] net/enetfec: add UIO support Apeksha Gupta
2021-10-19 18:40     ` [dpdk-dev] [PATCH v5 3/5] net/enetfec: support queue configuration Apeksha Gupta
2021-10-19 18:40     ` [dpdk-dev] [PATCH v5 4/5] net/enetfec: add enqueue and dequeue support Apeksha Gupta
2021-10-19 18:40     ` [dpdk-dev] [PATCH v5 5/5] net/enetfec: add features Apeksha Gupta
2021-10-01 11:42 ` [dpdk-dev] [PATCH v4 2/5] net/enetfec: add UIO support Apeksha Gupta
2021-10-01 11:42 ` [dpdk-dev] [PATCH v4 3/5] net/enetfec: support queue configuration Apeksha Gupta
2021-10-01 11:42 ` [dpdk-dev] [PATCH v4 4/5] net/enetfec: add enqueue and dequeue support Apeksha Gupta
2021-10-01 11:42 ` [dpdk-dev] [PATCH v4 5/5] net/enetfec: add features Apeksha Gupta
2021-10-17 10:49 ` [dpdk-dev] [PATCH v4 0/5] drivers/net: add NXP ENETFEC driver Apeksha Gupta

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=PAXPR04MB944501F9FE2F1A31F61992CFEF919@PAXPR04MB9445.eurprd04.prod.outlook.com \
    --to=apeksha.gupta@nxp.com \
    --cc=andrew.rybchenko@oktetlabs.ru \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=hemant.agrawal@nxp.com \
    --cc=sachin.saxena@nxp.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).