Skip to content

Commit afd4217

Browse files
ParthibanI17164kuba-moo
authored andcommitted
net: ethernet: oa_tc6: add helper function to enable zero align rx frame
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 <[email protected]> Signed-off-by: Parthiban Veerasooran <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 2c6ce53 commit afd4217

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

drivers/net/ethernet/oa_tc6.c

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
/* Configuration Register #0 */
2424
#define OA_TC6_REG_CONFIG0 0x0004
2525
#define CONFIG0_SYNC BIT(15)
26+
#define CONFIG0_ZARFE_ENABLE BIT(12)
2627

2728
/* Status Register #0 */
2829
#define OA_TC6_REG_STATUS0 0x0008
@@ -1163,6 +1164,29 @@ static irqreturn_t oa_tc6_macphy_isr(int irq, void *data)
11631164
return IRQ_HANDLED;
11641165
}
11651166

1167+
/**
1168+
* oa_tc6_zero_align_receive_frame_enable - function to enable zero align
1169+
* receive frame feature.
1170+
* @tc6: oa_tc6 struct.
1171+
*
1172+
* Return: 0 on success otherwise failed.
1173+
*/
1174+
int oa_tc6_zero_align_receive_frame_enable(struct oa_tc6 *tc6)
1175+
{
1176+
u32 regval;
1177+
int ret;
1178+
1179+
ret = oa_tc6_read_register(tc6, OA_TC6_REG_CONFIG0, &regval);
1180+
if (ret)
1181+
return ret;
1182+
1183+
/* Set Zero-Align Receive Frame Enable */
1184+
regval |= CONFIG0_ZARFE_ENABLE;
1185+
1186+
return oa_tc6_write_register(tc6, OA_TC6_REG_CONFIG0, regval);
1187+
}
1188+
EXPORT_SYMBOL_GPL(oa_tc6_zero_align_receive_frame_enable);
1189+
11661190
/**
11671191
* oa_tc6_start_xmit - function for sending the tx skb which consists ethernet
11681192
* frame.

include/linux/oa_tc6.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,4 @@ int oa_tc6_read_register(struct oa_tc6 *tc6, u32 address, u32 *value);
2121
int oa_tc6_read_registers(struct oa_tc6 *tc6, u32 address, u32 value[],
2222
u8 length);
2323
netdev_tx_t oa_tc6_start_xmit(struct oa_tc6 *tc6, struct sk_buff *skb);
24+
int oa_tc6_zero_align_receive_frame_enable(struct oa_tc6 *tc6);

0 commit comments

Comments
 (0)