From patchwork Sun Nov 25 23:43:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Grygorii Strashko X-Patchwork-Id: 151954 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp4946770ljp; Sun, 25 Nov 2018 15:43:26 -0800 (PST) X-Google-Smtp-Source: AFSGD/UULxvUUh1ckZnnh72k4t/eIUCTJwO44+k/rgbZf2MIsc2xdaw/MpJ+QwBw41qeofbbGBei X-Received: by 2002:a17:902:b093:: with SMTP id p19mr4764765plr.135.1543189406028; Sun, 25 Nov 2018 15:43:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543189406; cv=none; d=google.com; s=arc-20160816; b=qLUv4uUAjXfX8gIOVGfxNqmt2ZjKW0MCMA6oH8sruZQgmsaDl5NqN9oO+N2/M0tZa7 SVinvQH3Q+KJhd5cigeY3qTGrGoQu9ZstLmo0vV2SChz/xxUGwsUnAyzuEGlIlGQqUsC QBNdLDx01/HA/wbrffnpgGmlE1fN6r85g5UBYqjwAsRLyCc4+ltsctSnJC2ojNllyyL6 QxdL4ejoYX45QWncetoxKjr3agN2wN/ISo+mO3g8w6WJ/YG3MzWNf2CwYAvXkXBS9Bfm EUkqIAQ2zoNpFi4v7sdWa3DlRTFEFx7a9gXq5R45CpUY3hZdqWYWgUW+lh0QSKAlkSdL AmXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from; bh=afA4pApyFIaxPkauydMKE/S+2iHvPP6UTKiRGAYD8Sg=; b=nABkZ/e7jfwJiPSfZ9A79s49Y8ExN3cFZryyzbJgQl6SYj0yNhvoZwNyFNGQ9a7qyB D6I3JA9VQzu09o6EIFW7UzOvlJlIwx6z7kefWWu5OV7RpQmtQAtxn2wy7CssoZ5JCAaB LE5PrvyafNUKhyyWsO4SKTt6ocwOwW9pVJEiRh7fz6VreR1lrhaaIOsXfndB3qFgChCz CxeqmVhaaY1sQ68rhemQdMDQDN4nXewEAQFwZ33Wf0T4yFpKVwj4l4tFGRmo7jMv+HAL mNBIAUmSTlrc1o+YPQJdl+FEIIEIg1ZJHZWIBNwiKjs5Ryok4O3CtAFXzdA9vDhFbUka QgrA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-omap-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-omap-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g7-v6si29588561plp.130.2018.11.25.15.43.25; Sun, 25 Nov 2018 15:43:26 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-omap-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-omap-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-omap-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726032AbeKZKfl (ORCPT + 5 others); Mon, 26 Nov 2018 05:35:41 -0500 Received: from fllv0016.ext.ti.com ([198.47.19.142]:47716 "EHLO fllv0016.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726027AbeKZKfl (ORCPT ); Mon, 26 Nov 2018 05:35:41 -0500 Received: from fllv0035.itg.ti.com ([10.64.41.0]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id wAPNhMvr088702; Sun, 25 Nov 2018 17:43:22 -0600 Received: from DFLE114.ent.ti.com (dfle114.ent.ti.com [10.64.6.35]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id wAPNhMcN098550 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Sun, 25 Nov 2018 17:43:22 -0600 Received: from DFLE104.ent.ti.com (10.64.6.25) by DFLE114.ent.ti.com (10.64.6.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1591.10; Sun, 25 Nov 2018 17:43:21 -0600 Received: from dlep33.itg.ti.com (157.170.170.75) by DFLE104.ent.ti.com (10.64.6.25) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1591.10 via Frontend Transport; Sun, 25 Nov 2018 17:43:21 -0600 Received: from legion.dal.desgin.ti.com (legion.dal.design.ti.com [128.247.22.53]) by dlep33.itg.ti.com (8.14.3/8.13.8) with ESMTP id wAPNhLH9015074; Sun, 25 Nov 2018 17:43:21 -0600 Received: from localhost (uda0226610.dhcp.ti.com [128.247.59.147]) by legion.dal.desgin.ti.com (8.11.7p1+Sun/8.11.7) with ESMTP id wAPNhLU03226; Sun, 25 Nov 2018 17:43:21 -0600 (CST) From: Grygorii Strashko To: "David S. Miller" , CC: Sekhar Nori , , , Grygorii Strashko Subject: [PATCH] net: ethernet: ti: cpsw: allow to configure min tx packet size Date: Sun, 25 Nov 2018 17:43:15 -0600 Message-ID: <20181125234315.28313-1-grygorii.strashko@ti.com> X-Mailer: git-send-email 2.10.5 MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org For proper VLAN packets forwarding CPSW driver uses min tx packet size of 64bytes (VLAN_ETH_ZLEN, excluding ETH_FCS) which was corrected by commit 9421c9015047 ("net: ethernet: ti: cpsw: fix min eth packet size"). Unfortunately, this breaks some industrial automation protocols, as reported by TI customers [1], which can work only with min TX packet size from 60 byte (ecluding FCS). Hence, introduce module boot parameter "tx_packet_min" to allow configure min TX packet size at boot time. [1] https://e2e.ti.com/support/arm/sitara_arm/f/791/t/701669 Fixes: 9421c9015047 ("net: ethernet: ti: cpsw: fix min eth packet size") Signed-off-by: Grygorii Strashko --- drivers/net/ethernet/ti/cpsw.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) -- 2.10.5 diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c index ceaec56..15d563c 100644 --- a/drivers/net/ethernet/ti/cpsw.c +++ b/drivers/net/ethernet/ti/cpsw.c @@ -188,6 +188,10 @@ static int rx_packet_max = CPSW_MAX_PACKET_SIZE; module_param(rx_packet_max, int, 0); MODULE_PARM_DESC(rx_packet_max, "maximum receive packet size (bytes)"); +static int tx_packet_min = CPSW_MIN_PACKET_SIZE; +module_param(tx_packet_min, int, 0444); +MODULE_PARM_DESC(tx_packet_min, "minimum tx packet size (bytes)"); + static int descs_pool_size = CPSW_CPDMA_DESCS_POOL_SIZE_DEFAULT; module_param(descs_pool_size, int, 0444); MODULE_PARM_DESC(descs_pool_size, "Number of CPDMA CPPI descriptors in pool"); @@ -2131,7 +2135,7 @@ static netdev_tx_t cpsw_ndo_start_xmit(struct sk_buff *skb, struct cpdma_chan *txch; int ret, q_idx; - if (skb_padto(skb, CPSW_MIN_PACKET_SIZE)) { + if (skb_padto(skb, tx_packet_min)) { cpsw_err(priv, tx_err, "packet pad failed\n"); ndev->stats.tx_dropped++; return NET_XMIT_DROP; @@ -3636,7 +3640,7 @@ static int cpsw_probe(struct platform_device *pdev) dma_params.num_chan = data->channels; dma_params.has_soft_reset = true; - dma_params.min_packet_size = CPSW_MIN_PACKET_SIZE; + dma_params.min_packet_size = tx_packet_min; dma_params.desc_mem_size = data->bd_ram_size; dma_params.desc_align = 16; dma_params.has_ext_regs = true;