From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 75372A04E1; Tue, 22 Sep 2020 10:54:57 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 030991DAD2; Tue, 22 Sep 2020 10:51:01 +0200 (CEST) Received: from dispatch1-us1.ppe-hosted.com (dispatch1-us1.ppe-hosted.com [67.231.154.164]) by dpdk.org (Postfix) with ESMTP id 5A5161D725 for ; Tue, 22 Sep 2020 10:50:20 +0200 (CEST) Received: from mx1-us1.ppe-hosted.com (unknown [10.110.50.137]) by dispatch1-us1.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTP id D79A92006F for ; Tue, 22 Sep 2020 08:50:19 +0000 (UTC) Received: from us4-mdac16-61.at1.mdlocal (unknown [10.110.50.154]) by mx1-us1.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTP id D761D6009B for ; Tue, 22 Sep 2020 08:50:19 +0000 (UTC) X-Virus-Scanned: Proofpoint Essentials engine Received: from mx1-us1.ppe-hosted.com (unknown [10.110.50.12]) by mx1-us1.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTPS id 666E0220064 for ; Tue, 22 Sep 2020 08:50:19 +0000 (UTC) Received: from webmail.solarflare.com (uk.solarflare.com [193.34.186.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mx1-us1.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTPS id 197784005B for ; Tue, 22 Sep 2020 08:50:19 +0000 (UTC) Received: from ukex01.SolarFlarecom.com (10.17.10.4) by ukex01.SolarFlarecom.com (10.17.10.4) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 22 Sep 2020 09:50:11 +0100 Received: from opal.uk.solarflarecom.com (10.17.10.1) by ukex01.SolarFlarecom.com (10.17.10.4) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Tue, 22 Sep 2020 09:50:10 +0100 Received: from ukv-loginhost.uk.solarflarecom.com (ukv-loginhost.uk.solarflarecom.com [10.17.10.39]) by opal.uk.solarflarecom.com (8.13.8/8.13.8) with ESMTP id 08M8oAx3004731 for ; Tue, 22 Sep 2020 09:50:10 +0100 Received: from ukv-loginhost.uk.solarflarecom.com (localhost [127.0.0.1]) by ukv-loginhost.uk.solarflarecom.com (Postfix) with ESMTP id C90221613A9 for ; Tue, 22 Sep 2020 09:50:10 +0100 (BST) From: Andrew Rybchenko To: Date: Tue, 22 Sep 2020 09:49:27 +0100 Message-ID: <1600764594-14752-34-git-send-email-arybchenko@solarflare.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1600764594-14752-1-git-send-email-arybchenko@solarflare.com> References: <1600764594-14752-1-git-send-email-arybchenko@solarflare.com> MIME-Version: 1.0 Content-Type: text/plain X-TM-AS-Product-Ver: SMEX-12.5.0.1300-8.6.1012-25674.003 X-TM-AS-Result: No-1.628100-8.000000-10 X-TMASE-MatchedRID: HxUUw2kVJz6FCX92EIwegqiUivh0j2PvhVDnkfzD7uYGmHr1eMxt2YB5 w6KBECW1rdoLblq9S5pfzZ2iPRxeXmiqvF73selK/1dEgwtQ6NCi8D/o42y/SsegunXInzcYxON QYeoRenEAb9Rn+iNx05V0tSdOcfI8eDPho5Jw+XDM0ihsfYPMYY7P8sslRxoevGAx/1ATZ5uEOO rGGbRIRnWMTvVbgjN/k6psACbw/shn9FmZ/33o9osJhiDgH5JhWw/S0HB7eoPvrj2fROADieVSU U6b/D2d4COTKxJYuBqnO3MMKycGTZfAQhbUcX5U1uDM+OtX7BxQYo4xNF42PhLf1vz7ecPHG1Kt 4DlqVAiHsp2lK2QCgOuMKFkmExDlLvv2cUtLK/ueAiCmPx4NwBnUJ0Ek6yhjxEHRux+uk8hxKpv EGAbTDkCKWL9a/2SsqiYdiLi9wA3OcudgIgDZcipN8L3ebCEpox6CwjM8JjXmNSxT2SPe7sOaG2 Egn1n/JyGUZxyRANT3C+TzuJ8l4hySoBCeolQDq8uPJC94SFgR06l6KId4N+omcwkrJL7n X-TM-AS-User-Approved-Sender: Yes X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--1.628100-8.000000 X-TMASE-Version: SMEX-12.5.0.1300-8.6.1012-25674.003 X-MDID: 1600764619-ZikGzJqjcPSV Subject: [dpdk-dev] [PATCH 33/60] common/sfc_efx/base: implement Tx control path for Riverhead X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Tx control path on Riverhead is very similar to EF10, but datapath differs a lot since Tx descriptor size is 16 bytes (vs 8 bytes on EF10). Signed-off-by: Andrew Rybchenko Reviewed-by: Andy Moreton --- drivers/common/sfc_efx/base/efx_impl.h | 6 +- drivers/common/sfc_efx/base/efx_mcdi.c | 6 +- drivers/common/sfc_efx/base/efx_tx.c | 33 ++++ drivers/common/sfc_efx/base/meson.build | 1 + drivers/common/sfc_efx/base/rhead_impl.h | 83 ++++++++++ drivers/common/sfc_efx/base/rhead_tx.c | 192 +++++++++++++++++++++++ 6 files changed, 311 insertions(+), 10 deletions(-) create mode 100644 drivers/common/sfc_efx/base/rhead_tx.c diff --git a/drivers/common/sfc_efx/base/efx_impl.h b/drivers/common/sfc_efx/base/efx_impl.h index fac2815f25..d7e11c6323 100644 --- a/drivers/common/sfc_efx/base/efx_impl.h +++ b/drivers/common/sfc_efx/base/efx_impl.h @@ -1452,10 +1452,6 @@ efx_mcdi_fini_rxq( __in efx_nic_t *enp, __in uint32_t instance); -#endif /* EFSYS_OPT_RIVERHEAD || EFX_OPTS_EF10() */ - -#if EFX_OPTS_EF10() - LIBEFX_INTERNAL extern __checkReturn efx_rc_t efx_mcdi_init_txq( @@ -1473,7 +1469,7 @@ efx_mcdi_fini_txq( __in efx_nic_t *enp, __in uint32_t instance); -#endif /* EFX_OPTS_EF10() */ +#endif /* EFSYS_OPT_RIVERHEAD || EFX_OPTS_EF10() */ #endif /* EFSYS_OPT_MCDI */ diff --git a/drivers/common/sfc_efx/base/efx_mcdi.c b/drivers/common/sfc_efx/base/efx_mcdi.c index 6a227858e6..278c5e2a64 100644 --- a/drivers/common/sfc_efx/base/efx_mcdi.c +++ b/drivers/common/sfc_efx/base/efx_mcdi.c @@ -2863,10 +2863,6 @@ efx_mcdi_fini_rxq( return (rc); } -#endif /* EFSYS_OPT_RIVERHEAD || EFX_OPTS_EF10() */ - -#if EFX_OPTS_EF10() - __checkReturn efx_rc_t efx_mcdi_init_txq( __in efx_nic_t *enp, @@ -2999,6 +2995,6 @@ efx_mcdi_fini_txq( return (rc); } -#endif /* EFX_OPTS_EF10() */ +#endif /* EFSYS_OPT_RIVERHEAD || EFX_OPTS_EF10() */ #endif /* EFSYS_OPT_MCDI */ diff --git a/drivers/common/sfc_efx/base/efx_tx.c b/drivers/common/sfc_efx/base/efx_tx.c index 38c64e028b..d7f31fd46d 100644 --- a/drivers/common/sfc_efx/base/efx_tx.c +++ b/drivers/common/sfc_efx/base/efx_tx.c @@ -205,6 +205,33 @@ static const efx_tx_ops_t __efx_tx_medford2_ops = { }; #endif /* EFSYS_OPT_MEDFORD2 */ +#if EFSYS_OPT_RIVERHEAD +static const efx_tx_ops_t __efx_tx_rhead_ops = { + rhead_tx_init, /* etxo_init */ + rhead_tx_fini, /* etxo_fini */ + rhead_tx_qcreate, /* etxo_qcreate */ + rhead_tx_qdestroy, /* etxo_qdestroy */ + rhead_tx_qpost, /* etxo_qpost */ + rhead_tx_qpush, /* etxo_qpush */ + rhead_tx_qpace, /* etxo_qpace */ + rhead_tx_qflush, /* etxo_qflush */ + rhead_tx_qenable, /* etxo_qenable */ + NULL, /* etxo_qpio_enable */ + NULL, /* etxo_qpio_disable */ + NULL, /* etxo_qpio_write */ + NULL, /* etxo_qpio_post */ + rhead_tx_qdesc_post, /* etxo_qdesc_post */ + NULL, /* etxo_qdesc_dma_create */ + NULL, /* etxo_qdesc_tso_create */ + NULL, /* etxo_qdesc_tso2_create */ + NULL, /* etxo_qdesc_vlantci_create */ + NULL, /* etxo_qdesc_checksum_create */ +#if EFSYS_OPT_QSTATS + rhead_tx_qstats_update, /* etxo_qstats_update */ +#endif +}; +#endif /* EFSYS_OPT_RIVERHEAD */ + __checkReturn efx_rc_t efx_tx_init( @@ -251,6 +278,12 @@ efx_tx_init( break; #endif /* EFSYS_OPT_MEDFORD2 */ +#if EFSYS_OPT_RIVERHEAD + case EFX_FAMILY_RIVERHEAD: + etxop = &__efx_tx_rhead_ops; + break; +#endif /* EFSYS_OPT_RIVERHEAD */ + default: EFSYS_ASSERT(0); rc = ENOTSUP; diff --git a/drivers/common/sfc_efx/base/meson.build b/drivers/common/sfc_efx/base/meson.build index aff5017cff..8f944bb45b 100644 --- a/drivers/common/sfc_efx/base/meson.build +++ b/drivers/common/sfc_efx/base/meson.build @@ -56,6 +56,7 @@ sources = [ 'rhead_intr.c', 'rhead_nic.c', 'rhead_rx.c', + 'rhead_tx.c', ] extra_flags = [ diff --git a/drivers/common/sfc_efx/base/rhead_impl.h b/drivers/common/sfc_efx/base/rhead_impl.h index 4b7a07e5cb..fa5e2b4915 100644 --- a/drivers/common/sfc_efx/base/rhead_impl.h +++ b/drivers/common/sfc_efx/base/rhead_impl.h @@ -355,6 +355,89 @@ rhead_rx_qdestroy( __in efx_rxq_t *erp); +/* TX */ + +LIBEFX_INTERNAL +extern __checkReturn efx_rc_t +rhead_tx_init( + __in efx_nic_t *enp); + +LIBEFX_INTERNAL +extern void +rhead_tx_fini( + __in efx_nic_t *enp); + +LIBEFX_INTERNAL +extern __checkReturn efx_rc_t +rhead_tx_qcreate( + __in efx_nic_t *enp, + __in unsigned int index, + __in unsigned int label, + __in efsys_mem_t *esmp, + __in size_t ndescs, + __in uint32_t id, + __in uint16_t flags, + __in efx_evq_t *eep, + __in efx_txq_t *etp, + __out unsigned int *addedp); + +LIBEFX_INTERNAL +extern void +rhead_tx_qdestroy( + __in efx_txq_t *etp); + +LIBEFX_INTERNAL +extern __checkReturn efx_rc_t +rhead_tx_qpost( + __in efx_txq_t *etp, + __in_ecount(ndescs) efx_buffer_t *ebp, + __in unsigned int ndescs, + __in unsigned int completed, + __inout unsigned int *addedp); + +LIBEFX_INTERNAL +extern void +rhead_tx_qpush( + __in efx_txq_t *etp, + __in unsigned int added, + __in unsigned int pushed); + +LIBEFX_INTERNAL +extern __checkReturn efx_rc_t +rhead_tx_qpace( + __in efx_txq_t *etp, + __in unsigned int ns); + +LIBEFX_INTERNAL +extern __checkReturn efx_rc_t +rhead_tx_qflush( + __in efx_txq_t *etp); + +LIBEFX_INTERNAL +extern void +rhead_tx_qenable( + __in efx_txq_t *etp); + +LIBEFX_INTERNAL +extern __checkReturn efx_rc_t +rhead_tx_qdesc_post( + __in efx_txq_t *etp, + __in_ecount(n) efx_desc_t *ed, + __in unsigned int n, + __in unsigned int completed, + __inout unsigned int *addedp); + +#if EFSYS_OPT_QSTATS + +LIBEFX_INTERNAL +extern void +rhead_tx_qstats_update( + __in efx_txq_t *etp, + __inout_ecount(TX_NQSTATS) efsys_stat_t *stat); + +#endif /* EFSYS_OPT_QSTATS */ + + #ifdef __cplusplus } #endif diff --git a/drivers/common/sfc_efx/base/rhead_tx.c b/drivers/common/sfc_efx/base/rhead_tx.c new file mode 100644 index 0000000000..4c60f329d1 --- /dev/null +++ b/drivers/common/sfc_efx/base/rhead_tx.c @@ -0,0 +1,192 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * + * Copyright(c) 2019-2020 Xilinx, Inc. + * Copyright(c) 2018-2019 Solarflare Communications Inc. + */ + +#include "efx.h" +#include "efx_impl.h" + + +#if EFSYS_OPT_RIVERHEAD + + __checkReturn efx_rc_t +rhead_tx_init( + __in efx_nic_t *enp) +{ + _NOTE(ARGUNUSED(enp)) + /* Nothing to do here */ + return (0); +} + + void +rhead_tx_fini( + __in efx_nic_t *enp) +{ + _NOTE(ARGUNUSED(enp)) + /* Nothing to do here */ +} + + __checkReturn efx_rc_t +rhead_tx_qcreate( + __in efx_nic_t *enp, + __in unsigned int index, + __in unsigned int label, + __in efsys_mem_t *esmp, + __in size_t ndescs, + __in uint32_t id, + __in uint16_t flags, + __in efx_evq_t *eep, + __in efx_txq_t *etp, + __out unsigned int *addedp) +{ + efx_rc_t rc; + + /* + * NMC manages the NMMU entries, and so buffer table IDs are + * ignored here + */ + _NOTE(ARGUNUSED(id)) + + if ((rc = efx_mcdi_init_txq(enp, ndescs, eep->ee_index, label, index, + flags, esmp)) != 0) + goto fail1; + + /* + * Return the initial queue index which is zero since no option + * descriptors are sent at start of day. + */ + *addedp = 0; + + return (0); + +fail1: + EFSYS_PROBE1(fail1, efx_rc_t, rc); + + return (rc); +} + + void +rhead_tx_qdestroy( + __in efx_txq_t *etp) +{ + _NOTE(ARGUNUSED(etp)) + /* Nothing to do here */ +} + + __checkReturn efx_rc_t +rhead_tx_qpost( + __in efx_txq_t *etp, + __in_ecount(ndescs) efx_buffer_t *eb, + __in unsigned int ndescs, + __in unsigned int completed, + __inout unsigned int *addedp) +{ + _NOTE(ARGUNUSED(etp)) + _NOTE(ARGUNUSED(eb)) + _NOTE(ARGUNUSED(ndescs)) + _NOTE(ARGUNUSED(completed)) + _NOTE(ARGUNUSED(addedp)) + + /* FIXME Implement the method for Riverhead */ + + return (ENOTSUP); +} + + void +rhead_tx_qpush( + __in efx_txq_t *etp, + __in unsigned int added, + __in unsigned int pushed) +{ + _NOTE(ARGUNUSED(etp, added, pushed)) + + /* FIXME Implement the method for Riverhead */ + EFSYS_ASSERT(B_FALSE); +} + + __checkReturn efx_rc_t +rhead_tx_qpace( + __in efx_txq_t *etp, + __in unsigned int ns) +{ + _NOTE(ARGUNUSED(etp)) + _NOTE(ARGUNUSED(ns)) + + /* FIXME Implement the method for Riverhead */ + + return (ENOTSUP); +} + + __checkReturn efx_rc_t +rhead_tx_qflush( + __in efx_txq_t *etp) +{ + efx_nic_t *enp = etp->et_enp; + efx_rc_t rc; + + if ((rc = efx_mcdi_fini_txq(enp, etp->et_index)) != 0) + goto fail1; + + return (0); + +fail1: + /* + * EALREADY is not an error, but indicates that the MC has rebooted and + * that the TXQ has already been destroyed. Callers need to know that + * the TXQ flush has completed to avoid waiting until timeout for a + * flush done event that will not be delivered. + */ + if (rc != EALREADY) + EFSYS_PROBE1(fail1, efx_rc_t, rc); + + return (rc); +} + + void +rhead_tx_qenable( + __in efx_txq_t *etp) +{ + _NOTE(ARGUNUSED(etp)) + /* Nothing to do here */ +} + + __checkReturn efx_rc_t +rhead_tx_qdesc_post( + __in efx_txq_t *etp, + __in_ecount(ndescs) efx_desc_t *ed, + __in unsigned int ndescs, + __in unsigned int completed, + __inout unsigned int *addedp) +{ + _NOTE(ARGUNUSED(etp)) + _NOTE(ARGUNUSED(ed)) + _NOTE(ARGUNUSED(ndescs)) + _NOTE(ARGUNUSED(completed)) + _NOTE(ARGUNUSED(addedp)) + + /* FIXME Implement the method for Riverhead */ + + return (ENOTSUP); +} + +#if EFSYS_OPT_QSTATS + + void +rhead_tx_qstats_update( + __in efx_txq_t *etp, + __inout_ecount(TX_NQSTATS) efsys_stat_t *stat) +{ + unsigned int id; + + for (id = 0; id < TX_NQSTATS; id++) { + efsys_stat_t *essp = &stat[id]; + + EFSYS_STAT_INCR(essp, etp->et_stat[id]); + etp->et_stat[id] = 0; + } +} + +#endif /* EFSYS_OPT_QSTATS */ + +#endif /* EFSYS_OPT_RIVERHEAD */ -- 2.17.1