From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f65.google.com (mail-wm0-f65.google.com [74.125.82.65]) by dpdk.org (Postfix) with ESMTP id 82AAA58CE for ; Mon, 22 Jan 2018 13:04:44 +0100 (CET) Received: by mail-wm0-f65.google.com with SMTP id x4so17202178wmc.0 for ; Mon, 22 Jan 2018 04:04:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=KpwPSwAheHhA6kNMWtRP+FP0i26tgDnnPPTZeH5YPoA=; b=Xt5++4XGSN99+hkn0FumoT7FC2oI0TEGCeRxqsxkongsytAcmvf3P4ItpJWdLJX7K+ zW1w33BJMOAbqwD0q3vlxdKycYo+Rik6AiZMW4XlKHgSQjRRv0QGJYpDhss7s6hD+vOp jdmGaM52trq87DrrLrXAdIJbNAixopdoL8wgiGN+gR4rglKIn9eeJFpmEmfzjfXZV154 KMpNO5OtVbKAWKaSCdiMTl2PcywJ1n5of4EnkhIT3wraLjl9Df8jm42DUi1fC9ILtaLc QjqnS8M6yBIj3fKvKJhgcl50IBBtfMSt23+1N8bPesOBkSvv/kSScoejPwoPKv84JjIm /OsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=KpwPSwAheHhA6kNMWtRP+FP0i26tgDnnPPTZeH5YPoA=; b=EF7d4KAr2uENMLjTKAnDeGTH7d+UCg+XMmpBhi7bqBTyhJJZx4RaaqOAwYDD/XYoOx 4C+J1SGIWtjNbjkMREBvxdLYrXFUrwWttH+tN7uxziAARg4An+5RnbxiMcvS4D9aM2N+ l0OrLsRQYog/eVohyq9xVDmFHkcdeX49LzWT03VhDX1qsC4LRfZ2Ig+1196QxYy8Xb/F iOhJvggwMXp0lxWTL48VDlsc5eoKIFkY1wiBXgxRRhCNTp5ad1GJMEamEMpgx3b16tfT FPSOHWM/59HyluoIm9tyFCp17o+QYV9MhafrotbvGJBDhPf3aMmHn0CjehmvKKfXcjam +C0g== X-Gm-Message-State: AKwxytcVLmuDhcOvqcWAK5w0z3Oqd7inAJq0cVbB6GrmQZXP1Nx2maDg +NHWt1qlhWLtqCEOIAlvg7vsCVor9Yc= X-Google-Smtp-Source: AH8x224+2C7TaVfVv+UyAy24L2+vuFagWRUxGAPzSQqXtBh+nHRSNbOnhjud1hrknPHsHMO9bI+v5Q== X-Received: by 10.80.189.139 with SMTP id y11mr1830143edh.122.1516622684100; Mon, 22 Jan 2018 04:04:44 -0800 (PST) Received: from sh.semihalf.local (31-172-191-173.noc.fibertech.net.pl. [31.172.191.173]) by smtp.gmail.com with ESMTPSA id m15sm7450285edj.41.2018.01.22.04.04.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 22 Jan 2018 04:04:43 -0800 (PST) From: Tomasz Duszynski To: dev@dpdk.org Cc: mw@semihalf.com, dima@marvell.com, nsamsono@marvell.com, Jianbo.liu@arm.com, jck@semihalf.com, Tomasz Duszynski Date: Mon, 22 Jan 2018 13:04:30 +0100 Message-Id: <1516622670-21120-3-git-send-email-tdu@semihalf.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1516622670-21120-1-git-send-email-tdu@semihalf.com> References: <1516622670-21120-1-git-send-email-tdu@semihalf.com> Subject: [dpdk-dev] [PATCH 2/2] net/mrvl: switch to the new Tx offload API 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: , X-List-Received-Date: Mon, 22 Jan 2018 12:04:44 -0000 Since the old Tx offload API was depracated update the driver to use the latest one. Signed-off-by: Tomasz Duszynski --- drivers/net/mrvl/mrvl_ethdev.c | 52 ++++++++++++++++++++++++++++++++++++++---- 1 file changed, 47 insertions(+), 5 deletions(-) diff --git a/drivers/net/mrvl/mrvl_ethdev.c b/drivers/net/mrvl/mrvl_ethdev.c index 2e8c6cc..dec56f3 100644 --- a/drivers/net/mrvl/mrvl_ethdev.c +++ b/drivers/net/mrvl/mrvl_ethdev.c @@ -100,6 +100,10 @@ DEV_RX_OFFLOAD_CRC_STRIP | \ DEV_RX_OFFLOAD_CHECKSUM) +/** Port Tx offloads capabilities */ +#define MRVL_TX_OFFLOADS (DEV_TX_OFFLOAD_IPV4_CKSUM | \ + DEV_TX_OFFLOAD_UDP_CKSUM | \ + DEV_TX_OFFLOAD_TCP_CKSUM) static const char * const valid_args[] = { MRVL_IFACE_NAME_ARG, @@ -1134,9 +1138,8 @@ mrvl_dev_infos_get(struct rte_eth_dev *dev __rte_unused, info->rx_offload_capa = MRVL_RX_OFFLOADS; info->rx_queue_offload_capa = MRVL_RX_OFFLOADS; - info->tx_offload_capa = DEV_TX_OFFLOAD_IPV4_CKSUM | - DEV_TX_OFFLOAD_UDP_CKSUM | - DEV_TX_OFFLOAD_TCP_CKSUM; + info->tx_offload_capa = MRVL_TX_OFFLOADS; + info->tx_queue_offload_capa = MRVL_TX_OFFLOADS; info->flow_type_rss_offloads = ETH_RSS_IPV4 | ETH_RSS_NONFRAG_IPV4_TCP | @@ -1477,6 +1480,42 @@ mrvl_rx_queue_release(void *rxq) } /** + * Check whether requested tx queue offloads match port offloads. + * + * @param + * dev Pointer to the device. + * @param + * requested Bitmap of the requested offloads. + * + * @return + * 1 if requested offloads are okay, 0 otherwise. + */ +static int +mrvl_tx_queue_offloads_okay(struct rte_eth_dev *dev, uint64_t requested) +{ + uint64_t mandatory = dev->data->dev_conf.txmode.offloads; + uint64_t supported = MRVL_TX_OFFLOADS; + uint64_t unsupported = requested & ~supported; + uint64_t missing = (requested & mandatory) ^ mandatory; + + if (unsupported) { + RTE_LOG(ERR, PMD, "Some Rx offloads are not supported. " + "Requested 0x%" PRIx64 " supported 0x%" PRIx64 ".\n", + requested, supported); + return 0; + } + + if (missing) { + RTE_LOG(ERR, PMD, "Some Rx offloads are missing. " + "Requested 0x%" PRIx64 " missing 0x%" PRIx64 ".\n", + requested, missing); + return 0; + } + + return 1; +} + +/** * DPDK callback to configure the transmit queue. * * @param dev @@ -1488,7 +1527,7 @@ mrvl_rx_queue_release(void *rxq) * @param socket * NUMA socket on which memory must be allocated. * @param conf - * Thresholds parameters (unused). + * Thresholds parameters. * * @return * 0 on success, negative error value otherwise. @@ -1496,11 +1535,14 @@ mrvl_rx_queue_release(void *rxq) static int mrvl_tx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc, unsigned int socket, - const struct rte_eth_txconf *conf __rte_unused) + const struct rte_eth_txconf *conf) { struct mrvl_priv *priv = dev->data->dev_private; struct mrvl_txq *txq; + if (!mrvl_tx_queue_offloads_okay(dev, conf->offloads)) + return -ENOTSUP; + if (dev->data->tx_queues[idx]) { rte_free(dev->data->tx_queues[idx]); dev->data->tx_queues[idx] = NULL; -- 2.7.4