Commit 644d037b authored by Niklas Söderlund's avatar Niklas Söderlund Committed by David S. Miller

ravb: Unify Rx ring maintenance code paths

The R-Car and RZ/G2L Rx code paths were split in two separate
implementations when support for RZ/G2L was added due to the fact that
R-Car uses the extended descriptor format while RZ/G2L uses normal
descriptors. This has led to a duplication of Rx logic with the only
difference being the different Rx descriptors types used. The
implementation however neglects to take into account that extended
descriptors are normal descriptors with additional metadata at the end
to carry hardware timestamp information.

The hardware timestamp information is only consumed in the R-Car Rx
loop and all the maintenance code around the Rx ring can be shared
between the two implementations if the difference in descriptor length
is carefully considered.

This change merges the two implementations for Rx ring maintenance by
adding a method to access both types of descriptors as normal
descriptors, as this part covers all the fields needed for Rx ring
maintenance the only difference between using normal or extended
descriptor is the size of the memory region to allocate/free and the
step size between each descriptor in the ring.
Signed-off-by: default avatarNiklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Reviewed-by: default avatarPaul Barker <paul.barker.ct@bp.renesas.com>
Reviewed-by: default avatarSergey Shtylyov <s.shtylyov@omp.ru>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 555419b2
...@@ -1039,9 +1039,6 @@ struct ravb_ptp { ...@@ -1039,9 +1039,6 @@ struct ravb_ptp {
}; };
struct ravb_hw_info { struct ravb_hw_info {
void (*rx_ring_free)(struct net_device *ndev, int q);
void (*rx_ring_format)(struct net_device *ndev, int q);
void *(*alloc_rx_desc)(struct net_device *ndev, int q);
bool (*receive)(struct net_device *ndev, int *quota, int q); bool (*receive)(struct net_device *ndev, int *quota, int q);
void (*set_rate)(struct net_device *ndev); void (*set_rate)(struct net_device *ndev);
int (*set_feature)(struct net_device *ndev, netdev_features_t features); int (*set_feature)(struct net_device *ndev, netdev_features_t features);
...@@ -1055,6 +1052,7 @@ struct ravb_hw_info { ...@@ -1055,6 +1052,7 @@ struct ravb_hw_info {
u32 tccr_mask; u32 tccr_mask;
u32 rx_max_frame_size; u32 rx_max_frame_size;
u32 rx_max_desc_use; u32 rx_max_desc_use;
u32 rx_desc_size;
unsigned aligned_tx: 1; unsigned aligned_tx: 1;
/* hardware features */ /* hardware features */
...@@ -1090,6 +1088,7 @@ struct ravb_private { ...@@ -1090,6 +1088,7 @@ struct ravb_private {
union { union {
struct ravb_rx_desc *desc; struct ravb_rx_desc *desc;
struct ravb_ex_rx_desc *ex_desc; struct ravb_ex_rx_desc *ex_desc;
void *raw;
} rx_ring[NUM_RX_QUEUE]; } rx_ring[NUM_RX_QUEUE];
struct ravb_tx_desc *tx_ring[NUM_TX_QUEUE]; struct ravb_tx_desc *tx_ring[NUM_TX_QUEUE];
void *tx_align[NUM_TX_QUEUE]; void *tx_align[NUM_TX_QUEUE];
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment