<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/net/ncsi/internal.h, branch linux-7.1.y</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=linux-7.1.y</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=linux-7.1.y'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2025-06-13T01:21:59+00:00</updated>
<entry>
<title>net: ncsi: Fix buffer overflow in fetching version id</title>
<updated>2025-06-13T01:21:59+00:00</updated>
<author>
<name>Hari Kalavakunta</name>
<email>kalavakunta.hari.prasad@gmail.com</email>
</author>
<published>2025-06-10T19:33:38+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=8e16170ae972c7fed132bc928914a2ffb94690fc'/>
<id>urn:sha1:8e16170ae972c7fed132bc928914a2ffb94690fc</id>
<content type='text'>
In NC-SI spec v1.2 section 8.4.44.2, the firmware name doesn't
need to be null terminated while its size occupies the full size
of the field. Fix the buffer overflow issue by adding one
additional byte for null terminator.

Signed-off-by: Hari Kalavakunta &lt;kalavakunta.hari.prasad@gmail.com&gt;
Reviewed-by: Paul Fertser &lt;fercerpav@gmail.com&gt;
Link: https://patch.msgid.link/20250610193338.1368-1-kalavakunta.hari.prasad@gmail.com
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</content>
</entry>
<entry>
<title>net/ncsi: Use struct sockaddr_storage for pending_mac</title>
<updated>2025-05-27T06:25:42+00:00</updated>
<author>
<name>Kees Cook</name>
<email>kees@kernel.org</email>
</author>
<published>2025-05-21T20:46:11+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=db586cad6f451504ec2b14ec812e1e92effe40db'/>
<id>urn:sha1:db586cad6f451504ec2b14ec812e1e92effe40db</id>
<content type='text'>
To avoid future casting with coming API type changes, switch struct
ncsi_dev_priv::pending_mac to a full struct sockaddr_storage.

Acked-by: Gustavo A. R. Silva &lt;gustavoars@kernel.org&gt;
Signed-off-by: Kees Cook &lt;kees@kernel.org&gt;
Link: https://patch.msgid.link/20250521204619.2301870-3-kees@kernel.org
Signed-off-by: Paolo Abeni &lt;pabeni@redhat.com&gt;

</content>
</entry>
<entry>
<title>net: ncsi: Fix GCPS 64-bit member variables</title>
<updated>2025-04-15T13:19:55+00:00</updated>
<author>
<name>Hari Kalavakunta</name>
<email>kalavakunta.hari.prasad@gmail.com</email>
</author>
<published>2025-04-10T01:23:08+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=e8a1bd8344054ce27bebf59f48e3f6bc10bc419b'/>
<id>urn:sha1:e8a1bd8344054ce27bebf59f48e3f6bc10bc419b</id>
<content type='text'>
Correct Get Controller Packet Statistics (GCPS) 64-bit wide member
variables, as per DSP0222 v1.0.0 and forward specs. The Driver currently
collects these stats, but they are yet to be exposed to the user.
Therefore, no user impact.

Statistics fixes:
Total Bytes Received (byte range 28..35)
Total Bytes Transmitted (byte range 36..43)
Total Unicast Packets Received (byte range 44..51)
Total Multicast Packets Received (byte range 52..59)
Total Broadcast Packets Received (byte range 60..67)
Total Unicast Packets Transmitted (byte range 68..75)
Total Multicast Packets Transmitted (byte range 76..83)
Total Broadcast Packets Transmitted (byte range 84..91)
Valid Bytes Received (byte range 204..11)

Signed-off-by: Hari Kalavakunta &lt;kalavakunta.hari.prasad@gmail.com&gt;
Reviewed-by: Paul Fertser &lt;fercerpav@gmail.com&gt;
Link: https://patch.msgid.link/20250410012309.1343-1-kalavakunta.hari.prasad@gmail.com
Signed-off-by: Paolo Abeni &lt;pabeni@redhat.com&gt;
</content>
</entry>
<entry>
<title>net/ncsi: fix locking in Get MAC Address handling</title>
<updated>2025-01-14T02:59:56+00:00</updated>
<author>
<name>Paul Fertser</name>
<email>fercerpav@gmail.com</email>
</author>
<published>2025-01-09T14:50:54+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=9e2bbab94b88295dcc57c7580393c9ee08d7314d'/>
<id>urn:sha1:9e2bbab94b88295dcc57c7580393c9ee08d7314d</id>
<content type='text'>
Obtaining RTNL lock in a response handler is not allowed since it runs
in an atomic softirq context. Postpone setting the MAC address by adding
a dedicated step to the configuration FSM.

