From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0b-0016ce01.pphosted.com (mx0b-0016ce01.pphosted.com [67.231.156.153]) by dpdk.org (Postfix) with ESMTP id 26025C57E for ; Thu, 16 Jun 2016 07:48:12 +0200 (CEST) Received: from pps.filterd (m0085408.ppops.net [127.0.0.1]) by mx0b-0016ce01.pphosted.com (8.16.0.17/8.16.0.17) with SMTP id u5G5l2Kh022394; Wed, 15 Jun 2016 22:48:11 -0700 Received: from avcashub1.qlogic.com ([198.186.0.115]) by mx0b-0016ce01.pphosted.com with ESMTP id 23ghmn70cr-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Wed, 15 Jun 2016 22:48:11 -0700 Received: from avluser05.qlc.com (10.1.113.115) by qlc.com (10.1.4.190) with Microsoft SMTP Server id 14.3.235.1; Wed, 15 Jun 2016 22:48:10 -0700 Received: (from rmody@localhost) by avluser05.qlc.com (8.14.4/8.14.4/Submit) id u5G5mAJG023305; Wed, 15 Jun 2016 22:48:10 -0700 X-Authentication-Warning: avluser05.qlc.com: rmody set sender to rasesh.mody@qlogic.com using -f From: Rasesh Mody To: CC: , , Sony Chacko Date: Wed, 15 Jun 2016 22:47:07 -0700 Message-ID: <1466056031-23225-6-git-send-email-rasesh.mody@qlogic.com> X-Mailer: git-send-email 1.7.10.3 In-Reply-To: <1466056031-23225-1-git-send-email-rasesh.mody@qlogic.com> References: <1466056031-23225-1-git-send-email-rasesh.mody@qlogic.com> MIME-Version: 1.0 Content-Type: text/plain disclaimer: bypass X-Proofpoint-Virus-Version: vendor=nai engine=5800 definitions=8197 signatures=670729 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 suspectscore=1 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 impostorscore=0 lowpriorityscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1604210000 definitions=main-1606160068 Subject: [dpdk-dev] [PATCH v2 5/9] qede: add support for setting the MTU 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: Thu, 16 Jun 2016 05:48:12 -0000 From: Sony Chacko Add support for setting the MTU. Signed-off-by: Sony Chacko --- drivers/net/qede/qede_ethdev.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c index 3754454..af16277 100644 --- a/drivers/net/qede/qede_ethdev.c +++ b/drivers/net/qede/qede_ethdev.c @@ -885,6 +885,38 @@ int qede_rss_reta_query(struct rte_eth_dev *eth_dev, return 0; } +int qede_set_mtu(struct rte_eth_dev *dev, uint16_t mtu) +{ + uint32_t frame_size; + struct qede_dev *qdev = dev->data->dev_private; + struct rte_eth_dev_info dev_info = {0}; + + qede_dev_info_get(dev, &dev_info); + + /* VLAN_TAG = 4 */ + frame_size = mtu + ETHER_HDR_LEN + ETHER_CRC_LEN + 4; + + if ((mtu < ETHER_MIN_MTU) || (frame_size > dev_info.max_rx_pktlen)) + return -EINVAL; + + if (!dev->data->scattered_rx && + frame_size > dev->data->min_rx_buf_size - RTE_PKTMBUF_HEADROOM) + return -EINVAL; + + if (frame_size > ETHER_MAX_LEN) + dev->data->dev_conf.rxmode.jumbo_frame = 1; + else + dev->data->dev_conf.rxmode.jumbo_frame = 0; + + /* update max frame size */ + dev->data->dev_conf.rxmode.max_rx_pkt_len = frame_size; + qdev->mtu = mtu; + qede_dev_stop(dev); + qede_dev_start(dev); + + return 0; +} + static const struct eth_dev_ops qede_eth_dev_ops = { .dev_configure = qede_dev_configure, .dev_infos_get = qede_dev_info_get, @@ -916,6 +948,7 @@ static const struct eth_dev_ops qede_eth_dev_ops = { .rss_hash_conf_get = qede_rss_hash_conf_get, .reta_update = qede_rss_reta_update, .reta_query = qede_rss_reta_query, + .mtu_set = qede_set_mtu, }; static const struct eth_dev_ops qede_eth_vf_dev_ops = { @@ -944,6 +977,7 @@ static const struct eth_dev_ops qede_eth_vf_dev_ops = { .rss_hash_conf_get = qede_rss_hash_conf_get, .reta_update = qede_rss_reta_update, .reta_query = qede_rss_reta_query, + .mtu_set = qede_set_mtu, }; static void qede_update_pf_params(struct ecore_dev *edev) -- 1.7.10.3