From nobody Tue Feb 10 09:02:01 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of _spf.google.com designates 209.85.128.54 as permitted sender) client-ip=209.85.128.54; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wm1-f54.google.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.128.54 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1625939417; cv=none; d=zohomail.com; s=zohoarc; b=UcJObveOZ8BsewNtpqq4V0xFop8K3Vdyat+9VXH0l1HSTe2U0jmwentWqWEpv0jztzCjvVRV6Ka1YYthvDmsle7jz128o/DPpTmXMM2QJwKFQzLGqZm3hiDjXs+2IS3RvS8WUrqQTYPY0PCa491C4vZpWc/pouhEeGktQnnGMLw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1625939417; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Sender:Subject:To; bh=CWAixGIxVGdCcoOFXprLiDFiOT2nZU8Gslz26fZe7xM=; b=dkidciAkV4s2+FzZTi3uqLAj2hiExJ8WyPEBYsvzF+c7a/0ysfc6yev9dh4QRkWgFkiKK4ooSn0baiSJHkurGOhP337pdDVqqYo8qH6oEZDmReYOTuKM5i64gMkKL8a3bYxdlmDz2f1yNjVXExNadjntECmBsShcu9uB2ZIOSFI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.128.54 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54]) by mx.zohomail.com with SMTPS id 1625939417164779.4676273953329; Sat, 10 Jul 2021 10:50:17 -0700 (PDT) Received: by mail-wm1-f54.google.com with SMTP id u8-20020a7bcb080000b02901e44e9caa2aso8330896wmj.4 for ; Sat, 10 Jul 2021 10:50:16 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.. (93.red-83-35-24.dynamicip.rima-tde.net. [83.35.24.93]) by smtp.gmail.com with ESMTPSA id y23sm8187264wmi.28.2021.07.10.10.50.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 10 Jul 2021 10:50:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=CWAixGIxVGdCcoOFXprLiDFiOT2nZU8Gslz26fZe7xM=; b=INVRephP3Lc9ijmI19dLyrVmP+d7/pxbmF7j8sILJAGNQHXPmfR3mdlq6s309/TZEN MEP7BJgI3PIjZtL0MPQvaGeJlnCqMJVCtQCnwsIG6HxP8w3BIAbOCkNh9YETG8zxLHXu GyptU7ZOTtl/j1jlRqDisYIBtdIsa0Mermet04rheYBakkmE3/OALFlOpfJMxBfHXJ8C wdCZb/pIYyeSy8IWWhciU8xUW2sG2hiFrkCBHkVbeQIK3c9dm4kErdD/kIcKMlYbYa/c tUaFy9bBkO2OJSV3aooR1nePEg6uSm+RTpnWrjyPXBu69LRt/V4UOBlzpEbbAIrQJz0A eCzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=CWAixGIxVGdCcoOFXprLiDFiOT2nZU8Gslz26fZe7xM=; b=RfWrRc14hjoiMoxrAhnB0SDF3Z73LLnR/P67DSw7iBjzcdgAAfOyhshX7yDBp9kE+o 4ujjnAT2eTAliTzM0J9miLmlvEh2Tg72tLp5nWXmymWqwPqQSoORpKjyWhbFhREaIwp1 5eEy2SIwVLqO0vDcnY+G8FMQbn7QrlS6s4m6ip5UDKqDw2uUPkaerMVHTBPg3LvqSjQ8 6aIamriHQSyjowJZ/DLED5MLA7nfyvQFJLLkTwMHTsXW6fIwD+Q/OTP5uM6UuSpjwIkg yxt/E+Gww/q0aurctyNRc3eWmqBRwoBl7QaxhmtESeHmRsMWgw/U0fnbhHArLPizZQHr jX6Q== X-Gm-Message-State: AOAM5327+FuFHV/f4cq56MGeKg1cwT9FtamygW7eNDABwnQb6IfeUzOk r3vMnihr5Zyge9nEWVBv93w= X-Google-Smtp-Source: ABdhPJwKK58PGWSEaoSxfdBOhWkWLKPbdaGKIu071fj2ug8XFo/OIJa5xlNx0V8L88XhmCMZ2lsZQA== X-Received: by 2002:a1c:2782:: with SMTP id n124mr5556181wmn.114.1625939415462; Sat, 10 Jul 2021 10:50:15 -0700 (PDT) Sender: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Finn Thain , =?UTF-8?q?Herv=C3=A9=20Poussineau?= , Laurent Vivier , Mark Cave-Ayland , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v3 4/8] dp8393x: Store CAM registers as 16-bit Date: Sat, 10 Jul 2021 19:49:50 +0200 Message-Id: <20210710174954.2577195-5-f4bug@amsat.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210710174954.2577195-1-f4bug@amsat.org> References: <20210710174954.2577195-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1625939419191100001 Per the DP83932C datasheet from July 1995: 4.0 SONIC Registers 4.1 THE CAM UNIT The Content Addressable Memory (CAM) consists of sixteen 48-bit entries for complete address filtering of network packets. Each entry corresponds to a 48-bit destination address that is user programmable and can contain any combination of Multicast or Physical addresses. Each entry is partitioned into three 16-bit CAM cells accessible through CAM Address Ports (CAP 2, CAP 1 and CAP 0) with CAP0 corresponding to the least significant 16 bits of the Destination Address and CAP2 corresponding to the most significant bits. Store the CAM registers as 16-bit as it simplifies the code. There is no change in the migration stream. Co-developed-by: Philippe Mathieu-Daud=C3=A9 Co-developed-by: Mark Cave-Ayland Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Mark Cave-Ayland --- Missing: Signed-off-by: Mark Cave-Ayland --- hw/net/dp8393x.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/hw/net/dp8393x.c b/hw/net/dp8393x.c index 64f3b0fc3ea..2c3047c8688 100644 --- a/hw/net/dp8393x.c +++ b/hw/net/dp8393x.c @@ -158,7 +158,7 @@ struct dp8393xState { MemoryRegion mmio; =20 /* Registers */ - uint8_t cam[16][6]; + uint16_t cam[16][3]; uint16_t regs[SONIC_REG_COUNT]; =20 /* Temporaries */ @@ -281,15 +281,13 @@ static void dp8393x_do_load_cam(dp8393xState *s) address_space_read(&s->as, dp8393x_cdp(s), MEMTXATTRS_UNSPECIFIED, s->data, size); index =3D dp8393x_get(s, width, 0) & 0xf; - s->cam[index][0] =3D dp8393x_get(s, width, 1) & 0xff; - s->cam[index][1] =3D dp8393x_get(s, width, 1) >> 8; - s->cam[index][2] =3D dp8393x_get(s, width, 2) & 0xff; - s->cam[index][3] =3D dp8393x_get(s, width, 2) >> 8; - s->cam[index][4] =3D dp8393x_get(s, width, 3) & 0xff; - s->cam[index][5] =3D dp8393x_get(s, width, 3) >> 8; - trace_dp8393x_load_cam(index, s->cam[index][0], s->cam[index][1], - s->cam[index][2], s->cam[index][3], - s->cam[index][4], s->cam[index][5]); + s->cam[index][0] =3D dp8393x_get(s, width, 1); + s->cam[index][1] =3D dp8393x_get(s, width, 2); + s->cam[index][2] =3D dp8393x_get(s, width, 3); + trace_dp8393x_load_cam(index, + s->cam[index][0] >> 8, s->cam[index][0] & 0= xff, + s->cam[index][1] >> 8, s->cam[index][1] & 0= xff, + s->cam[index][2] >> 8, s->cam[index][2] & 0= xff); /* Move to next entry */ s->regs[SONIC_CDC]--; s->regs[SONIC_CDP] +=3D size; @@ -592,8 +590,7 @@ static uint64_t dp8393x_read(void *opaque, hwaddr addr,= unsigned int size) case SONIC_CAP1: case SONIC_CAP0: if (s->regs[SONIC_CR] & SONIC_CR_RST) { - val =3D s->cam[s->regs[SONIC_CEP] & 0xf][2 * (SONIC_CAP0 - reg= ) + 1] << 8; - val |=3D s->cam[s->regs[SONIC_CEP] & 0xf][2 * (SONIC_CAP0 - re= g)]; + val =3D s->cam[s->regs[SONIC_CEP] & 0xf][SONIC_CAP0 - reg]; } break; /* All other registers have no special contraints */ @@ -989,7 +986,7 @@ static const VMStateDescription vmstate_dp8393x =3D { .version_id =3D 0, .minimum_version_id =3D 0, .fields =3D (VMStateField []) { - VMSTATE_BUFFER_UNSAFE(cam, dp8393xState, 0, 16 * 6), + VMSTATE_BUFFER_UNSAFE(cam, dp8393xState, 0, 16 * 3 * 2), VMSTATE_UINT16_ARRAY(regs, dp8393xState, SONIC_REG_COUNT), VMSTATE_END_OF_LIST() } --=20 2.31.1