<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/drivers/net/ethernet/oa_tc6.c, branch linux-6.18.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.</subtitle>
<id>https://universe.0xinfinity.dev/distro/kernel/atom?h=linux-6.18.y</id>
<link rel='self' href='https://universe.0xinfinity.dev/distro/kernel/atom?h=linux-6.18.y'/>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/'/>
<updated>2025-08-30T02:42:07Z</updated>
<entry>
<title>net: ethernet: oa_tc6: Handle failure of spi_setup</title>
<updated>2025-08-30T02:42:07Z</updated>
<author>
<name>Stefan Wahren</name>
<email>wahrenst@gmx.net</email>
</author>
<published>2025-08-27T11:53:39Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=b3852ae3105ec1048535707545d23c1e519c190f'/>
<id>urn:sha1:b3852ae3105ec1048535707545d23c1e519c190f</id>
<content type='text'>
There is no guarantee that spi_setup succeed, so properly handle
the error case.

Fixes: aa58bec064ab ("net: ethernet: oa_tc6: implement register write operation")
Signed-off-by: Stefan Wahren &lt;wahrenst@gmx.net&gt;
Cc: stable@kernel.org
Reviewed-by: Andrew Lunn &lt;andrew@lunn.ch&gt;
Reviewed-by: Jacob Keller &lt;jacob.e.keller@intel.com&gt;
Link: https://patch.msgid.link/20250827115341.34608-2-wahrenst@gmx.net
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</content>
</entry>
<entry>
<title>net: ethernet: oa_tc6: fix tx skb race condition between reference pointers</title>
<updated>2024-12-17T12:11:22Z</updated>
<author>
<name>Parthiban Veerasooran</name>
<email>parthiban.veerasooran@microchip.com</email>
</author>
<published>2024-12-13T12:31:59Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=e592b5110b3e9393881b0a019d86832bbf71a47f'/>
<id>urn:sha1:e592b5110b3e9393881b0a019d86832bbf71a47f</id>
<content type='text'>
There are two skb pointers to manage tx skb's enqueued from n/w stack.
waiting_tx_skb pointer points to the tx skb which needs to be processed
and ongoing_tx_skb pointer points to the tx skb which is being processed.

SPI thread prepares the tx data chunks from the tx skb pointed by the
ongoing_tx_skb pointer. When the tx skb pointed by the ongoing_tx_skb is
processed, the tx skb pointed by the waiting_tx_skb is assigned to
ongoing_tx_skb and the waiting_tx_skb pointer is assigned with NULL.
Whenever there is a new tx skb from n/w stack, it will be assigned to
waiting_tx_skb pointer if it is NULL. Enqueuing and processing of a tx skb
handled in two different threads.

Consider a scenario where the SPI thread processed an ongoing_tx_skb and
it moves next tx skb from waiting_tx_skb pointer to ongoing_tx_skb pointer
without doing any NULL check. At this time, if the waiting_tx_skb pointer
is NULL then ongoing_tx_skb pointer is also assigned with NULL. After
that, if a new tx skb is assigned to waiting_tx_skb pointer by the n/w
stack and there is a chance to overwrite the tx skb pointer with NULL in
the SPI thread. Finally one of the tx skb will be left as unhandled,
resulting packet missing and memory leak.

- Consider the below scenario where the TXC reported from the previous
transfer is 10 and ongoing_tx_skb holds an tx ethernet frame which can be
transported in 20 TXCs and waiting_tx_skb is still NULL.
	tx_credits = 10; /* 21 are filled in the previous transfer */
	ongoing_tx_skb = 20;
	waiting_tx_skb = NULL; /* Still NULL */
- So, (tc6-&gt;ongoing_tx_skb || tc6-&gt;waiting_tx_skb) becomes true.
- After oa_tc6_prepare_spi_tx_buf_for_tx_skbs()
	ongoing_tx_skb = 10;
	waiting_tx_skb = NULL; /* Still NULL */
- Perform SPI transfer.
- Process SPI rx buffer to get the TXC from footers.
- Now let's assume previously filled 21 TXCs are freed so we are good to
transport the next remaining 10 tx chunks from ongoing_tx_skb.
	tx_credits = 21;
	ongoing_tx_skb = 10;
	waiting_tx_skb = NULL;
