From patchwork Mon Jun 15 10:48:03 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hiroshi Shimamoto X-Patchwork-Id: 484219 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 1EF5B1401AD for ; Mon, 15 Jun 2015 20:50:36 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754744AbbFOKuc (ORCPT ); Mon, 15 Jun 2015 06:50:32 -0400 Received: from TYO201.gate.nec.co.jp ([210.143.35.51]:58073 "EHLO tyo201.gate.nec.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754289AbbFOKu3 (ORCPT ); Mon, 15 Jun 2015 06:50:29 -0400 Received: from mailgate3.nec.co.jp ([10.7.69.192]) by tyo201.gate.nec.co.jp (8.13.8/8.13.4) with ESMTP id t5FAo6Qc011042; Mon, 15 Jun 2015 19:50:06 +0900 (JST) Received: from mailsv4.nec.co.jp (imss62.nec.co.jp [10.7.69.157]) by mailgate3.nec.co.jp (8.11.7/3.7W-MAILGATE-NEC) with ESMTP id t5FAo6t10467; Mon, 15 Jun 2015 19:50:06 +0900 (JST) Received: from mail03.kamome.nec.co.jp (mail03.kamome.nec.co.jp [10.25.43.7]) by mailsv4.nec.co.jp (8.13.8/8.13.4) with ESMTP id t5FAo6lt021877; Mon, 15 Jun 2015 19:50:06 +0900 (JST) Received: from bpxc99gp.gisp.nec.co.jp ([10.38.151.141] [10.38.151.141]) by mail02.kamome.nec.co.jp with ESMTP id BT-MMP-676078; Mon, 15 Jun 2015 19:48:04 +0900 Received: from BPXM14GP.gisp.nec.co.jp ([169.254.1.74]) by BPXC13GP.gisp.nec.co.jp ([10.38.151.141]) with mapi id 14.03.0224.002; Mon, 15 Jun 2015 19:48:03 +0900 From: Hiroshi Shimamoto To: "Skidmore, Donald C" , "Rose, Gregory V" , "Kirsher, Jeffrey T" , "intel-wired-lan@lists.osuosl.org" CC: "nhorman@redhat.com" , "jogreene@redhat.com" , Linux Netdev List , "Choi, Sy Jong" , Rony Efraim , "David Miller" , Edward Cree , Or Gerlitz , "sassmann@redhat.com" Subject: [PATCH 2/3] ixgbe, ixgbevf: error MC promisc unless trusted Thread-Topic: [PATCH 2/3] ixgbe, ixgbevf: error MC promisc unless trusted Thread-Index: AdCnWLu4G3IbU4S/QZq/1A7Ar4fUUA== Date: Mon, 15 Jun 2015 10:48:03 +0000 Message-ID: <7F861DC0615E0C47A872E6F3C5FCDDBD05EDEFBF@BPXM14GP.gisp.nec.co.jp> Accept-Language: ja-JP, en-US Content-Language: ja-JP X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.205.5.123] MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Hiroshi Shimamoto Make PF returns an error to VF multicast promiscuous mode if the VF is not trusted. On VF, check the result from PF and fallback to previous behavior that only 30 addresses are registered. Signed-off-by: Hiroshi Shimamoto --- drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c | 9 +++++---- drivers/net/ethernet/intel/ixgbevf/vf.c | 21 +++++++++++++++++---- 2 files changed, 22 insertions(+), 8 deletions(-) -- 1.8.3.1 diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c index 6c602bc..5eb3108 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c @@ -1074,6 +1074,10 @@ static int ixgbe_set_vf_mc_promisc(struct ixgbe_adapter *adapter, if (adapter->vfinfo[vf].mc_promisc == enable) return 0; + /* Don't enable MC promisc unless VF is trusted */ + if (enable && !adapter->vfinfo[vf].trusted) + return -1; + adapter->vfinfo[vf].mc_promisc = enable; if (enable) @@ -1513,10 +1517,7 @@ int ixgbe_ndo_set_vf_trust(struct net_device *netdev, int vf, bool setting) adapter->vfinfo[vf].trusted = setting; - /* Reconfigure features which are only allowed for trusted VF */ - /* VF multicast promiscuous mode */ - if (adapter->vfinfo[vf].mc_promisc) - ixgbe_enable_vf_mc_promisc(adapter, vf); + /* TODO: reset to reconfigure features */ return 0; } diff --git a/drivers/net/ethernet/intel/ixgbevf/vf.c b/drivers/net/ethernet/intel/ixgbevf/vf.c index 89aecd0..6547c17 100644 --- a/drivers/net/ethernet/intel/ixgbevf/vf.c +++ b/drivers/net/ethernet/intel/ixgbevf/vf.c @@ -430,6 +430,7 @@ static s32 ixgbevf_request_mc_promisc_vf(struct ixgbe_hw *hw) { struct ixgbevf_adapter *adapter = hw->back; u32 msgbuf[IXGBE_VFMAILBOX_SIZE]; + int err; dev_info(&adapter->pdev->dev, "Request MC PROMISC\n"); @@ -439,7 +440,17 @@ static s32 ixgbevf_request_mc_promisc_vf(struct ixgbe_hw *hw) msgbuf[0] = IXGBE_VF_SET_MC_PROMISC; msgbuf[1] = 1; - ixgbevf_write_msg_read_ack(hw, msgbuf, 2); + err = hw->mbx.ops.write_posted(hw, msgbuf, 2); + if (err) + return err; + err = hw->mbx.ops.read_posted(hw, msgbuf, 2); + if (err) + return err; + + msgbuf[0] &= ~IXGBE_VT_MSGTYPE_CTS; + + if (msgbuf[0] == (IXGBE_VF_SET_MC_PROMISC | IXGBE_VT_MSGTYPE_NACK)) + return -EPERM; return 0; } @@ -474,11 +485,13 @@ static s32 ixgbevf_update_mc_addr_list_vf(struct ixgbe_hw *hw, * mode, turn it on. */ if (hw->api_version == ixgbe_mbox_api_12) { - if (!hw->mac.mc_promisc) { - ixgbevf_request_mc_promisc_vf(hw); + if (!hw->mac.mc_promisc && + !ixgbevf_request_mc_promisc_vf(hw)) { hw->mac.mc_promisc = true; } - return 0; + /* If we are in MC promisc, return here */ + if (hw->mac.mc_promisc) + return 0; } cnt = 30; }