> > 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@xxxxxxxxxxxxxxxxxxxxx> > > --- > > [...] > > > +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