[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANr-f5zkr90FOQ5did25HM0WRn0RKLmgfJXCkH-Br+0kZZxAKw@mail.gmail.com>
Date: Fri, 3 Sep 2021 22:14:26 +0200
From: Gerhard Engleder <gerhard@...leder-embedded.com>
To: Vinicius Costa Gomes <vinicius.gomes@...el.com>
Cc: David Miller <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>, Andrew Lunn <andrew@...n.ch>,
netdev <netdev@...r.kernel.org>, devicetree@...r.kernel.org
Subject: Re: [PATCH net-next v2 3/3] tsnep: Add TSN endpoint Ethernet MAC driver
> > The TSN endpoint Ethernet MAC is a FPGA based network device for
> > real-time communication.
> >
> > It is integrated as Ethernet controller with ethtool and PTP support.
> > For real-time communcation TC_SETUP_QDISC_TAPRIO is supported.
> >
> > Signed-off-by: Gerhard Engleder <gerhard@...leder-embedded.com>
> > ---
>
> [...]
>
> > +static int tsnep_netdev_open(struct net_device *netdev)
> > +{
> > + struct tsnep_adapter *adapter = netdev_priv(netdev);
> > + void *addr;
> > + int i;
> > + int retval;
> > +
> > + retval = tsnep_phy_open(adapter);
> > + if (retval)
> > + return retval;
> > +
> > + for (i = 0; i < adapter->num_tx_queues; i++) {
> > + addr = adapter->addr + TSNEP_QUEUE(i);
> > + retval = tsnep_tx_open(adapter, &adapter->tx[i], addr);
> > + if (retval)
> > + goto tx_failed;
> > + }
> > + retval = netif_set_real_num_tx_queues(adapter->netdev,
> > + adapter->num_tx_queues);
> > + if (retval)
> > + goto tx_failed;
> > + for (i = 0; i < adapter->num_rx_queues; i++) {
> > + addr = adapter->addr + TSNEP_QUEUE(i);
> > + retval = tsnep_rx_open(adapter, &adapter->rx[i], addr);
> > + if (retval)
> > + goto rx_failed;
> > + }
> > + retval = netif_set_real_num_rx_queues(adapter->netdev,
> > + adapter->num_rx_queues);
> > + if (retval)
> > + goto rx_failed;
> > +
> > + netif_napi_add(adapter->netdev, &adapter->napi, tsnep_rx_napi_poll, 64);
>
> I know that you only have support for 1 queue for now. But having
> "tx[0]" and "rx[0]" hardcoded in tsnep_rx_napi_poll() seems less than
> ideal if you want to support more queues in the future.
>
> And I think that moving 'struct napi_struct' to be closer to the queues
> now will help make that future transition to multiqueue to be cleaner.
You are right, I will try to make it more multiqueue aware for future
transition.
> > +void tsnep_ethtool_self_test(struct net_device *netdev,
> > + struct ethtool_test *eth_test, u64 *data)
> > +{
> > + struct tsnep_adapter *adapter = netdev_priv(netdev);
> > +
> > + eth_test->len = TSNEP_TEST_COUNT;
> > +
> > + if (eth_test->flags != ETH_TEST_FL_OFFLINE) {
> > + /* no tests are done online */
> > + data[TSNEP_TEST_ENABLE] = 0;
> > + data[TSNEP_TEST_TAPRIO] = 0;
> > + data[TSNEP_TEST_TAPRIO_CHANGE] = 0;
> > + data[TSNEP_TEST_TAPRIO_EXTENSION] = 0;
> > +
> > + return;
> > + }
> > +
> > + if (tsnep_test_gc_enable(adapter)) {
> > + data[TSNEP_TEST_ENABLE] = 0;
> > + } else {
> > + eth_test->flags |= ETH_TEST_FL_FAILED;
> > + data[TSNEP_TEST_ENABLE] = 1;
> > + }
> > +
> > + if (tsnep_test_taprio(adapter)) {
> > + data[TSNEP_TEST_TAPRIO] = 0;
> > + } else {
> > + eth_test->flags |= ETH_TEST_FL_FAILED;
> > + data[TSNEP_TEST_TAPRIO] = 1;
> > + }
> > +
> > + if (tsnep_test_taprio_change(adapter)) {
> > + data[TSNEP_TEST_TAPRIO_CHANGE] = 0;
> > + } else {
> > + eth_test->flags |= ETH_TEST_FL_FAILED;
> > + data[TSNEP_TEST_TAPRIO_CHANGE] = 1;
> > + }
> > +
> > + if (tsnep_test_taprio_extension(adapter)) {
> > + data[TSNEP_TEST_TAPRIO_EXTENSION] = 0;
> > + } else {
> > + eth_test->flags |= ETH_TEST_FL_FAILED;
> > + data[TSNEP_TEST_TAPRIO_EXTENSION] = 1;
> > + }
> > +}
>
> I liked these tests :-)
Thank you! TAPRIO/IEEE802.1Qbv support was challenging for me and these
tests helped me a lot. My goal was hardware support reduced to the minimum
and error prone calculation/switching stuff done by software.
Gerhard
Powered by blists - more mailing lists