Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp1049664ybx; Wed, 30 Oct 2019 09:06:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqwAFA+4o0UK+f3oef1E9EGVySgF92UE1L12H5cuvvax+uL1VmJ26lTxtyOe+wg1B/WVOisO X-Received: by 2002:a5d:4803:: with SMTP id l3mr551571wrq.381.1572451563386; Wed, 30 Oct 2019 09:06:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572451563; cv=none; d=google.com; s=arc-20160816; b=UllitaWMuENGgWjqJeDyrWBls44qiBZhc1Pjq+vMJ/xtx3eFCzs87giVi1wilpOkCB pEgNJyrJMggW0bluiPg0/VioZ5SYRjew9sh4/NDL0J/EAiJtOARVZ/ylkvD/qu5TxHld 6pUr24erTi3pg0MoH9Ox6rT5Fkk4WY1lV+driQCsle03AsD9rdYn68HmzdnFveJz5xEQ oPIF0hueBSUdBC9XIcsnHMcoKq2bmppDbmTvHX8o9bgcK53Tec1Ag0NSvrhJiQ6QDK+E mkaAGmExr5YMqjzXlYx46cDmZz7Kr41Z1aWhQdPd61oxXQhdDZAt838bB9FRA2zCYYT1 ZPBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=Io+g/Mop1YTO7IEeBRV6yOSmnttfivb/SWZtZYVfkLU=; b=bSqIQ82yRYGMRRqzqhzUXga4uiKpFDs/+O/+SnQfM/4JgUJ3OE/zvwz7kmfrVtGFW1 ppoerefmDvOP9m7dPfIweNssdAgk+IsPkzVxUyPWZeN2xtrrQiaMXsQ0uQDhHY6CzP9P UUJRXCQFLmplWqxAcc3L+hlHNA8ztl8JhFZ5zBuWzupQzCE5E+WmsDC/ZDmqOMzVSavE 4SjbqkZKsr9HGg73DN6kOsg7OZLlr73nYpeVgcOTB5YDE+N4l+vCuxYEK/8A4MSwAzG+ ItIXr/CQ8MhgD6p0xxHqsLGthBhTMoYS0JDJoKXmkE7yFvlyMQlJz48YcbPSP9Mys49b QABg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=rrZwX3M6; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w2si1681017edc.300.2019.10.30.09.05.36; Wed, 30 Oct 2019 09:06:03 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=rrZwX3M6; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728735AbfJ3QCR (ORCPT + 99 others); Wed, 30 Oct 2019 12:02:17 -0400 Received: from mail-ot1-f65.google.com ([209.85.210.65]:40749 "EHLO mail-ot1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726476AbfJ3QCQ (ORCPT ); Wed, 30 Oct 2019 12:02:16 -0400 Received: by mail-ot1-f65.google.com with SMTP id d8so2567696otc.7; Wed, 30 Oct 2019 09:02:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Io+g/Mop1YTO7IEeBRV6yOSmnttfivb/SWZtZYVfkLU=; b=rrZwX3M614HUB1QzRH0h8zC9UfyKHcbaXzNo9WeFt6hAxhK/EIOLuHA5VowG5k/7M1 9TNp2/F06fJplrOREF7SilqiobyoD5l+j1L7Frx/WnD2ET0Fes8HEI1KB2MKAYWT5P43 wlEEJCfHRxmUsrhCl9T5toj1xlRnmq3vDKBKmVhL8s1M3RfoIaF4fnTpCV3HDyC862Mg f9/D7R/lVUIMRaPLp5Jb7gXAySTVkTrvAfVE08styByL1LJhCjqB0bSMakInQhXt68VU s4Gi4AtYJFDjNiYDKzLi3hhioJ3NhjDIpB2ACEjNCghsPHaOz49ml6/tE3T5QXGeoefJ GkFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Io+g/Mop1YTO7IEeBRV6yOSmnttfivb/SWZtZYVfkLU=; b=C4g7cROdYodD2AHkjvx22thIOVaRvax6tAweFHRhP8LNmc5h35dn0XKVJugisus+h6 l6ZvKYYnz5NVZ7ItAWb8oRaRcVPrsdOTv54apnu+4c/abAraTdwFEH79SWyHBy4cLQhd SXDOmUytz63s8QOl+fwbxsmdn9Kzs1UAELlCkLDZZK9NkuQLvxxY6/smNUnBS1mHDkkw +PvHedzrW+VVjb7Nv4bRDAQOgo5jMIaBHKjF1DgR12YLSDq1DeOcoj1zxJF+uUi0BizQ 6JxWt3mUBhiKpsdWb1o77EFOcujgiFwAg/P7coM+lW3VARW5OXXdt1AmI2Thf/BIiXNf C/aA== X-Gm-Message-State: APjAAAXRRyYSmZTOPhA2Ba31HGKHzoCmpyRmE9beKAqgxGRH/nJWLUKa H5Sck4prNc3Opb97rZgj3fY= X-Received: by 2002:a9d:509:: with SMTP id 9mr536124otw.70.1572451334923; Wed, 30 Oct 2019 09:02:14 -0700 (PDT) Received: from localhost.localdomain ([2604:1380:4111:8b00::1]) by smtp.gmail.com with ESMTPSA id j129sm108696oib.22.2019.10.30.09.02.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Oct 2019 09:02:14 -0700 (PDT) From: Nathan Chancellor To: Jiri Pirko , Ido Schimmel , "David S. Miller" Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Nathan Chancellor Subject: [PATCH net-next] mlxsw: Fix 64-bit division in mlxsw_sp_sb_prs_init Date: Wed, 30 Oct 2019 09:01:52 -0700 Message-Id: <20191030160152.11305-1-natechancellor@gmail.com> X-Mailer: git-send-email 2.24.0.rc1 MIME-Version: 1.0 X-Patchwork-Bot: notify Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When building for 32-bit ARM, there is a link time error because of a 64-bit division: ld.lld: error: undefined symbol: __aeabi_uldivmod >>> referenced by spectrum_buffers.c >>> net/ethernet/mellanox/mlxsw/spectrum_buffers.o:(mlxsw_sp_buffers_init) in archive drivers/built-in.a >>> did you mean: __aeabi_uidivmod >>> defined in: arch/arm/lib/lib.a(lib1funcs.o Avoid this by using div_u64, which is designed to avoid this problem. Fixes: bc9f6e94bcb5 ("mlxsw: spectrum_buffers: Calculate the size of the main pool") Signed-off-by: Nathan Chancellor --- drivers/net/ethernet/mellanox/mlxsw/spectrum_buffers.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_buffers.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_buffers.c index 33a978af80d6..968f0902e4fe 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_buffers.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_buffers.c @@ -470,7 +470,7 @@ static int mlxsw_sp_sb_prs_init(struct mlxsw_sp *mlxsw_sp, size_t prs_len) { /* Round down, unlike mlxsw_sp_bytes_cells(). */ - u32 sb_cells = mlxsw_sp->sb->sb_size / mlxsw_sp->sb->cell_size; + u32 sb_cells = div_u64(mlxsw_sp->sb->sb_size, mlxsw_sp->sb->cell_size); u32 rest_cells[2] = {sb_cells, sb_cells}; int i; int err; -- 2.24.0.rc1