From patchwork Thu Feb 4 18:17:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Loic Poulain X-Patchwork-Id: 376318 Delivered-To: patch@linaro.org Received: by 2002:a17:906:48d2:0:0:0:0 with SMTP id d18csp1512031ejt; Thu, 4 Feb 2021 10:13:32 -0800 (PST) X-Google-Smtp-Source: ABdhPJyI72TXf8yuKr0RTDxQyW+tsSOXauvyPpYE6XUSlnDw5HpTnG7/2OQeHp2SvytVqh2v0Ddz X-Received: by 2002:a17:906:c08a:: with SMTP id f10mr383772ejz.52.1612462412580; Thu, 04 Feb 2021 10:13:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612462412; cv=none; d=google.com; s=arc-20160816; b=lG5EGq7aewRie0dPlZDIdMKnhCeX7Y61E2hyUR0xq+Q/jF3dg0+61v1myYfPJsP5N4 GX780qJSO75OWxAvXQv9tVhY82gG5HrR3gFIp0wSy+EnqPD1IokdQ1uPMqIernW2A3ud pyYEBjhFf7XYxJNRE5WvYcSvbYBmq6QrS7RIfgBg99JhisOSJfiPaKWGn3mCn8hlvFYe AeqoyrvmxpBGJiSS+Lu8q8bItPK+nsuskK8iAoUFWppIJTDBexns1rKUVsApKRtusuOM mMlR5Tab1yqKrE6JAgdixFDt0HOKNtmRuxaYYpVVE0Y5inewWI93qXqL1x4wj5c4RZ1v r29Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dkim-signature; bh=nUxAXdLjhkJNUqiBcTNdD1orykfV5lPBWV6f7eDBEEk=; b=IJs0A19agSRZhad1qz8COn4H//er49FOuQH3Ee5iHdFiJNvFjBoeOw39Upj5eCiX6B dU/quVkZ/Mb05daYIvV/jdDzCYwrxWKndyWg5qY7NkEVTSPTFCYIO1ee7ueS/WQcvsEq kkXZTuVyTkqi0XjJ1qDMMtNtcBYAvsd+8J2hXxJAu8VjGij9RwzVq3/m7BOtnSVw1YcL vq+HRWOvOXoGyaOkSQI4Ad9qxoqSUz3DYeB2/FE6/xWN3yTBbqtAxIgsdLjR4ssQlVRd UF4mStZNm/2ioNfXPKiUKJHx0VGm0VWqQtwtskYRl2La7UdaJ0gFqzi+Zv6l7QSOhvoJ oPFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="YS/hhQgn"; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t14si4073659edd.161.2021.02.04.10.13.31; Thu, 04 Feb 2021 10:13:32 -0800 (PST) Received-SPF: pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="YS/hhQgn"; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238969AbhBDSMn (ORCPT + 7 others); Thu, 4 Feb 2021 13:12:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45358 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238854AbhBDSKq (ORCPT ); Thu, 4 Feb 2021 13:10:46 -0500 Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7996FC06178B for ; Thu, 4 Feb 2021 10:10:06 -0800 (PST) Received: by mail-wr1-x42d.google.com with SMTP id d16so4601109wro.11 for ; Thu, 04 Feb 2021 10:10:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=nUxAXdLjhkJNUqiBcTNdD1orykfV5lPBWV6f7eDBEEk=; b=YS/hhQgn/ccTu+txLHLst5dnQ2u4qrZwkIRV2iqHghfJGHkoNMxuMBncBrxJXp3eYX z9F5USu7xrFfOwEDMdVfgUuZwCHmqpsvVVRDL8I3+ywXecWS+8zZqpAxJVDRlp/LasPG 6OqvtX3/rYNkliAwfMHk5Hzgv9vfMZK1Fn0EqDC9a5/OSh31kVJJultFC1V3GWI9I6zn EOgmJ4lm/PXzCwlBo5odeeHdr855+zt4j6gFUyFJpA45frlX0cYeVMef5HxAWwK2eBpP IPyx7WYv+l90mMT8ECV/oiymMYGhIhh6w0eyMZ89DR5bgo5h3hh6Orqj7iUvIuSZsKzN jcZQ== 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=nUxAXdLjhkJNUqiBcTNdD1orykfV5lPBWV6f7eDBEEk=; b=qKD6SGRvmPfbirFZaDpAKywL/7J5R/RS7s/hl6wqEozYbb5U1yVKsuWIAHpeYzMoQ7 f/iJijCa6nNiW3jm3bPyyekL8LKHZPGftKlhcKEFeYJbcCkNacCGrIXUtiS68AoEpTeL +ws19zuKQjaTxK0f7T5CXB8vg69awTE3ZVe59xNDGq1dM/eemhWk+2fDTxoUnWL2/pQb kbe44co1VrtpeomzwJOH9EPm94kbvSuwUZvAl724vT0CbxXHpr0SkJ0dMOx0oFbGVzJf jc8+EcXMoaXrh7KQjBj+PiYURTy6YFMrYnDqwev3kejAA3cgFlt1f1h7xXabgC0ASCYQ CmVg== X-Gm-Message-State: AOAM532UzF0FcSbVL3/56vUZ1ZJTIFHmG2zSn82hdn43I/ruLsIrH8Lv 6WTXFxc6wsw431h5u4q2AFnpeA== X-Received: by 2002:adf:ce89:: with SMTP id r9mr595461wrn.345.1612462205253; Thu, 04 Feb 2021 10:10:05 -0800 (PST) Received: from localhost.localdomain ([88.122.66.28]) by smtp.gmail.com with ESMTPSA id m6sm6313746wmq.13.2021.02.04.10.10.03 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 04 Feb 2021 10:10:04 -0800 (PST) From: Loic Poulain To: kuba@kernel.org, davem@davemloft.net Cc: netdev@vger.kernel.org, bjorn@mork.no, dcbw@redhat.com, carl.yin@quectel.com, mpearson@lenovo.com, cchen50@lenovo.com, jwjiang@lenovo.com, ivan.zhang@quectel.com, naveen.kumar@quectel.com, Loic Poulain Subject: [PATCH net-next v3 3/5] net: mhi: Create mhi.h Date: Thu, 4 Feb 2021 19:17:39 +0100 Message-Id: <1612462661-23045-4-git-send-email-loic.poulain@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1612462661-23045-1-git-send-email-loic.poulain@linaro.org> References: <1612462661-23045-1-git-send-email-loic.poulain@linaro.org> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Move mhi-net shared structures to mhi header, that will be used by upcoming proto(s). Signed-off-by: Loic Poulain --- drivers/net/mhi/mhi.h | 36 ++++++++++++++++++++++++++++++++++++ drivers/net/mhi/net.c | 33 ++------------------------------- 2 files changed, 38 insertions(+), 31 deletions(-) create mode 100644 drivers/net/mhi/mhi.h -- 2.7.4 diff --git a/drivers/net/mhi/mhi.h b/drivers/net/mhi/mhi.h new file mode 100644 index 0000000..5050e4a --- /dev/null +++ b/drivers/net/mhi/mhi.h @@ -0,0 +1,36 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* MHI Network driver - Network over MHI bus + * + * Copyright (C) 2021 Linaro Ltd + */ + +struct mhi_net_stats { + u64_stats_t rx_packets; + u64_stats_t rx_bytes; + u64_stats_t rx_errors; + u64_stats_t rx_dropped; + u64_stats_t tx_packets; + u64_stats_t tx_bytes; + u64_stats_t tx_errors; + u64_stats_t tx_dropped; + struct u64_stats_sync tx_syncp; + struct u64_stats_sync rx_syncp; +}; + +struct mhi_net_dev { + struct mhi_device *mdev; + struct net_device *ndev; + struct sk_buff *skbagg_head; + struct sk_buff *skbagg_tail; + const struct mhi_net_proto *proto; + void *proto_data; + struct delayed_work rx_refill; + struct mhi_net_stats stats; + u32 rx_queue_sz; +}; + +struct mhi_net_proto { + int (*init)(struct mhi_net_dev *mhi_netdev); + struct sk_buff * (*tx_fixup)(struct mhi_net_dev *mhi_netdev, struct sk_buff *skb); + void (*rx)(struct mhi_net_dev *mhi_netdev, struct sk_buff *skb); +}; diff --git a/drivers/net/mhi/net.c b/drivers/net/mhi/net.c index b92c2e1..58b4b7c 100644 --- a/drivers/net/mhi/net.c +++ b/drivers/net/mhi/net.c @@ -12,41 +12,12 @@ #include #include +#include "mhi.h" + #define MHI_NET_MIN_MTU ETH_MIN_MTU #define MHI_NET_MAX_MTU 0xffff #define MHI_NET_DEFAULT_MTU 0x4000 -struct mhi_net_stats { - u64_stats_t rx_packets; - u64_stats_t rx_bytes; - u64_stats_t rx_errors; - u64_stats_t rx_dropped; - u64_stats_t tx_packets; - u64_stats_t tx_bytes; - u64_stats_t tx_errors; - u64_stats_t tx_dropped; - struct u64_stats_sync tx_syncp; - struct u64_stats_sync rx_syncp; -}; - -struct mhi_net_dev { - struct mhi_device *mdev; - struct net_device *ndev; - struct sk_buff *skbagg_head; - struct sk_buff *skbagg_tail; - const struct mhi_net_proto *proto; - void *proto_data; - struct delayed_work rx_refill; - struct mhi_net_stats stats; - u32 rx_queue_sz; -}; - -struct mhi_net_proto { - int (*init)(struct mhi_net_dev *mhi_netdev); - struct sk_buff * (*tx_fixup)(struct mhi_net_dev *mhi_netdev, struct sk_buff *skb); - void (*rx)(struct mhi_net_dev *mhi_netdev, struct sk_buff *skb); -}; - struct mhi_device_info { const char *netname; const struct mhi_net_proto *proto;