Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <andrew@lunn.ch>
Signed-off-by: Parthiban Veerasooran <Parthiban.Veerasooran@microchip.com>
Link: https://patch.msgid.link/20240909082514.262942-13-Parthiban.Veerasooran@microchip.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Parthiban Veerasooran and committed by
Jakub Kicinski
afd42170 2c6ce535

+25
+24
drivers/net/ethernet/oa_tc6.c
··· 23 23 /* Configuration Register #0 */ 24 24 #define OA_TC6_REG_CONFIG0 0x0004 25 25 #define CONFIG0_SYNC BIT(15) 26 + #define CONFIG0_ZARFE_ENABLE BIT(12) 26 27 27 28 /* Status Register #0 */ 28 29 #define OA_TC6_REG_STATUS0 0x0008 ··· 1163 1162 1164 1163 return IRQ_HANDLED; 1165 1164 } 1165 + 1166 + /** 1167 + * oa_tc6_zero_align_receive_frame_enable - function to enable zero align 1168 + * receive frame feature. 1169 + * @tc6: oa_tc6 struct. 1170 + * 1171 + * Return: 0 on success otherwise failed. 1172 + */ 1173 + int oa_tc6_zero_align_receive_frame_enable(struct oa_tc6 *tc6) 1174 + { 1175 + u32 regval; 1176 + int ret; 1177 + 1178 + ret = oa_tc6_read_register(tc6, OA_TC6_REG_CONFIG0, &regval); 1179 + if (ret) 1180 + return ret; 1181 + 1182 + /* Set Zero-Align Receive Frame Enable */ 1183 + regval |= CONFIG0_ZARFE_ENABLE; 1184 + 1185 + return oa_tc6_write_register(tc6, OA_TC6_REG_CONFIG0, regval); 1186 + } 1187 + EXPORT_SYMBOL_GPL(oa_tc6_zero_align_receive_frame_enable); 1166 1188 1167 1189 /** 1168 1190 * oa_tc6_start_xmit - function for sending the tx skb which consists ethernet
+1
include/linux/oa_tc6.h
··· 21 21 int oa_tc6_read_registers(struct oa_tc6 *tc6, u32 address, u32 value[], 22 22 u8 length); 23 23 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);