2024-06-06 23:52:30

by Takashi Sakamoto

[permalink] [raw]
Subject: [PATCH 0/2] firewire: add helper functions for phy configuration packet

Hi,

In recent months, the batch of helper functions was added to serialize
and deserialize content of packet in IEEE 1394 protocol. This series of
changes includes some helper functions for phy configuration packet as
well as some KUnit tests for them.

Takashi Sakamoto (2):
firewire: core: add tests for serialization/deserialization of phy
config packet
firewire: core: use inline helper functions to serialize phy config
packet

drivers/firewire/core-transaction.c | 22 +++----
drivers/firewire/packet-serdes-test.c | 79 +++++++++++++++++++++++
drivers/firewire/phy-packet-definitions.h | 55 ++++++++++++++++
3 files changed, 144 insertions(+), 12 deletions(-)

--
2.43.0



2024-06-06 23:54:32

by Takashi Sakamoto

[permalink] [raw]
Subject: [PATCH 2/2] firewire: core: use inline helper functions to serialize phy config packet

This commit uses the added helper functions to obsolete the existing
implementation for phy configuration packet.

Signed-off-by: Takashi Sakamoto <[email protected]>
---
drivers/firewire/core-transaction.c | 22 ++++++++++------------
1 file changed, 10 insertions(+), 12 deletions(-)

diff --git a/drivers/firewire/core-transaction.c b/drivers/firewire/core-transaction.c
index 6868ff17dc10..5b80ca9d6230 100644
--- a/drivers/firewire/core-transaction.c
+++ b/drivers/firewire/core-transaction.c
@@ -30,19 +30,12 @@

#include "core.h"
#include "packet-header-definitions.h"
+#include "phy-packet-definitions.h"
#include <trace/events/firewire.h>

#define HEADER_DESTINATION_IS_BROADCAST(header) \
((async_header_get_destination(header) & 0x3f) == 0x3f)

-#define PHY_PACKET_CONFIG 0x0
-#define PHY_PACKET_LINK_ON 0x1
-#define PHY_PACKET_SELF_ID 0x2
-
-#define PHY_CONFIG_GAP_COUNT(gap_count) (((gap_count) << 16) | (1 << 22))
-#define PHY_CONFIG_ROOT_ID(node_id) ((((node_id) & 0x3f) << 24) | (1 << 23))
-#define PHY_IDENTIFIER(id) ((id) << 30)
-
/* returns 0 if the split timeout handler is already running */
static int try_cancel_split_timeout(struct fw_transaction *t)
{
@@ -480,10 +473,14 @@ void fw_send_phy_config(struct fw_card *card,
int node_id, int generation, int gap_count)
{
long timeout = DIV_ROUND_UP(HZ, 10);
- u32 data = PHY_IDENTIFIER(PHY_PACKET_CONFIG);
+ u32 data = 0;

- if (node_id != FW_PHY_CONFIG_NO_NODE_ID)
- data |= PHY_CONFIG_ROOT_ID(node_id);
+ phy_packet_set_packet_identifier(&data, PHY_PACKET_PACKET_IDENTIFIER_PHY_CONFIG);
+
+ if (node_id != FW_PHY_CONFIG_NO_NODE_ID) {
+ phy_packet_phy_config_set_root_id(&data, node_id);
+ phy_packet_phy_config_set_force_root_node(&data, true);
+ }

if (gap_count == FW_PHY_CONFIG_CURRENT_GAP_COUNT) {
gap_count = card->driver->read_phy_reg(card, 1);
@@ -494,7 +491,8 @@ void fw_send_phy_config(struct fw_card *card,
if (gap_count == 63)
return;
}
- data |= PHY_CONFIG_GAP_COUNT(gap_count);
+ phy_packet_phy_config_set_gap_count(&data, gap_count);
+ phy_packet_phy_config_set_gap_count_optimization(&data, true);

mutex_lock(&phy_config_mutex);

--
2.43.0


2024-06-07 23:08:17

by Takashi Sakamoto

[permalink] [raw]
Subject: Re: [PATCH 0/2] firewire: add helper functions for phy configuration packet

On Fri, Jun 07, 2024 at 08:51:31AM +0900, Takashi Sakamoto wrote:
> Hi,
>
> In recent months, the batch of helper functions was added to serialize
> and deserialize content of packet in IEEE 1394 protocol. This series of
> changes includes some helper functions for phy configuration packet as
> well as some KUnit tests for them.
>
> Takashi Sakamoto (2):
> firewire: core: add tests for serialization/deserialization of phy
> config packet
> firewire: core: use inline helper functions to serialize phy config
> packet
>
> drivers/firewire/core-transaction.c | 22 +++----
> drivers/firewire/packet-serdes-test.c | 79 +++++++++++++++++++++++
> drivers/firewire/phy-packet-definitions.h | 55 ++++++++++++++++
> 3 files changed, 144 insertions(+), 12 deletions(-)

Applied to for-next branch.


Regards

Takashi Sakamoto