From patchwork Tue Feb 9 09:05:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Loic Poulain X-Patchwork-Id: 379294 Delivered-To: patch@linaro.org Received: by 2002:a02:b18a:0:0:0:0:0 with SMTP id t10csp37609jah; Tue, 9 Feb 2021 01:02:30 -0800 (PST) X-Google-Smtp-Source: ABdhPJxya7HoJAjlRKR+2zEneR+cXKhOyfPrdKRpf8Gq+116DUfHdv06DS5JQ63EQ8DsUQMfBg57 X-Received: by 2002:a17:907:2705:: with SMTP id w5mr10888693ejk.136.1612861350111; Tue, 09 Feb 2021 01:02:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612861350; cv=none; d=google.com; s=arc-20160816; b=cW0ND5RLQ0W0k2PxKVLwEfb/euT4RQOf6oz8pidA1v6+jKKekv5eDebbCJzploIYCC r8JYOr7f+jur4nSdqVnWi7xYNrjESPw/6KxKz/o2STHOlkR8m/mpvoJkNY5s5u8pbK/L aV5i6FQTnCsoX8fUGO19jDWpUhPib14+n6QxkN6+/ypPH10gSGFuKYzALgSh0Dqk3aW/ q5Iv8+1VOS/2KUGdpWJlC62wC45IPBey+i7tX4yg5+E4NS87mtQrlWNMG+k/fk7JujHW ObzqFi/g3qXPcY8p7dzIM6o7NjokVf7vbFHVt2EwUvV/K5OsqtiyVLiW/2Cgsy1NhnoR NIWA== 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=PurOLCMjjzgzYgeK4YahQd4tbWuMvb2r4qxsVl9TQLUSiveOs5tpoqOs5teinuNfax NCAEicyTF3oLWRxIHkIJoYQjII+7LPlD1BXuGKbA5Vd5HIb6foMHOqGtBH1+SwS4kA6I q+ViWRkRQMzaPa1nex/CcUHiEGir0wEzS6AOP0W0JdUqYhJNy99SlFP7UMA5H9GXo9wM uxQ8QR5TZezt/4GfJk2xaA49aFhQQY6HXvGthXGwfRClgnoXAyh5BGFYIlRVpZHOSWgV 8IDRk5DNNWIz9/9b/Wm07R4HHFXkCgkD0IEMnv934g0II3ZkEUlIERDJwgJIefVvdftG LVRA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=og0zYNFu; 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 z9si15042895edb.204.2021.02.09.01.02.29; Tue, 09 Feb 2021 01:02:30 -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=og0zYNFu; 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 S230227AbhBIJBk (ORCPT + 8 others); Tue, 9 Feb 2021 04:01:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54870 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230183AbhBII6q (ORCPT ); Tue, 9 Feb 2021 03:58:46 -0500 Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4F9C8C06178C for ; Tue, 9 Feb 2021 00:58:00 -0800 (PST) Received: by mail-wr1-x436.google.com with SMTP id b3so20641702wrj.5 for ; Tue, 09 Feb 2021 00:58:00 -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=og0zYNFuIfnOyzDZ+rF4cq10kfF2FN328svbr8HZVYuYvn332y0r8UUG8iPVwejzAU kais7gmM0lW1Rw6nigqK1urngPaCjqxbBZdAH10oHPSBgyYQiDJRKqNCZtYEO8UJctrV mP9OIxwaJPyjb4n4iftCSOYq9yxTiQtqiz6DNMzPab2mmC0kqkYuQ8hWfyodVQRSmsdy gIDOgHBRAqi95KOFuNxUMh7QHzQKOtdEyQOvwoqFpKpOx4a+vgZusL9SOfkL1C9BP70c WQ/u7rYLUXn+Bd1RqETSubtdAkL2BbbXXLGCw3iT0IMz+PU7hHeXy6lB8gIqdFVoIuAa /hiw== 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=qHuqqfSMzOqag2he2SwccjgvhB3LfAfHem9INCDOLNHtbVLc/1nO1BPW/o3bIQXbR1 7A6O0+3ieDf8dIe0Hbqk1h+H/XJ7QVwVrpgEon4mx6ZbeUBOV2uY9tepFYsh36RnGxSD 236FVzUgzBM8FmUW2j6VKwIpRkmnPxElxRkDnmK4ktL4jOfQcoHHoKqOP/JNlz9n/FtI MXfjskrH8H4+nHDbpPHUrMCkei2Y1cyr9T/Hl9QPUYwgKVAUBAC1SJhDZyC8qloHHANI kd3s6Mm23ZPwdM/09B5UAXDodCL+q/50tEWrQn+/Xe16FUvfK6FHt3Cwhb+C85Ixyd2a 5qyQ== X-Gm-Message-State: AOAM533LFLtiCRMNBJGYALaEoco/qfvh+uCVAOc8Kw7sXLsObnUdFUD7 nkj8OLi5Apx97a/jBqYkFvQAeQ== X-Received: by 2002:a05:6000:cd:: with SMTP id q13mr24186024wrx.138.1612861079021; Tue, 09 Feb 2021 00:57:59 -0800 (PST) Received: from localhost.localdomain ([88.122.66.28]) by smtp.gmail.com with ESMTPSA id d3sm38348693wrp.79.2021.02.09.00.57.58 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Feb 2021 00:57:58 -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, ivan.mikhanchuk@quectel.com, Loic Poulain Subject: [PATCH net-next v5 3/5] net: mhi: Create mhi.h Date: Tue, 9 Feb 2021 10:05:56 +0100 Message-Id: <1612861558-14487-4-git-send-email-loic.poulain@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1612861558-14487-1-git-send-email-loic.poulain@linaro.org> References: <1612861558-14487-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;