From patchwork Tue Oct 1 20:16:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tony Nguyen X-Patchwork-Id: 13818716 X-Patchwork-Delegate: kuba@kernel.org Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7D7531CEE98 for ; Tue, 1 Oct 2024 20:17:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.16 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727813841; cv=none; b=SKn8oDTopIg6JlkETsiVy3b8RTz8qa5ozpdDCVdNNhcvzS7fKdhJ+tILI/lXa9y3TMZ74Ah/QPBw64kEZS0ktISOfAu4jPp3BFu8g/tGQmmmS+BhGuSFZAr5WN4gHo/ZWr8yB2nPuaqIgAXuj7anwRxFwE6yAycGpepjuD19CQg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727813841; c=relaxed/simple; bh=u+4X7Q3oZ8+/sYeBnbIuAVKpg1eFuEY8FC9YwYR9xvc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=so5YO0sm22ZsqVjBLwIg2o7ncDjpBzI59l5btiyjdusc5bUfApA2MVc+vhEAcsjnkKbgpqZJl23FZA7VH4BUzGc82B/Pi1W8BqDQlDR8jFDW0CzZDuQuEV0jtzUkhp51Qf+pPeq6zFccaWKKODnjZjuTfQ6z+9WoP1ilOWy7UDk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=Ly0UYHr8; arc=none smtp.client-ip=198.175.65.16 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="Ly0UYHr8" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1727813840; x=1759349840; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=u+4X7Q3oZ8+/sYeBnbIuAVKpg1eFuEY8FC9YwYR9xvc=; b=Ly0UYHr8JdjWcHDCuXsTayykRT0r/57CAqFyXMtN8NM+NQZN5gJdYV9J zyajA3WQOmOoorFKckPyEApsjgcepHaG8Tzg7gazuVIeZw3BYnNUCuWPJ wWa+VEzRXxnW/IbS0vM2sX+2sbup+Mr5DUQqfLDSM/oGgmD6D4sjQaYcY UudVx/kltfTyGX0ZGpuH88s6DWFpvde/jPH1apAFeALoOOXzPrAfioyoY RcV3t+KfZ6pJ0QfoqPn2E8jfXqHkv7wOXMRs1LeZUtPnOTkRwGl24aUfq hBcyRB6SW4X0qqcflC+wY8U49ASeIR+76CqNDAogl7ZD5dqsW3qe86YF8 A==; X-CSE-ConnectionGUID: DTnVpNGKTpSwFXwe2SYJfQ== X-CSE-MsgGUID: /nlhdwJjRo+XrdEX6zlu0g== X-IronPort-AV: E=McAfee;i="6700,10204,11212"; a="27063112" X-IronPort-AV: E=Sophos;i="6.11,169,1725346800"; d="scan'208";a="27063112" Received: from fmviesa009.fm.intel.com ([10.60.135.149]) by orvoesa108.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Oct 2024 13:17:15 -0700 X-CSE-ConnectionGUID: G13Psh4BQKeqZt8bE01D4g== X-CSE-MsgGUID: iiqPG84nSH2NSEmOQdYZIg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,169,1725346800"; d="scan'208";a="73761879" Received: from anguy11-upstream.jf.intel.com ([10.166.9.133]) by fmviesa009.fm.intel.com with ESMTP; 01 Oct 2024 13:17:15 -0700 From: Tony Nguyen To: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, edumazet@google.com, netdev@vger.kernel.org Cc: Sergey Temerkhanov , anthony.l.nguyen@intel.com, richardcochran@gmail.com, Simon Horman , Pucha Himasekhar Reddy Subject: [PATCH net-next 10/12] ice: Initial support for E825C hardware in ice_adapter Date: Tue, 1 Oct 2024 13:16:57 -0700 Message-ID: <20241001201702.3252954-11-anthony.l.nguyen@intel.com> X-Mailer: git-send-email 2.46.0.522.gc50d79eeffbf In-Reply-To: <20241001201702.3252954-1-anthony.l.nguyen@intel.com> References: <20241001201702.3252954-1-anthony.l.nguyen@intel.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org From: Sergey Temerkhanov Address E825C devices by PCI ID since dual IP core configurations need 1 ice_adapter for both devices. Signed-off-by: Sergey Temerkhanov Reviewed-by: Simon Horman Tested-by: Pucha Himasekhar Reddy (A Contingent worker at Intel) Signed-off-by: Tony Nguyen --- drivers/net/ethernet/intel/ice/ice_adapter.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/intel/ice/ice_adapter.c b/drivers/net/ethernet/intel/ice/ice_adapter.c index ad84d8ad49a6..903d0bc9e3e5 100644 --- a/drivers/net/ethernet/intel/ice/ice_adapter.c +++ b/drivers/net/ethernet/intel/ice/ice_adapter.c @@ -9,12 +9,14 @@ #include #include #include "ice_adapter.h" +#include "ice.h" static DEFINE_XARRAY(ice_adapters); static DEFINE_MUTEX(ice_adapters_mutex); /* PCI bus number is 8 bits. Slot is 5 bits. Domain can have the rest. */ #define INDEX_FIELD_DOMAIN GENMASK(BITS_PER_LONG - 1, 13) +#define INDEX_FIELD_DEV GENMASK(31, 16) #define INDEX_FIELD_BUS GENMASK(12, 5) #define INDEX_FIELD_SLOT GENMASK(4, 0) @@ -24,9 +26,17 @@ static unsigned long ice_adapter_index(const struct pci_dev *pdev) WARN_ON(domain > FIELD_MAX(INDEX_FIELD_DOMAIN)); - return FIELD_PREP(INDEX_FIELD_DOMAIN, domain) | - FIELD_PREP(INDEX_FIELD_BUS, pdev->bus->number) | - FIELD_PREP(INDEX_FIELD_SLOT, PCI_SLOT(pdev->devfn)); + switch (pdev->device) { + case ICE_DEV_ID_E825C_BACKPLANE: + case ICE_DEV_ID_E825C_QSFP: + case ICE_DEV_ID_E825C_SFP: + case ICE_DEV_ID_E825C_SGMII: + return FIELD_PREP(INDEX_FIELD_DEV, pdev->device); + default: + return FIELD_PREP(INDEX_FIELD_DOMAIN, domain) | + FIELD_PREP(INDEX_FIELD_BUS, pdev->bus->number) | + FIELD_PREP(INDEX_FIELD_SLOT, PCI_SLOT(pdev->devfn)); + } } static struct ice_adapter *ice_adapter_new(void)