From patchwork Thu Feb 9 14:18:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Or Gerlitz X-Patchwork-Id: 726148 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3vK0j20HRMz9s2P for ; Fri, 10 Feb 2017 01:25:10 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752838AbdBIOZI (ORCPT ); Thu, 9 Feb 2017 09:25:08 -0500 Received: from mail-il-dmz.mellanox.com ([193.47.165.129]:53540 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752796AbdBIOZC (ORCPT ); Thu, 9 Feb 2017 09:25:02 -0500 Received: from Internal Mail-Server by MTLPINE1 (envelope-from ogerlitz@mellanox.com) with ESMTPS (AES256-SHA encrypted); 9 Feb 2017 16:18:15 +0200 Received: from r-vnc04.mtr.labs.mlnx (r-vnc04.mtr.labs.mlnx [10.208.0.116]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id v19EIEgT001037; Thu, 9 Feb 2017 16:18:15 +0200 From: Or Gerlitz To: "David S. Miller" Cc: Daniel Borkmann , Jakub Kicinski , John Fastabend , Amir Vadai , netdev@vger.kernel.org, Or Gerlitz Subject: [PATCH net-next 4/4] net/sched: cls_bpf: Use skip flags to reflect HW offload status Date: Thu, 9 Feb 2017 16:18:08 +0200 Message-Id: <1486649888-2786-5-git-send-email-ogerlitz@mellanox.com> X-Mailer: git-send-email 1.8.2.3 In-Reply-To: <1486649888-2786-1-git-send-email-ogerlitz@mellanox.com> References: <1486649888-2786-1-git-send-email-ogerlitz@mellanox.com> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Currently there is no way of querying whether a filter is offloaded to HW or not when using both policy (no flag). Reuse the skip flags to show the insertion status by setting the skip_hw flag in case the filter wasn't offloaded. Signed-off-by: Or Gerlitz --- net/sched/cls_bpf.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/net/sched/cls_bpf.c b/net/sched/cls_bpf.c index d9c9701..91ba90d 100644 --- a/net/sched/cls_bpf.c +++ b/net/sched/cls_bpf.c @@ -185,14 +185,23 @@ static int cls_bpf_offload(struct tcf_proto *tp, struct cls_bpf_prog *prog, return -EINVAL; } } else { - if (!tc_should_offload(dev, tp, prog->gen_flags)) - return skip_sw ? -EINVAL : 0; + if (!tc_should_offload(dev, tp, prog->gen_flags)) { + if (tc_skip_sw(prog->gen_flags)) + return -EINVAL; + prog->gen_flags |= TCA_CLS_FLAGS_SKIP_HW; + return 0; + } cmd = TC_CLSBPF_ADD; } ret = cls_bpf_offload_cmd(tp, obj, cmd); - if (ret) - return skip_sw ? ret : 0; + + if (ret) { + if (skip_sw) + return ret; + prog->gen_flags |= TCA_CLS_FLAGS_SKIP_HW; + return 0; + } obj->offloaded = true; if (oldprog)