From patchwork Thu Sep 10 13:38:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 249692 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:ecf:0:0:0:0 with SMTP id i15csp1111850ilk; Thu, 10 Sep 2020 14:36:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzN2F2SrtMeYNJLKneT3rLvXnTBfKyCoTndAeGGC+qnakO1mkb6vv3z7rt2zSp0cwmcAJ2F X-Received: by 2002:a50:fb98:: with SMTP id e24mr11379233edq.130.1599773796307; Thu, 10 Sep 2020 14:36:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599773796; cv=none; d=google.com; s=arc-20160816; b=VzVcBPduvdwgfS3flT8S8gdHxwDnPSJPxn+aCZct3WDYH1RVRKq9LJ3LmoEvQ4EH+b HrS/jMeCyZ5QMQhabnL2Hu4kLKBnPomgAUlBm5EVSYKQjhZOZvXgzh+cVp8ZXfT0VhHf ItQhMojYCI59yVVvN2/yY0aLgM3842F8VmT3hyjciuGeqlD+VBFlnn8Ae1t0mVu5NwJB tWFGnOHtp30lnNHJQsDnbvpqHacXudyEoz7TODkJCwTCvRGTJzMjd1pdcmqLxuEeyEYy g0MqmScBdMSESnIGvpRThtlAeIPrcaVn0O5195jnq5oe1FsKLC0rnXYzGoXuoQvCITVg 9khQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=N3mgJASizexPLNkdFt4Wcjn+xRiScZKeT3febPP2GBs=; b=F0kWalSshg4kGugDNsN0DwypLs/jxfLb0VOTZq/q+LoC2QXtlP/id8Y9JXPcoLDtJi bnE9U9bSGPBwrlJscUBLxLFIH/oG/6WDYiytMQiRBMN59uN4cHeHkEgDGPCOq6zMnl44 TvhUlct7g9Tca9pwJdHdvqyNpSKs4H7XFMA3Hy3KbGgsLc04gZQp3OtYyZq0yV1VEQcR K2YXy75DoCRHlHzB9QKgC9Ydt0VMvDFUJIjY9NbFmJYHUosOZ0ZcRP163qq1Mqcxx+zM V7hLjmJVEckRFVpZ8AmaWdLCkf+CZK7FnQ/2Pv2nQjdQE/dqSbylV21KrSzKL8HfeKKr 3uLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jm0FeBub; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-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 r7si4491717ejy.514.2020.09.10.14.36.36; Thu, 10 Sep 2020 14:36:36 -0700 (PDT) Received-SPF: pass (google.com: domain of devicetree-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=jm0FeBub; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-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 S1726760AbgIJVge (ORCPT + 6 others); Thu, 10 Sep 2020 17:36:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48066 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730938AbgIJNjw (ORCPT ); Thu, 10 Sep 2020 09:39:52 -0400 Received: from mail-pl1-x644.google.com (mail-pl1-x644.google.com [IPv6:2607:f8b0:4864:20::644]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F3B83C061796 for ; Thu, 10 Sep 2020 06:38:34 -0700 (PDT) Received: by mail-pl1-x644.google.com with SMTP id x18so929496pll.6 for ; Thu, 10 Sep 2020 06:38:34 -0700 (PDT) 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=N3mgJASizexPLNkdFt4Wcjn+xRiScZKeT3febPP2GBs=; b=jm0FeBubSLNdmOw7edyREhQe0fHd7uC1w3dnmUfrc1pPQA9LjHaAGbmQmlzdWirFNI zATrB/jWrCY/mvh5sRgI21Jdv6tCgd4nwF67n6J0i3+akIH16jJe1P8fn5kuNIRFBBJy AjVBalKDmuD35a49JkSS04+cwj4A3cjMwkzu/lrltDB2LXekFJBua8k6M3VCGUDoEmif tzJICDtdTfeg2enYNGt9lQw4mewr7jRWXqMoVXMM7ehzyjjJlj4OqNeKQAk4/sxMDe0/ IaMfUp1ctePiLCggBZ+SFFrEL2W7R8iVMoze9fLs9WEt41HK2TMNntRYjuU6WgjbMLtT c1iQ== 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=N3mgJASizexPLNkdFt4Wcjn+xRiScZKeT3febPP2GBs=; b=R71w2ijC+VsmIKWshU+jo5bwxMBfniy3XHPaeMsiST5TYzc80sNhfhaDwRDGoF3L6n iJa7wI6qzjc6/vonN2IUclAQoOkt+2XBsMtAcVmLeHm3GpY3QTghiNOeDMotrIEQh03Z 65kkOE35V+BjEhF88XiVMBPmmacVaAbZNt7XAbD8c9vSMa0bKdgYMEeNpboCBous2+KG t00kt1y7TsVFu45EejhComPjK7JuiUjCd4y2G0DJtBzgVtgxQYmdVyWC4+SzPd/Q/k/N QGKImQ4gkDqFZU5nxrd5OkttY1aE5e+utaWWcflVdfO1CROKOcPcdseH3xPqiEvS2pnV o8ZA== X-Gm-Message-State: AOAM533g0Xufnw5glMYVYcnITZh1ZK0O/IZtPfZ3UsligNGotCQglnrW olFKrkocXcpgI+CDf4VXuzFz X-Received: by 2002:a17:902:8f98:b029:d1:870b:469e with SMTP id z24-20020a1709028f98b02900d1870b469emr5877515plo.3.1599745102152; Thu, 10 Sep 2020 06:38:22 -0700 (PDT) Received: from localhost.localdomain ([103.59.133.81]) by smtp.googlemail.com with ESMTPSA id o30sm5603801pgc.45.2020.09.10.06.38.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Sep 2020 06:38:21 -0700 (PDT) From: Manivannan Sadhasivam To: wg@grandegger.com, mkl@pengutronix.de, robh+dt@kernel.org Cc: linux-can@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, dev.kurt@vandijck-laurijssen.be, o.rempel@pengutronix.de, Manivannan Sadhasivam Subject: [PATCH 1/6] can: rx-offload: can_rx_offload_add_manual(): add new initialization function Date: Thu, 10 Sep 2020 19:08:01 +0530 Message-Id: <20200910133806.25077-2-manivannan.sadhasivam@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200910133806.25077-1-manivannan.sadhasivam@linaro.org> References: <20200910133806.25077-1-manivannan.sadhasivam@linaro.org> Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org From: Marc Kleine-Budde This patch adds a new initialization function: can_rx_offload_add_manual() It should be used to add support rx-offload to a driver, if the callback mechanism should not be used. Use e.g. can_rx_offload_queue_sorted() to queue skbs into rx-offload. Signed-off-by: Marc Kleine-Budde Signed-off-by: Manivannan Sadhasivam --- drivers/net/can/rx-offload.c | 11 +++++++++++ include/linux/can/rx-offload.h | 3 +++ 2 files changed, 14 insertions(+) -- 2.17.1 diff --git a/drivers/net/can/rx-offload.c b/drivers/net/can/rx-offload.c index e8328910a234..3b180269a92d 100644 --- a/drivers/net/can/rx-offload.c +++ b/drivers/net/can/rx-offload.c @@ -351,6 +351,17 @@ int can_rx_offload_add_fifo(struct net_device *dev, } EXPORT_SYMBOL_GPL(can_rx_offload_add_fifo); +int can_rx_offload_add_manual(struct net_device *dev, + struct can_rx_offload *offload, + unsigned int weight) +{ + if (offload->mailbox_read) + return -EINVAL; + + return can_rx_offload_init_queue(dev, offload, weight); +} +EXPORT_SYMBOL_GPL(can_rx_offload_add_manual); + void can_rx_offload_enable(struct can_rx_offload *offload) { napi_enable(&offload->napi); diff --git a/include/linux/can/rx-offload.h b/include/linux/can/rx-offload.h index 1b78a0cfb615..f1b38088b765 100644 --- a/include/linux/can/rx-offload.h +++ b/include/linux/can/rx-offload.h @@ -35,6 +35,9 @@ int can_rx_offload_add_timestamp(struct net_device *dev, int can_rx_offload_add_fifo(struct net_device *dev, struct can_rx_offload *offload, unsigned int weight); +int can_rx_offload_add_manual(struct net_device *dev, + struct can_rx_offload *offload, + unsigned int weight); int can_rx_offload_irq_offload_timestamp(struct can_rx_offload *offload, u64 reg); int can_rx_offload_irq_offload_fifo(struct can_rx_offload *offload);