- So, (tc6-&gt;ongoing_tx_skb || tc6-&gt;waiting_tx_skb) becomes true again.
- In the oa_tc6_prepare_spi_tx_buf_for_tx_skbs()
	ongoing_tx_skb = NULL;
	waiting_tx_skb = NULL;

- Now the below bad case might happen,

Thread1 (oa_tc6_start_xmit)	Thread2 (oa_tc6_spi_thread_handler)
---------------------------	-----------------------------------
- if waiting_tx_skb is NULL
				- if ongoing_tx_skb is NULL
				- ongoing_tx_skb = waiting_tx_skb
- waiting_tx_skb = skb
				- waiting_tx_skb = NULL
				...
				- ongoing_tx_skb = NULL
- if waiting_tx_skb is NULL
- waiting_tx_skb = skb

To overcome the above issue, protect the moving of tx skb reference from
waiting_tx_skb pointer to ongoing_tx_skb pointer and assigning new tx skb
to waiting_tx_skb pointer, so that the other thread can't access the
waiting_tx_skb pointer until the current thread completes moving the tx
skb reference safely.

Fixes: 53fbde8ab21e ("net: ethernet: oa_tc6: implement transmit path to transfer tx ethernet frames")
Signed-off-by: Parthiban Veerasooran &lt;parthiban.veerasooran@microchip.com&gt;
Reviewed-by: Larysa Zaremba &lt;larysa.zaremba@intel.com&gt;
Signed-off-by: Paolo Abeni &lt;pabeni@redhat.com&gt;

</content>
</entry>
<entry>
<title>net: ethernet: oa_tc6: fix infinite loop error when tx credits becomes 0</title>
<updated>2024-12-17T12:11:22Z</updated>
<author>
<name>Parthiban Veerasooran</name>
<email>parthiban.veerasooran@microchip.com</email>
</author>
<published>2024-12-13T12:31:58Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=7d2f320e12744e5906a4fab40381060a81d22c12'/>
<id>urn:sha1:7d2f320e12744e5906a4fab40381060a81d22c12</id>
<content type='text'>
SPI thread wakes up to perform SPI transfer whenever there is an TX skb
from n/w stack or interrupt from MAC-PHY. Ethernet frame from TX skb is
transferred based on the availability tx credits in the MAC-PHY which is
reported from the previous SPI transfer. Sometimes there is a possibility
that TX skb is available to transmit but there is no tx credits from
MAC-PHY. In this case, there will not be any SPI transfer but the thread
will be running in an endless loop until tx credits available again.

So checking the availability of tx credits along with TX skb will prevent
the above infinite loop. When the tx credits available again that will be
notified through interrupt which will trigger the SPI transfer to get the
available tx credits.

Fixes: 53fbde8ab21e ("net: ethernet: oa_tc6: implement transmit path to transfer tx ethernet frames")
Reviewed-by: Jacob Keller &lt;jacob.e.keller@intel.com&gt;
Signed-off-by: Parthiban Veerasooran &lt;parthiban.veerasooran@microchip.com&gt;
Signed-off-by: Paolo Abeni &lt;pabeni@redhat.com&gt;

</content>
</entry>
<entry>
<title>net: ethernet: oa_tc6: add helper function to enable zero align rx frame</title>
<updated>2024-09-12T03:53:45Z</updated>
<author>
<name>Parthiban Veerasooran</name>
<email>Parthiban.Veerasooran@microchip.com</email>
</author>
<published>2024-09-09T08:25:12Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=afd42170c8a6e68edd3f3a7f2aacd2bfbedb58b2'/>
<id>urn:sha1:afd42170c8a6e68edd3f3a7f2aacd2bfbedb58b2</id>
<content type='text'>
Zero align receive frame feature can be enabled to align all receive
ethernet frames data to start at the beginning of any receive data chunk
payload with a start word offset (SWO) of zero. Receive frames may begin
anywhere within the receive data chunk payload when this feature is not
enabled.

