From patchwork Tue May 25 16:55:09 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shirley Ma X-Patchwork-Id: 102241 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o4PGtZgA007918 for ; Tue, 25 May 2010 16:55:35 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758783Ab0EYQz1 (ORCPT ); Tue, 25 May 2010 12:55:27 -0400 Received: from e9.ny.us.ibm.com ([32.97.182.139]:46447 "EHLO e9.ny.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756407Ab0EYQz0 (ORCPT ); Tue, 25 May 2010 12:55:26 -0400 Received: from d01relay07.pok.ibm.com (d01relay07.pok.ibm.com [9.56.227.147]) by e9.ny.us.ibm.com (8.14.3/8.13.1) with ESMTP id o4PGfWPh002345; Tue, 25 May 2010 12:41:32 -0400 Received: from d01av01.pok.ibm.com (d01av01.pok.ibm.com [9.56.224.215]) by d01relay07.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id o4PGtJ5q1229000; Tue, 25 May 2010 12:55:20 -0400 Received: from d01av01.pok.ibm.com (loopback [127.0.0.1]) by d01av01.pok.ibm.com (8.14.3/8.13.1/NCO v10.0 AVout) with ESMTP id o4PGtHG4021488; Tue, 25 May 2010 12:55:19 -0400 Received: from [9.65.54.13] (sig-9-65-54-13.mts.ibm.com [9.65.54.13]) by d01av01.pok.ibm.com (8.14.3/8.13.1/NCO v10.0 AVin) with ESMTP id o4PGtAgo020682; Tue, 25 May 2010 12:55:11 -0400 Subject: [PATCH net-next] ixgbe: make macvlan on PF working when SRIOV is enabled From: Shirley Ma To: jeffrey.t.kirsher@intel.com, gregory.v.rose@intel.com Cc: "davem@davemloft.net" , "kvm@vger.kernel.org" , "netdev@vger.kernel.org" , "e1000-devel@lists.sourceforge.net" Date: Tue, 25 May 2010 09:55:09 -0700 Message-ID: <1274806509.18023.58.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.28.3 (2.28.3-1.fc12) Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Tue, 25 May 2010 16:55:35 +0000 (UTC) diff --git a/drivers/net/ixgbe/ixgbe_common.c b/drivers/net/ixgbe/ixgbe_common.c index 1159d91..591dd19 100644 --- a/drivers/net/ixgbe/ixgbe_common.c +++ b/drivers/net/ixgbe/ixgbe_common.c @@ -1271,6 +1271,7 @@ s32 ixgbe_init_rx_addrs_generic(struct ixgbe_hw *hw) { u32 i; u32 rar_entries = hw->mac.num_rar_entries; + struct ixgbe_adapter *adapter = hw->back; /* * If the current mac address is valid, assume it is a software override @@ -1288,15 +1289,18 @@ s32 ixgbe_init_rx_addrs_generic(struct ixgbe_hw *hw) hw_dbg(hw, "Overriding MAC Address in RAR[0]\n"); hw_dbg(hw, " New MAC Addr =%pM\n", hw->mac.addr); - hw->mac.ops.set_rar(hw, 0, hw->mac.addr, 0, IXGBE_RAH_AV); + hw->mac.ops.set_rar(hw, 0, hw->mac.addr, adapter->num_vfs, + IXGBE_RAH_AV); } hw->addr_ctrl.overflow_promisc = 0; - hw->addr_ctrl.rar_used_count = 1; + /* reserve VFs receive address entries if any */ + hw->addr_ctrl.rar_used_count = adapter->num_vfs + 1; - /* Zero out the other receive addresses. */ - hw_dbg(hw, "Clearing RAR[1-%d]\n", rar_entries - 1); - for (i = 1; i < rar_entries; i++) { + /* Zero out the other receive addresses except VFs if any */ + hw_dbg(hw, "Clearing RAR[%d-%d]\n", + adapter->num_vfs + 1, rar_entries - 1); + for (i = adapter->num_vfs + 1; i < rar_entries; i++) { IXGBE_WRITE_REG(hw, IXGBE_RAL(i), 0); IXGBE_WRITE_REG(hw, IXGBE_RAH(i), 0); } @@ -1368,18 +1372,20 @@ s32 ixgbe_update_uc_addr_list_generic(struct ixgbe_hw *hw, u32 uc_addr_in_use; u32 fctrl; struct netdev_hw_addr *ha; + struct ixgbe_adapter *adapter = hw->back; /* * Clear accounting of old secondary address list, * don't count RAR[0] */ - uc_addr_in_use = hw->addr_ctrl.rar_used_count - 1; + uc_addr_in_use = hw->addr_ctrl.rar_used_count - 1 - adapter->num_vfs; hw->addr_ctrl.rar_used_count -= uc_addr_in_use; hw->addr_ctrl.overflow_promisc = 0; - /* Zero out the other receive addresses */ - hw_dbg(hw, "Clearing RAR[1-%d]\n", uc_addr_in_use + 1); - for (i = 0; i < uc_addr_in_use; i++) { + /* Zero out the other receive addresses except VFs if any */ + hw_dbg(hw, "Clearing RAR[%d-%d]\n", + adapter->num_vfs + 1, uc_addr_in_use + adapter->num_vfs + 1); + for (i = adapter->num_vfs; i < uc_addr_in_use + adapter->num_vfs; i++) { IXGBE_WRITE_REG(hw, IXGBE_RAL(1+i), 0); IXGBE_WRITE_REG(hw, IXGBE_RAH(1+i), 0); } @@ -1387,7 +1393,7 @@ s32 ixgbe_update_uc_addr_list_generic(struct ixgbe_hw *hw, /* Add the new addresses */ netdev_for_each_uc_addr(ha, netdev) { hw_dbg(hw, " Adding the secondary addresses:\n"); - ixgbe_add_uc_addr(hw, ha->addr, 0); + ixgbe_add_uc_addr(hw, ha->addr, adapter->num_vfs); } if (hw->addr_ctrl.overflow_promisc) {