Fixes: 790071347a0a ("net/ncsi: change from ndo_set_mac_address to dev_set_mac_address")
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/20241129-potin-revert-ncsi-set-mac-addr-v1-1-94ea2cb596af@gmail.com
Signed-off-by: Paul Fertser &lt;fercerpav@gmail.com&gt;
Tested-by: Potin Lai &lt;potin.lai.pt@gmail.com&gt;
Link: https://patch.msgid.link/20250109145054.30925-1-fercerpav@gmail.com
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</content>
</entry>
<entry>
<title>net/ncsi: Fix the multi thread manner of NCSI driver</title>
<updated>2024-06-01T23:21:44+00:00</updated>
<author>
<name>DelphineCCChiu</name>
<email>delphine_cc_chiu@wiwynn.com</email>
</author>
<published>2024-05-29T06:58:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=e85e271dec0270982afed84f70dc37703fcc1d52'/>
<id>urn:sha1:e85e271dec0270982afed84f70dc37703fcc1d52</id>
<content type='text'>
Currently NCSI driver will send several NCSI commands back to back without
waiting the response of previous NCSI command or timeout in some state
when NIC have multi channel. This operation against the single thread
manner defined by NCSI SPEC(section 6.3.2.3 in DSP0222_1.1.1)

According to NCSI SPEC(section 6.2.13.1 in DSP0222_1.1.1), we should probe
one channel at a time by sending NCSI commands (Clear initial state, Get
version ID, Get capabilities...), than repeat this steps until the max
number of channels which we got from NCSI command (Get capabilities) has
been probed.

Fixes: e6f44ed6d04d ("net/ncsi: Package and channel management")
Signed-off-by: DelphineCCChiu &lt;delphine_cc_chiu@wiwynn.com&gt;
Link: https://lore.kernel.org/r/20240529065856.825241-1-delphine_cc_chiu@wiwynn.com
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</content>
</entry>
<entry>
<title>net/ncsi: Fix netlink major/minor version numbers</title>
<updated>2023-11-18T15:00:51+00:00</updated>
<author>
<name>Peter Delevoryas</name>
<email>peter@pjd.dev</email>
</author>
<published>2023-11-14T16:07:34+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=3084b58bfd0b9e4b5e034f31f31b42977db35f12'/>
<id>urn:sha1:3084b58bfd0b9e4b5e034f31f31b42977db35f12</id>
<content type='text'>
The netlink interface for major and minor version numbers doesn't actually
return the major and minor version numbers.

It reports a u32 that contains the (major, minor, update, alpha1)
components as the major version number, and then alpha2 as the minor
version number.

For whatever reason, the u32 byte order was reversed (ntohl): maybe it was
assumed that the encoded value was a single big-endian u32, and alpha2 was
the minor version.

The correct way to get the supported NC-SI version from the network
controller is to parse the Get Version ID response as described in 8.4.44
of the NC-SI spec[1].

    Get Version ID Response Packet Format

              Bits
            +--------+--------+--------+--------+
     Bytes  | 31..24 | 23..16 | 15..8  | 7..0   |
    +-------+--------+--------+--------+--------+
    | 0..15 | NC-SI Header                      |
    +-------+--------+--------+--------+--------+
    | 16..19| Response code   | Reason code     |
    +-------+--------+--------+--------+--------+
    |20..23 | Major  | Minor  | Update | Alpha1 |
    +-------+--------+--------+--------+--------+
    |24..27 |         reserved         | Alpha2 |
    +-------+--------+--------+--------+--------+
    |            .... other stuff ....          |

The major, minor, and update fields are all binary-coded decimal (BCD)
encoded [2]. The spec provides examples below the Get Version ID response
format in section 8.4.44.1, but for practical purposes, this is an example
from a live network card:

    root@bmc:~# ncsi-util 0x15
    NC-SI Command Response:
    cmd: GET_VERSION_ID(0x15)
    Response: COMMAND_COMPLETED(0x0000)  Reason: NO_ERROR(0x0000)
    Payload length = 40

    20: 0xf1 0xf1 0xf0 0x00 &lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt; (major, minor, update, alpha1)
    24: 0x00 0x00 0x00 0x00 &lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt; (_, _, _, alpha2)

    28: 0x6d 0x6c 0x78 0x30
    32: 0x2e 0x31 0x00 0x00
    36: 0x00 0x00 0x00 0x00
    40: 0x16 0x1d 0x07 0xd2
    44: 0x10 0x1d 0x15 0xb3
    48: 0x00 0x17 0x15 0xb3
    52: 0x00 0x00 0x81 0x19