Reviewed-by: Andrew Lunn &lt;andrew@lunn.ch&gt;
Signed-off-by: Parthiban Veerasooran &lt;Parthiban.Veerasooran@microchip.com&gt;
Link: https://patch.msgid.link/20240909082514.262942-13-Parthiban.Veerasooran@microchip.com
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</content>
</entry>
<entry>
<title>net: ethernet: oa_tc6: implement mac-phy interrupt</title>
<updated>2024-09-12T03:53:45Z</updated>
<author>
<name>Parthiban Veerasooran</name>
<email>Parthiban.Veerasooran@microchip.com</email>
</author>
<published>2024-09-09T08:25:11Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=2c6ce535445362dc58a58c9813e58bb3da28eab7'/>
<id>urn:sha1:2c6ce535445362dc58a58c9813e58bb3da28eab7</id>
<content type='text'>
The MAC-PHY interrupt is asserted when the following conditions are met.

Receive chunks available - This interrupt is asserted when the previous
data footer had no receive data chunks available and once the receive
data chunks become available for reading. On reception of the first data
header this interrupt will be deasserted.

Transmit chunk credits available - This interrupt is asserted when the
previous data footer indicated no transmit credits available and once the
transmit credits become available for transmitting transmit data chunks.
On reception of the first data header this interrupt will be deasserted.

Extended status event - This interrupt is asserted when the previous data
footer indicated no extended status and once the extended event become
available. In this case the host should read status #0 register to know
the corresponding error/event. On reception of the first data header this
interrupt will be deasserted.

Reviewed-by: Andrew Lunn &lt;andrew@lunn.ch&gt;
Signed-off-by: Parthiban Veerasooran &lt;Parthiban.Veerasooran@microchip.com&gt;
Link: https://patch.msgid.link/20240909082514.262942-12-Parthiban.Veerasooran@microchip.com
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</content>
</entry>
<entry>
<title>net: ethernet: oa_tc6: implement receive path to receive rx ethernet frames</title>
<updated>2024-09-12T03:53:45Z</updated>
<author>
<name>Parthiban Veerasooran</name>
<email>Parthiban.Veerasooran@microchip.com</email>
</author>
<published>2024-09-09T08:25:10Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=d70a0d8f2f2d1b9bb6e3e9dfed25ae3ca3303770'/>
<id>urn:sha1:d70a0d8f2f2d1b9bb6e3e9dfed25ae3ca3303770</id>
<content type='text'>
SPI rx data buffer can contain one or more receive data chunks. A receive
data chunk consists a 64 bytes receive data chunk payload followed a
4 bytes data footer at the end. The data footer contains the information
needed to determine the validity and location of the receive frame data
within the receive data chunk payload and the host can use these
information to generate ethernet frame. Initially the receive chunks
available will be updated from the buffer status register and then it
will be updated from the footer received on each spi data transfer. Tx
data valid or empty chunks equal to the number receive chunks available
will be transmitted in the MOSI to receive all the rx chunks.
Additionally the receive data footer contains the below information as
well. The received footer will be examined for the receive errors if any.

Reviewed-by: Andrew Lunn &lt;andrew@lunn.ch&gt;
Signed-off-by: Parthiban Veerasooran &lt;Parthiban.Veerasooran@microchip.com&gt;
Link: https://patch.msgid.link/20240909082514.262942-11-Parthiban.Veerasooran@microchip.com
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</content>
</entry>
<entry>
<title>net: ethernet: oa_tc6: implement transmit path to transfer tx ethernet frames</title>
<updated>2024-09-12T03:53:44Z</updated>
<author>
<name>Parthiban Veerasooran</name>
<email>Parthiban.Veerasooran@microchip.com</email>
</author>
<published>2024-09-09T08:25:09Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=53fbde8ab21e8c2c6187159cc17fc10cbf20900a'/>
<id>urn:sha1:53fbde8ab21e8c2c6187159cc17fc10cbf20900a</id>
<content type='text'>
The transmit ethernet frame will be converted into multiple transmit data
chunks. Each transmit data chunk consists of a 4 bytes header followed by
a 64 bytes transmit data chunk payload. The 4 bytes data header occurs at
the beginning of each transmit data chunk on MOSI. The data header
contains the information needed to determine the validity and location of
the transmit frame data within the data chunk payload. The number of
transmit data chunks transmitted to mac-phy is limited to the number
transmit credits available in the mac-phy. Initially the transmit credits
will be updated from the buffer status register and then it will be
updated from the footer received on each spi data transfer. The received
footer will be examined for the transmit errors if any.

