Skip to content

Commit 64f26ab

Browse files
Zhu Yanjundavem330
authored andcommitted
forcedeth: remove duplicate structure member in rx
Since both first_rx and rx_ring are the head of rx ring, it not necessary to use two structure members to statically indicate the head of rx ring. So first_rx is removed. CC: Srinivas Eeda <[email protected]> CC: Joe Jin <[email protected]> CC: Junxiao Bi <[email protected]> Signed-off-by: Zhu Yanjun <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent c8c9aeb commit 64f26ab

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

drivers/net/ethernet/nvidia/forcedeth.c

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -793,7 +793,7 @@ struct fe_priv {
793793
/* rx specific fields.
794794
* Locking: Within irq hander or disable_irq+spin_lock(&np->lock);
795795
*/
796-
union ring_type get_rx, put_rx, first_rx, last_rx;
796+
union ring_type get_rx, put_rx, last_rx;
797797
struct nv_skb_map *get_rx_ctx, *put_rx_ctx;
798798
struct nv_skb_map *first_rx_ctx, *last_rx_ctx;
799799
struct nv_skb_map *rx_skb;
@@ -1812,7 +1812,7 @@ static int nv_alloc_rx(struct net_device *dev)
18121812
struct ring_desc *less_rx;
18131813

18141814
less_rx = np->get_rx.orig;
1815-
if (less_rx-- == np->first_rx.orig)
1815+
if (less_rx-- == np->rx_ring.orig)
18161816
less_rx = np->last_rx.orig;
18171817

18181818
while (np->put_rx.orig != less_rx) {
@@ -1833,7 +1833,7 @@ static int nv_alloc_rx(struct net_device *dev)
18331833
wmb();
18341834
np->put_rx.orig->flaglen = cpu_to_le32(np->rx_buf_sz | NV_RX_AVAIL);
18351835
if (unlikely(np->put_rx.orig++ == np->last_rx.orig))
1836-
np->put_rx.orig = np->first_rx.orig;
1836+
np->put_rx.orig = np->rx_ring.orig;
18371837
if (unlikely(np->put_rx_ctx++ == np->last_rx_ctx))
18381838
np->put_rx_ctx = np->first_rx_ctx;
18391839
} else {
@@ -1853,7 +1853,7 @@ static int nv_alloc_rx_optimized(struct net_device *dev)
18531853
struct ring_desc_ex *less_rx;
18541854

18551855
less_rx = np->get_rx.ex;
1856-
if (less_rx-- == np->first_rx.ex)
1856+
if (less_rx-- == np->rx_ring.ex)
18571857
less_rx = np->last_rx.ex;
18581858

18591859
while (np->put_rx.ex != less_rx) {
@@ -1875,7 +1875,7 @@ static int nv_alloc_rx_optimized(struct net_device *dev)
18751875
wmb();
18761876
np->put_rx.ex->flaglen = cpu_to_le32(np->rx_buf_sz | NV_RX2_AVAIL);
18771877
if (unlikely(np->put_rx.ex++ == np->last_rx.ex))
1878-
np->put_rx.ex = np->first_rx.ex;
1878+
np->put_rx.ex = np->rx_ring.ex;
18791879
if (unlikely(np->put_rx_ctx++ == np->last_rx_ctx))
18801880
np->put_rx_ctx = np->first_rx_ctx;
18811881
} else {
@@ -1903,7 +1903,8 @@ static void nv_init_rx(struct net_device *dev)
19031903
struct fe_priv *np = netdev_priv(dev);
19041904
int i;
19051905

1906-
np->get_rx = np->put_rx = np->first_rx = np->rx_ring;
1906+
np->get_rx = np->rx_ring;
1907+
np->put_rx = np->rx_ring;
19071908

19081909
if (!nv_optimized(np))
19091910
np->last_rx.orig = &np->rx_ring.orig[np->rx_ring_size-1];
@@ -2911,7 +2912,7 @@ static int nv_rx_process(struct net_device *dev, int limit)
29112912
u64_stats_update_end(&np->swstats_rx_syncp);
29122913
next_pkt:
29132914
if (unlikely(np->get_rx.orig++ == np->last_rx.orig))
2914-
np->get_rx.orig = np->first_rx.orig;
2915+
np->get_rx.orig = np->rx_ring.orig;
29152916
if (unlikely(np->get_rx_ctx++ == np->last_rx_ctx))
29162917
np->get_rx_ctx = np->first_rx_ctx;
29172918

@@ -3000,7 +3001,7 @@ static int nv_rx_process_optimized(struct net_device *dev, int limit)
30003001
}
30013002
next_pkt:
30023003
if (unlikely(np->get_rx.ex++ == np->last_rx.ex))
3003-
np->get_rx.ex = np->first_rx.ex;
3004+
np->get_rx.ex = np->rx_ring.ex;
30043005
if (unlikely(np->get_rx_ctx++ == np->last_rx_ctx))
30053006
np->get_rx_ctx = np->first_rx_ctx;
30063007

0 commit comments

Comments
 (0)