From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wi0-f177.google.com (mail-wi0-f177.google.com [209.85.212.177]) by dpdk.org (Postfix) with ESMTP id 6E79EAFD0 for ; Mon, 26 May 2014 13:31:34 +0200 (CEST) Received: by mail-wi0-f177.google.com with SMTP id f8so4181116wiw.16 for ; Mon, 26 May 2014 04:31:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=6aeS4ao4xH41p83lASqi4UDZAlpJ6nDpYRovNjXrNCM=; b=MLDbhlu0eZqAPVX2TPrrYXWBOvx6VxfVvH25SxKd9pt/keraLS5ESeXUGXWBqYqxNf gr0KMKcU45uuRVg7F7791deb6HQ0Cl6ESN2sSyVVz5eaeZimdgsc+O/+areyrQYUVwQW 3gnml/fyKfx08k7L+71QZf4ZUdDjwMzsbIBT9O9hMVbHwcg8Pc1nGGFqWQsMk0UcMD8u 9s5lcrkt4o34eghGo63lYFrgrgTCMgaVSRZ7p5wG/QvjlG25kUeQeYcEkqZHukc/PZJu MupvmaXwEdFpx8tCbtm2/KZiURoXXItJTQ+56/Y/6wC8FaBsQPuJQQVHcUzADIh17ibQ 7BBw== X-Gm-Message-State: ALoCoQnfzIpelDMnjNR5OxQupMsRY6SBxsrg9Z/PNclx3BwVU6f7cBik7RvmoGpKLGYw/LIhwTWb X-Received: by 10.194.174.168 with SMTP id bt8mr27485023wjc.72.1401103904794; Mon, 26 May 2014 04:31:44 -0700 (PDT) Received: from alcyon.dev.6wind.com (6wind.net2.nerim.net. [213.41.180.237]) by mx.google.com with ESMTPSA id ed6sm26174059wib.20.2014.05.26.04.31.43 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 26 May 2014 04:31:44 -0700 (PDT) From: David Marchand To: dev@dpdk.org Date: Mon, 26 May 2014 13:31:31 +0200 Message-Id: <1401103892-17225-5-git-send-email-david.marchand@6wind.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1401103892-17225-1-git-send-email-david.marchand@6wind.com> References: <1401103892-17225-1-git-send-email-david.marchand@6wind.com> Subject: [dpdk-dev] [PATCH 4/5] ixgbe: add get/set_mtu to ixgbevf X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 May 2014 11:31:35 -0000 From: Ivan Boule The support of jumbo frames in the ixgbevf Poll Mode Driver of 10GbE 82599 VF functions consists in the following enhancements: - Implement the mtu_set function in the ixgbevf PMD, using the IXGBE_VF_SET_LPE request of the version 1.0 of the VF/PF mailbox API for this purpose. - Implement the mtu_get function in the ixgbevf PMD for the sake of coherency. - Add a detailed explanation on the VF/PF rx max frame len negotiation. - To deal with Jumbo frames, force the receive function to handle scattered packets. Signed-off-by: Ivan Boule Signed-off-by: David Marchand --- lib/librte_pmd_ixgbe/ixgbe_ethdev.c | 45 +++++++++++++++++++++++++++++++++++ lib/librte_pmd_ixgbe/ixgbe_rxtx.c | 18 +++++++++++++- 2 files changed, 62 insertions(+), 1 deletion(-) diff --git a/lib/librte_pmd_ixgbe/ixgbe_ethdev.c b/lib/librte_pmd_ixgbe/ixgbe_ethdev.c index b9db1f4..230b758 100644 --- a/lib/librte_pmd_ixgbe/ixgbe_ethdev.c +++ b/lib/librte_pmd_ixgbe/ixgbe_ethdev.c @@ -194,6 +194,9 @@ static void ixgbevf_add_mac_addr(struct rte_eth_dev *dev, uint32_t index, uint32_t pool); static void ixgbevf_remove_mac_addr(struct rte_eth_dev *dev, uint32_t index); +static int ixgbevf_dev_get_mtu(struct rte_eth_dev *dev, uint16_t *mtu); +static int ixgbevf_dev_set_mtu(struct rte_eth_dev *dev, uint16_t *mtu); + /* * Define VF Stats MACRO for Non "cleared on read" register */ @@ -334,6 +337,8 @@ static struct eth_dev_ops ixgbevf_eth_dev_ops = { .stats_reset = ixgbevf_dev_stats_reset, .dev_close = ixgbevf_dev_close, .dev_infos_get = ixgbe_dev_info_get, + .mtu_get = ixgbevf_dev_get_mtu, + .mtu_set = ixgbevf_dev_set_mtu, .vlan_filter_set = ixgbevf_vlan_filter_set, .vlan_strip_queue_set = ixgbevf_vlan_strip_queue_set, .vlan_offload_set = ixgbevf_vlan_offload_set, @@ -3319,6 +3324,46 @@ ixgbevf_remove_mac_addr(struct rte_eth_dev *dev, uint32_t index) } } +static int +ixgbevf_dev_set_mtu(struct rte_eth_dev *dev, uint16_t *mtu) +{ + struct ixgbe_hw *hw; + uint16_t max_frame = *mtu + ETHER_HDR_LEN + ETHER_CRC_LEN; + + hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); + + /* MTU < 68 is an error and causes problems on some kernels */ + if ((*mtu < 68) || (max_frame > ETHER_MAX_JUMBO_FRAME_LEN)) + return -EINVAL; + + /* + * When supported by the underlying PF driver, use the IXGBE_VF_SET_MTU + * request of the version 2.0 of the mailbox API. + * For now, use the IXGBE_VF_SET_LPE request of the version 1.0 + * of the mailbox API. + * This call to IXGBE_SET_LPE action won't work with ixgbe pf drivers + * prior to 3.11.33 which contains the following change: + * "ixgbe: Enable jumbo frames support w/ SR-IOV" + */ + ixgbevf_rlpml_set_vf(hw, max_frame); + + /* update max frame size */ + dev->data->dev_conf.rxmode.max_rx_pkt_len = max_frame; + return 0; +} + +static int +ixgbevf_dev_get_mtu(struct rte_eth_dev *dev, uint16_t *mtu) +{ + /* + * When available, use the IXGBE_VF_GET_MTU request + * of the version 2.0 of the mailbox API. + */ + *mtu = (uint16_t) (dev->data->dev_conf.rxmode.max_rx_pkt_len - + (ETHER_HDR_LEN + ETHER_CRC_LEN)); + return 0; +} + static struct rte_driver rte_ixgbe_driver = { .type = PMD_PDEV, .init = rte_ixgbe_pmd_init, diff --git a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c index b05c1ba..c797616 100644 --- a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c +++ b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c @@ -3700,7 +3700,20 @@ ixgbevf_dev_rx_init(struct rte_eth_dev *dev) PMD_INIT_FUNC_TRACE(); hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); - /* setup MTU */ + /* + * When the VF driver issues a IXGBE_VF_RESET request, the PF driver + * disables the VF receipt of packets if the PF MTU is > 1500. + * This is done to deal with 82599 limitations that imposes + * the PF and all VFs to share the same MTU. + * Then, the PF driver enables again the VF receipt of packet when + * the VF driver issues a IXGBE_VF_SET_LPE request. + * In the meantime, the VF device cannot be used, even if the VF driver + * and the Guest VM network stack are ready to accept packets with a + * size up to the PF MTU. + * As a work-around to this PF behaviour, force the call to + * ixgbevf_rlpml_set_vf even if jumbo frames are not used. This way, + * VF packets received can work in all cases. + */ ixgbevf_rlpml_set_vf(hw, (uint16_t)dev->data->dev_conf.rxmode.max_rx_pkt_len); @@ -3783,6 +3796,9 @@ ixgbevf_dev_rx_init(struct rte_eth_dev *dev) } } + /* Set RX function to deal with Jumbo frames */ + ixgbe_dev_set_rx_scatter_mode(dev); + return 0; } -- 1.7.10.4