[OpenWrt-Devel] [OpenWrt-Devel, 3/7] ramips: fix rx buffer length

Sven Eckelmann sven at open-mesh.com
Mon Oct 5 06:31:44 EDT 2015


On Tuesday 22 September 2015 21:25:59 michael lee wrote:
> From: michael lee <igvtee at gmail.com>
> 
> Signed-off-by: Michael Lee <igvtee at gmail.com>
> ---

Sorry, missed your patch when I've send the fix [1] for my report [2].
John was kind enough to point me to your patch.

> diff --git a/target/linux/ramips/files/drivers/net/ethernet/ralink/ralink_soc_eth.h b/target/linux/ramips/files/drivers/net/ethernet/ralink/ralink_soc_eth.h
> index 78e04b0..8861762 100644
> --- a/target/linux/ramips/files/drivers/net/ethernet/ralink/ralink_soc_eth.h
> +++ b/target/linux/ramips/files/drivers/net/ethernet/ralink/ralink_soc_eth.h
> @@ -310,7 +310,8 @@ enum fe_work_flag {
>  /* rxd2 */
>  #define RX_DMA_DONE		BIT(31)
>  #define RX_DMA_LSO		BIT(30)
> -#define RX_DMA_PLEN0(_x)	(((_x) >> 16) & 0x3fff)
> +#define RX_DMA_PLEN0_GET(_x)	(((_x) >> 16) & 0x3fff)
> +#define RX_DMA_PLEN0_SET(_x)	(((_x) & 0x3fff) << 16)
>  #define RX_DMA_TAG		BIT(15)
>  /* rxd3 */
>  #define RX_DMA_TPID(_x)		(((_x) >> 16) & 0xffff)

I am personally against changing the name from RX_DMA_PLEN0 to
RX_DMA_PLEN0_SET after I read the rest of the header. For example
check the TX DMA macros:

    #define TX_DMA_PLEN0(_x)	(((_x) & TX_DMA_BUF_LEN) << 16)
    #define TX_DMA_PLEN1(_x)	((_x) & TX_DMA_BUF_LEN)
    #define TX_DMA_GET_PLEN0(_x)    (((_x) >> 16 ) & TX_DMA_BUF_LEN)
    #define TX_DMA_GET_PLEN1(_x)    ((_x) & TX_DMA_BUF_LEN)

You can see that the set functions have no _SET in it but the _GET functions
have. So I would say it is better to follow the current coding/naming style
instead of introducing a second one.

Kind regards,
	Sven

[1] https://patchwork.ozlabs.org/patch/522722/
[2] http://news.gmane.org/gmane.comp.embedded.openwrt.devel
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list