Reviewed-by: Andrew Lunn &lt;andrew@lunn.ch&gt;
Signed-off-by: Parthiban Veerasooran &lt;Parthiban.Veerasooran@microchip.com&gt;
Link: https://patch.msgid.link/20240909082514.262942-10-Parthiban.Veerasooran@microchip.com
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</content>
</entry>
<entry>
<title>net: ethernet: oa_tc6: enable open alliance tc6 data communication</title>
<updated>2024-09-12T03:53:44Z</updated>
<author>
<name>Parthiban Veerasooran</name>
<email>Parthiban.Veerasooran@microchip.com</email>
</author>
<published>2024-09-09T08:25:08Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=f845a027de66d1efeb8cb22020e2c50baebdc441'/>
<id>urn:sha1:f845a027de66d1efeb8cb22020e2c50baebdc441</id>
<content type='text'>
Enabling Configuration Synchronization bit (SYNC) in the Configuration
Register #0 enables data communication in the MAC-PHY. The state of this
bit is reflected in the data footer SYNC bit.

Reviewed-by: Andrew Lunn &lt;andrew@lunn.ch&gt;
Signed-off-by: Parthiban Veerasooran &lt;Parthiban.Veerasooran@microchip.com&gt;
Link: https://patch.msgid.link/20240909082514.262942-9-Parthiban.Veerasooran@microchip.com
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</content>
</entry>
<entry>
<title>net: ethernet: oa_tc6: implement internal PHY initialization</title>
<updated>2024-09-12T03:53:43Z</updated>
<author>
<name>Parthiban Veerasooran</name>
<email>Parthiban.Veerasooran@microchip.com</email>
</author>
<published>2024-09-09T08:25:06Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=8f9bf857e43b3f75a098e3af3a6fec2d03203a1e'/>
<id>urn:sha1:8f9bf857e43b3f75a098e3af3a6fec2d03203a1e</id>
<content type='text'>
Internal PHY is initialized as per the PHY register capability supported
by the MAC-PHY. Direct PHY Register Access Capability indicates if PHY
registers are directly accessible within the SPI register memory space.
Indirect PHY Register Access Capability indicates if PHY registers are
indirectly accessible through the MDIO/MDC registers MDIOACCn defined in
OPEN Alliance specification. Currently the direct register access is only
supported.

Reviewed-by: Andrew Lunn &lt;andrew@lunn.ch&gt;
Signed-off-by: Parthiban Veerasooran &lt;Parthiban.Veerasooran@microchip.com&gt;
Link: https://patch.msgid.link/20240909082514.262942-7-Parthiban.Veerasooran@microchip.com
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</content>
</entry>
<entry>
<title>net: ethernet: oa_tc6: implement error interrupts unmasking</title>
<updated>2024-09-12T03:53:43Z</updated>
<author>
<name>Parthiban Veerasooran</name>
<email>Parthiban.Veerasooran@microchip.com</email>
</author>
<published>2024-09-09T08:25:05Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=86c03a0f07f4c9874f58826a9956bda30993a358'/>
<id>urn:sha1:86c03a0f07f4c9874f58826a9956bda30993a358</id>
<content type='text'>
This will unmask the following error interrupts from the MAC-PHY.
  tx protocol error
  rx buffer overflow error
  loss of framing error
  header error
The MAC-PHY will signal an error by setting the EXST bit in the receive
data footer which will then allow the host to read the STATUS0 register
to find the source of the error.

Reviewed-by: Andrew Lunn &lt;andrew@lunn.ch&gt;
Signed-off-by: Parthiban Veerasooran &lt;Parthiban.Veerasooran@microchip.com&gt;
Link: https://patch.msgid.link/20240909082514.262942-6-Parthiban.Veerasooran@microchip.com
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</content>
</entry>
</feed>
