From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtpbgeu1.qq.com (smtpbgeu1.qq.com [52.59.177.22]) (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 6FB6774BE1 for ; Mon, 17 Nov 2025 06:28:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=52.59.177.22 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763360909; cv=none; b=J3N+q6d/9P+hqdu8d7aKwiRHqRbZ2wTu+BAJrFf67Un07n8K72f7zjURy++HOAFieBPDKjM07SOJ0QJNtAy1xO5+qRmmYfLOy1oyO8xHNumXFsgVsKhghH6rXWdd1p6FZm9QVauXiKfxgrzMVLs8lgZm8dn2sK2iq47vwwlzV/w= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763360909; c=relaxed/simple; bh=D0GZoq8M+/5IJnuA53jSoJ+A6kq82V7jQwlxj4J0Ph0=; h=From:To:Cc:References:In-Reply-To:Subject:Date:Message-ID: MIME-Version:Content-Type; b=ggzbvHSeIkBcNIg47MI+ej91XcopPJYcj/2kKakmdhQfd6a30jNDmlcoJpmF5KE9Er2HOVM0pb3cMnVhzMV/ZZvvCS16bsSBmgBpNCV2nFSEo9P5+0Y0AxnXBcon4lulWj7JXZ/B2aS4AThKxjvNqCCBgy0q4vfS5grGl6P3+V0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=trustnetic.com; spf=pass smtp.mailfrom=trustnetic.com; arc=none smtp.client-ip=52.59.177.22 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=trustnetic.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=trustnetic.com X-QQ-mid:Yeas9t1763360781t394t51185 Received: from 3DB253DBDE8942B29385B9DFB0B7E889 (jiawenwu@trustnetic.com [125.120.152.51]) X-QQ-SSF:0000000000000000000000000000000 From: =?utf-8?b?Smlhd2VuIFd1?= X-BIZMAIL-ID: 17449204754345869829 To: "'Vadim Fedorenko'" , , "'Andrew Lunn'" , "'David S. Miller'" , "'Eric Dumazet'" , "'Jakub Kicinski'" , "'Paolo Abeni'" , "'Russell King'" , "'Simon Horman'" , "'Jacob Keller'" , , "'Andrew Lunn'" , "'David S. Miller'" , "'Eric Dumazet'" , "'Jakub Kicinski'" , "'Paolo Abeni'" , "'Russell King'" , "'Simon Horman'" , "'Jacob Keller'" Cc: "'Mengyuan Lou'" , "'Mengyuan Lou'" References: <20251112055841.22984-1-jiawenwu@trustnetic.com> <20251112055841.22984-6-jiawenwu@trustnetic.com> <001401dc5444$3e897f60$bb9c7e20$@trustnetic.com> <4b9369f2-66fb-4c47-8bae-48577cf18c94@linux.dev> In-Reply-To: <4b9369f2-66fb-4c47-8bae-48577cf18c94@linux.dev> Subject: RE: [PATCH net-next 5/5] net: txgbe: support getting module EEPROM by page Date: Mon, 17 Nov 2025 14:26:20 +0800 Message-ID: <012901dc578b$1683cf80$438b6e80$@trustnetic.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Outlook 16.0 Content-Language: zh-cn Thread-Index: AQIM7yZFIqUFPQBkfWoGGA7engjSjgHLnukhAszbvKkDQik1TwGt0SqatEjxnoA= X-QQ-SENDSIZE: 520 Feedback-ID: Yeas:trustnetic.com:qybglogicsvrgz:qybglogicsvrgz6b-0 X-QQ-XMAILINFO: NojR6Ao/DkEDyHdsgqqYzbNCe5IfChfCH5oTj+pm7TRuSBYo40qdtwBj o8iR382r2jm7bLpjv3oHlqsQS820vU0GccoZYY2NEErdk2KgZvXNoSZWvwAr6Rul6CkAVAB GM/pfSVXNOnkvIorAI5nuUxDxquuC9+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_FW2SW_MBOX, i); > >>> + le32_to_cpus(&value); > >>> + > >>> + memcpy(&local_data[i * 4], &value, 4); > >>> + } > >> > >> the logic here is not clear from the first read of the code. effectively > >> in the reply you have the same txgbe_hic_i2c_read struct but without > >> data field, which is obviously VLA, but then you simply skip the result > >> of read of txgbe_hic_i2c_read and only provide the real data back to the > >> caller. Maybe you can organize the code the way it can avoid double copying? > > > > Because the length of real data is variable, now it could be 1 or 128. But the total > > length of the command buffer is DWORD aligned. So we designed only a 1-byte > > data field in struct txgbe_hic_i2c_read, to avoid redundant reading and writing > > during the SW-FW interaction. > > > > For 1-byte data, wx_host_interface_command() can be used to set 'return_data' > > to true, then page->data = buffer->data. For other cases, I think it would be more > > convenient to read directly from the mailbox registers. > > With such design you always have your return data starting at offset of > 15, which is absolutely unaligned. And then it needs more buffer > dancing. OK. We could consider redesigning this buffer structure. Return data will start at offset of 16, and reserve 4 bytes. And longer data will be directly read from the mailbox register. Is this design more reasonable?