Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754882AbcC0CAY (ORCPT ); Sat, 26 Mar 2016 22:00:24 -0400 Received: from mail.savoirfairelinux.com ([208.88.110.44]:51456 "EHLO mail.savoirfairelinux.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754753AbcC0CAO (ORCPT ); Sat, 26 Mar 2016 22:00:14 -0400 From: Vivien Didelot To: netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org, kernel@savoirfairelinux.com, "David S. Miller" , Andrew Lunn , Patrick Uiterwijk , Guenter Roeck , Vivien Didelot Subject: [PATCH net-next 2/7] net: dsa: mv88e6xxx: 6185 has only 256 FDBs Date: Sat, 26 Mar 2016 21:59:38 -0400 Message-Id: <1459043983-12088-3-git-send-email-vivien.didelot@savoirfairelinux.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1459043983-12088-1-git-send-email-vivien.didelot@savoirfairelinux.com> References: <1459043983-12088-1-git-send-email-vivien.didelot@savoirfairelinux.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1261 Lines: 37 The 6185 family has only 256 indexable address databases, while the others (such as 6352) have 4095. Explicit and use these maximum values in the _mv88e6xxx_fid_new function. Signed-off-by: Vivien Didelot --- drivers/net/dsa/mv88e6xxx.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/net/dsa/mv88e6xxx.c b/drivers/net/dsa/mv88e6xxx.c index 1d9ae48..1d9b5dd 100644 --- a/drivers/net/dsa/mv88e6xxx.c +++ b/drivers/net/dsa/mv88e6xxx.c @@ -1575,8 +1575,12 @@ static int _mv88e6xxx_fid_new(struct dsa_switch *ds, u16 *fid) struct mv88e6xxx_priv_state *ps = ds_to_priv(ds); DECLARE_BITMAP(fid_bitmap, MV88E6XXX_N_FID); struct mv88e6xxx_vtu_stu_entry vlan; + u16 max = 4095; int i, err; + if (mv88e6xxx_6185_family(ds)) + max = 256; + bitmap_zero(fid_bitmap, MV88E6XXX_N_FID); /* Set every FID bit used by the (un)bridged ports */ @@ -1608,7 +1612,7 @@ static int _mv88e6xxx_fid_new(struct dsa_switch *ds, u16 *fid) * databases are not needed. Return the next positive available. */ *fid = find_next_zero_bit(fid_bitmap, MV88E6XXX_N_FID, 1); - if (unlikely(*fid == MV88E6XXX_N_FID)) + if (unlikely(*fid > max)) return -ENOSPC; /* Clear the database */ -- 2.7.4