From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf0-f49.google.com (mail-lf0-f49.google.com [209.85.215.49]) by dpdk.org (Postfix) with ESMTP id 77B111B213 for ; Mon, 9 Oct 2017 17:01:12 +0200 (CEST) Received: by mail-lf0-f49.google.com with SMTP id k40so8168798lfi.4 for ; Mon, 09 Oct 2017 08:01:12 -0700 (PDT) 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=KqIJ6gQgjuvxnk9MazGy8iHeDCyNU8DIOLcbUwmzNuE=; b=M7IT7A2O1IZi7yfxB0djr2cnSh/Dlgpk2mZxTNhQImgskWH7Ehdf84ar38Bmbh2xtp nff2KDIujB+p27cxY+3Wossa5WJYDxrMgkOVpnRXI4h9uh9+H5NMF77FPE/VQb8MNkFL cUJowxP57jvEG1b1EnnmIoaZxWKyU+CBNUs336a8K+nty+96Jiwk6Kp/dYU97TInFypx VNqItt6VDYUxQ14OkW+QUQ60jA9cIptKbCtk2kXv3anV7dDUFHFoCuEg68sfKGdspyoU BRBkZMtxOWLTHzeK1eezZk14UMyqi48J0cTM95D60U7bTHMfHXBJn4C2CVEPXrcnxexe hj8w== 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=KqIJ6gQgjuvxnk9MazGy8iHeDCyNU8DIOLcbUwmzNuE=; b=swHMSUmdNC2hfAkxzaHIIXXGSepUoevJ2GU3hauc2nnhmChad7XFr7F1rVEIPNt+oB aYq4nwexSgbEa8+dXaCFlXG19Y4vbzcqnwDJ0HH5alyIwOgfAhEaH/dO3e2mwVOkLl5/ Lxhuf4pFLSYTEBdwLdUQslKTZgzeMulSDFccfNgAJvT5qBWR8af30L2a7NCG12DnSvSR SmzLtRFxlYKsDP6UOzuqn8ETO07e2ha7XknVDFF5K8HjHv3elWqfBR6g/XqN/VT8xNdM iQ3qCfXwW9iM+NwYb0mratXQO8sZpiS5O58mkFL4091crVEs6Lb/qJZnIUrIvFEkngq5 ihSQ== X-Gm-Message-State: AMCzsaVb7dqJY5u7pvZw3ZFTarLx3ptD4KNw1G6B6zE56Pe7D5x9t3OP L4rYhF5e5aal8f1OzTTUuiNhZbi54II= X-Google-Smtp-Source: AOwi7QBkpHI+Yn1VbAKdrdwgPwVAt8tV5lV7TZZUlHijkqnhNFMPwU7m9HGYC+D7ay/waGRgxo4Ihw== X-Received: by 10.46.88.68 with SMTP id x4mr726223ljd.138.1507561271749; Mon, 09 Oct 2017 08:01:11 -0700 (PDT) Received: from tdu.semihalf.local (31-172-191-173.noc.fibertech.net.pl. [31.172.191.173]) by smtp.gmail.com with ESMTPSA id z64sm1352637lfa.91.2017.10.09.08.01.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 09 Oct 2017 08:01:11 -0700 (PDT) From: Tomasz Duszynski To: dev@dpdk.org Cc: mw@semihalf.com, dima@marvell.com, nsamsono@marvell.com, Jianbo.liu@linaro.org, Tomasz Duszynski , Jacek Siuda Date: Mon, 9 Oct 2017 17:00:34 +0200 Message-Id: <1507561244-20115-7-git-send-email-tdu@semihalf.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1507561244-20115-1-git-send-email-tdu@semihalf.com> References: <1507031500-11473-1-git-send-email-tdu@semihalf.com> <1507561244-20115-1-git-send-email-tdu@semihalf.com> Subject: [dpdk-dev] [PATCH v4 06/16] net/mrvl: add support for updating mtu 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, 09 Oct 2017 15:01:12 -0000 Add support for updating mtu. Signed-off-by: Jacek Siuda Signed-off-by: Tomasz Duszynski --- doc/guides/nics/features/mrvl.ini | 1 + drivers/net/mrvl/mrvl_ethdev.c | 44 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+) diff --git a/doc/guides/nics/features/mrvl.ini b/doc/guides/nics/features/mrvl.ini index c3b9edf..13cfaab 100644 --- a/doc/guides/nics/features/mrvl.ini +++ b/doc/guides/nics/features/mrvl.ini @@ -6,3 +6,4 @@ [Features] Speed capabilities = Y Link status = Y +MTU update = Y diff --git a/drivers/net/mrvl/mrvl_ethdev.c b/drivers/net/mrvl/mrvl_ethdev.c index 7bd0dad..628d4de 100644 --- a/drivers/net/mrvl/mrvl_ethdev.c +++ b/drivers/net/mrvl/mrvl_ethdev.c @@ -239,6 +239,38 @@ mrvl_dev_configure(struct rte_eth_dev *dev) } /** + * DPDK callback to change the MTU. + * + * Setting the MTU affects hardware MRU (packets larger than the MRU + * will be dropped). + * + * @param dev + * Pointer to Ethernet device structure. + * @param mtu + * New MTU. + * + * @return + * 0 on success, negative error value otherwise. + */ +static int +mrvl_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) +{ + struct mrvl_priv *priv = dev->data->dev_private; + /* extra MV_MH_SIZE bytes are required for Marvell tag */ + uint16_t mru = mtu + MV_MH_SIZE + ETHER_HDR_LEN + ETHER_CRC_LEN; + int ret; + + if (mtu < ETHER_MIN_MTU || mru > MRVL_PKT_SIZE_MAX) + return -EINVAL; + + ret = pp2_ppio_set_mru(priv->ppio, mru); + if (ret) + return ret; + + return pp2_ppio_set_mtu(priv->ppio, mtu); +} + +/** * DPDK callback to bring the link up. * * @param dev @@ -257,6 +289,17 @@ mrvl_dev_set_link_up(struct rte_eth_dev *dev) if (ret) return ret; + /* + * mtu/mru can be updated if pp2_ppio_enable() was called at least once + * as pp2_ppio_enable() changes port->t_mode from default 0 to + * PP2_TRAFFIC_INGRESS_EGRESS. + * + * Set mtu to default DPDK value here. + */ + ret = mrvl_mtu_set(dev, dev->data->mtu); + if (ret) + pp2_ppio_disable(priv->ppio); + dev->data->dev_link.link_status = ETH_LINK_UP; return ret; @@ -887,6 +930,7 @@ static const struct eth_dev_ops mrvl_ops = { .dev_close = mrvl_dev_close, .link_update = mrvl_link_update, .mac_addr_set = mrvl_mac_addr_set, + .mtu_set = mrvl_mtu_set, .dev_infos_get = mrvl_dev_infos_get, .rxq_info_get = mrvl_rxq_info_get, .txq_info_get = mrvl_txq_info_get, -- 2.7.4