From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <3chas3@gmail.com> Received: from mail-qk0-f194.google.com (mail-qk0-f194.google.com [209.85.220.194]) by dpdk.org (Postfix) with ESMTP id 713153787 for ; Tue, 12 Jul 2016 15:38:31 +0200 (CEST) Received: by mail-qk0-f194.google.com with SMTP id 82so963287qko.1 for ; Tue, 12 Jul 2016 06:38:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=cyl1zvqi7GW2BF7cZ216CMmZ/8XZjUgF1eycJxKpnOg=; b=M6bE432dTayuwC/Qg6RX9ccMlRDwnp8QWs/s7BdJPOcqoiG0sCrfIPfTl6VyxhbyU2 o/NX3wkC9/eMiYuw01EO1u4z4M/X5bSJUULXnE/StcfIaoRvxtxHmL8ydF+U5eGBvi/x dovUhYc3/CGUgZyD9T41LSwOeEY/FrV+nexJO9acOl5X02WcZPFKO1pi9ltB0ZQIhLyl ou2BRt67ICyGRLQmT0+NLzZG7mex1EGeD6PpHJoFw2JHGU8r29upH/Lmf/RmSo44Vo/S LWxqiyY/I4LNsN9RqF96K3aa408iLcriNfpMYH61DuPYBmIFDq7qkpymWLeEqwAddKI0 otvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=cyl1zvqi7GW2BF7cZ216CMmZ/8XZjUgF1eycJxKpnOg=; b=ERAYgESJ7YXfz5+qKhK3O2fMZLdXHxb8UeKT1KYFN2QkDRgLs08obya+d4nVHcdHFl xUm9LYMNjHF75xrpiKvZKe4VTJldqlkULzIWoguhn8a8F5GJYhDuaz6KYtaXwL8KOjD5 Q9BAmcf8gWewjU1yBhx6V7FejE2CEIT04wmunFSbYpMevAePakzYqGV3ocw7mUl4HUGy Xk/Ih0z6mpRRe5N/JMJLkfrPIqGeOj3nEx3LKaFg54bw6ZHkeeLYBUcBscFdyk2sWNXC 2NrQ4x2BTZXM9dEVKj9OqngRlMlUpcOb3qmvjwZiC3s0LWBxMmsukZA86XMIS1rhQIMA Mgqg== X-Gm-Message-State: ALyK8tJPJGq1KJhoCyLyllnV+at0eBScqQAoTVwZjGx5pUTrWqIgRAQN/co4S1480qqXzA== X-Received: by 10.55.42.216 with SMTP id q85mr3169343qkq.157.1468330710677; Tue, 12 Jul 2016 06:38:30 -0700 (PDT) Received: from monolith.home (pool-173-79-169-182.washdc.fios.verizon.net. [173.79.169.182]) by smtp.gmail.com with ESMTPSA id 23sm1244397qty.40.2016.07.12.06.38.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Jul 2016 06:38:30 -0700 (PDT) From: Chas Williams <3chas3@gmail.com> To: dev@dpdk.org Cc: harish.patil@qlogic.com, Chas Williams <3chas3@gmail.com> Date: Tue, 12 Jul 2016 09:38:09 -0400 Message-Id: <1468330694-383-5-git-send-email-3chas3@gmail.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1468330694-383-2-git-send-email-3chas3@gmail.com> References: <1468330694-383-2-git-send-email-3chas3@gmail.com> Subject: [dpdk-dev] [PATCH 05/10] bnx2x: Restrict RX mask flags sent to the PF X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jul 2016 13:38:31 -0000 Don't use bnx2x_fill_accept_flags() to fill the RX mask in the VF since the PF only handles a subset of the existing flags. now, bnx2x_fill_accept_flags() can be static. Fixes: 540a211084a7 ("bnx2x: driver core") Signed-off-by: Chas Williams <3chas3@gmail.com> --- drivers/net/bnx2x/bnx2x.c | 6 +++--- drivers/net/bnx2x/bnx2x.h | 2 -- drivers/net/bnx2x/bnx2x_vfpf.c | 23 +++++++++++++++++++++-- drivers/net/bnx2x/bnx2x_vfpf.h | 7 +++++++ 4 files changed, 31 insertions(+), 7 deletions(-) diff --git a/drivers/net/bnx2x/bnx2x.c b/drivers/net/bnx2x/bnx2x.c index 7599e9c..6ca6ede 100644 --- a/drivers/net/bnx2x/bnx2x.c +++ b/drivers/net/bnx2x/bnx2x.c @@ -1396,10 +1396,10 @@ bnx2x_del_all_macs(struct bnx2x_softc *sc, struct ecore_vlan_mac_obj *mac_obj, return rc; } -int +static int bnx2x_fill_accept_flags(struct bnx2x_softc *sc, uint32_t rx_mode, - unsigned long *rx_accept_flags, - unsigned long *tx_accept_flags) + unsigned long *rx_accept_flags, + unsigned long *tx_accept_flags) { /* Clear the flags first */ *rx_accept_flags = 0; diff --git a/drivers/net/bnx2x/bnx2x.h b/drivers/net/bnx2x/bnx2x.h index 852ec94..2746562 100644 --- a/drivers/net/bnx2x/bnx2x.h +++ b/drivers/net/bnx2x/bnx2x.h @@ -1878,8 +1878,6 @@ int bnx2x_vf_setup_queue(struct bnx2x_softc *sc, struct bnx2x_fastpath *fp, int leading); void bnx2x_free_hsi_mem(struct bnx2x_softc *sc); int bnx2x_vf_set_rx_mode(struct bnx2x_softc *sc); -int bnx2x_fill_accept_flags(struct bnx2x_softc *sc, uint32_t rx_mode, - unsigned long *rx_accept_flags, unsigned long *tx_accept_flags); int bnx2x_check_bull(struct bnx2x_softc *sc); //#define BNX2X_PULSE diff --git a/drivers/net/bnx2x/bnx2x_vfpf.c b/drivers/net/bnx2x/bnx2x_vfpf.c index 14b1d10..1b4899f 100644 --- a/drivers/net/bnx2x/bnx2x_vfpf.c +++ b/drivers/net/bnx2x/bnx2x_vfpf.c @@ -575,7 +575,6 @@ bnx2x_vf_set_rx_mode(struct bnx2x_softc *sc) { struct vf_set_q_filters_tlv *query; struct vf_common_reply_tlv *reply = &sc->vf2pf_mbox->resp.common_reply; - unsigned long tx_mask; query = &sc->vf2pf_mbox->query[0].set_q_filters; bnx2x_init_first_tlv(sc, &query->first_tlv, BNX2X_VF_TLV_SET_Q_FILTERS, @@ -584,7 +583,27 @@ bnx2x_vf_set_rx_mode(struct bnx2x_softc *sc) query->vf_qid = 0; query->flags = BNX2X_VF_RX_MASK_CHANGED; - if (bnx2x_fill_accept_flags(sc, sc->rx_mode, &query->rx_mask, &tx_mask)) { + switch (sc->rx_mode) { + case BNX2X_RX_MODE_NONE: /* no Rx */ + query->rx_mask = VFPF_RX_MASK_ACCEPT_NONE; + break; + case BNX2X_RX_MODE_NORMAL: + query->rx_mask = VFPF_RX_MASK_ACCEPT_MATCHED_MULTICAST; + query->rx_mask |= VFPF_RX_MASK_ACCEPT_MATCHED_UNICAST; + query->rx_mask |= VFPF_RX_MASK_ACCEPT_BROADCAST; + break; + case BNX2X_RX_MODE_ALLMULTI: + query->rx_mask = VFPF_RX_MASK_ACCEPT_ALL_MULTICAST; + query->rx_mask |= VFPF_RX_MASK_ACCEPT_MATCHED_UNICAST; + query->rx_mask |= VFPF_RX_MASK_ACCEPT_BROADCAST; + break; + case BNX2X_RX_MODE_PROMISC: + query->rx_mask = VFPF_RX_MASK_ACCEPT_ALL_UNICAST; + query->rx_mask |= VFPF_RX_MASK_ACCEPT_ALL_MULTICAST; + query->rx_mask |= VFPF_RX_MASK_ACCEPT_BROADCAST; + break; + default: + PMD_DRV_LOG(ERR, "BAD rx mode (%d)", mode); return -EINVAL; } diff --git a/drivers/net/bnx2x/bnx2x_vfpf.h b/drivers/net/bnx2x/bnx2x_vfpf.h index 966240c..62e1d60 100644 --- a/drivers/net/bnx2x/bnx2x_vfpf.h +++ b/drivers/net/bnx2x/bnx2x_vfpf.h @@ -40,6 +40,13 @@ struct vf_resource_query { #define TLV_BUFFER_SIZE 1024 +#define VFPF_RX_MASK_ACCEPT_NONE 0x00000000 +#define VFPF_RX_MASK_ACCEPT_MATCHED_UNICAST 0x00000001 +#define VFPF_RX_MASK_ACCEPT_MATCHED_MULTICAST 0x00000002 +#define VFPF_RX_MASK_ACCEPT_ALL_UNICAST 0x00000004 +#define VFPF_RX_MASK_ACCEPT_ALL_MULTICAST 0x00000008 +#define VFPF_RX_MASK_ACCEPT_BROADCAST 0x00000010 + /* general tlv header (used for both vf->pf request and pf->vf response) */ struct channel_tlv { uint16_t type; -- 2.5.5