This should be parsed as "1.1.0".

"f" in the upper-nibble means to ignore it, contributing zero.

If both nibbles are "f", I think the whole field is supposed to be ignored.
Major and minor are "required", meaning they're not supposed to be "ff",
but the update field is "optional" so I think it can be ff. I think the
simplest thing to do is just set the major and minor to zero instead of
juggling some conditional logic or something.

bcd2bin() from "include/linux/bcd.h" seems to assume both nibbles are 0-9,
so I've provided a custom BCD decoding function.

Alpha1 and alpha2 are ISO/IEC 8859-1 encoded, which just means ASCII
characters as far as I can tell, although the full encoding table for
non-alphabetic characters is slightly different (I think).

I imagine the alpha fields are just supposed to be alphabetic characters,
but I haven't seen any network cards actually report a non-zero value for
either.

If people wrote software against this netlink behavior, and were parsing
the major and minor versions themselves from the u32, then this would
definitely break their code.

[1] https://www.dmtf.org/sites/default/files/standards/documents/DSP0222_1.0.0.pdf
[2] https://en.wikipedia.org/wiki/Binary-coded_decimal
[2] https://en.wikipedia.org/wiki/ISO/IEC_8859-1

Signed-off-by: Peter Delevoryas &lt;peter@pjd.dev&gt;
Fixes: 138635cc27c9 ("net/ncsi: NCSI response packet handler")
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>net/ncsi: add get MAC address command to get Intel i210 MAC address</title>
<updated>2021-09-02T00:18:56+00:00</updated>
<author>
<name>Ivan Mikhaylov</name>
<email>i.mikhaylov@yadro.com</email>
</author>
<published>2021-08-30T17:18:06+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=205b95fe658ddba25236c60da777f67b4eec3fd3'/>
<id>urn:sha1:205b95fe658ddba25236c60da777f67b4eec3fd3</id>
<content type='text'>
This patch adds OEM Intel GMA command and response handler for it.

Signed-off-by: Brad Ho &lt;Brad_Ho@phoenix.com&gt;
Signed-off-by: Paul Fertser &lt;fercerpav@gmail.com&gt;
Signed-off-by: Ivan Mikhaylov &lt;i.mikhaylov@yadro.com&gt;
Link: https://lore.kernel.org/r/20210830171806.119857-2-i.mikhaylov@yadro.com
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</content>
</entry>
<entry>
<title>net/ncsi: add NCSI Intel OEM command to keep PHY up</title>
<updated>2021-07-08T21:16:39+00:00</updated>
<author>
<name>Ivan Mikhaylov</name>
<email>i.mikhaylov@yadro.com</email>
</author>
<published>2021-07-08T12:27:53+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=abd2fddc94a619b96bf41c60429d4c32bd118e17'/>
<id>urn:sha1:abd2fddc94a619b96bf41c60429d4c32bd118e17</id>
<content type='text'>
This allows to keep PHY link up and prevents any channel resets during
the host load.

It is KEEP_PHY_LINK_UP option(Veto bit) in i210 datasheet which
block PHY reset and power state changes.

Signed-off-by: Ivan Mikhaylov &lt;i.mikhaylov@yadro.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>net/ncsi: Fix spelling mistakes</title>
<updated>2021-06-07T21:08:30+00:00</updated>
<author>
<name>Zheng Yongjun</name>
<email>zhengyongjun3@huawei.com</email>
</author>
<published>2021-06-07T15:01:18+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=4fb3ebbf7e086a02afb0aecad0d21cf536b5fa05'/>
<id>urn:sha1:4fb3ebbf7e086a02afb0aecad0d21cf536b5fa05</id>
<content type='text'>
Fix some spelling mistakes in comments:
constuct  ==&gt; construct
chanels  ==&gt; channels
Detination  ==&gt; Destination

Signed-off-by: Zheng Yongjun &lt;zhengyongjun3@huawei.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>ncsi: internal.h: Fix a spello</title>
<updated>2021-03-29T00:31:13+00:00</updated>
<author>
<name>Bhaskar Chowdhury</name>
<email>unixbhaskar@gmail.com</email>
</author>
<published>2021-03-26T23:12:47+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=195a8ec4033b4124f6864892e71dcef24ba74a5a'/>
<id>urn:sha1:195a8ec4033b4124f6864892e71dcef24ba74a5a</id>
<content type='text'>
s/Firware/Firmware/

Signed-off-by: Bhaskar Chowdhury &lt;unixbhaskar@gmail.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
</feed>
