Skip to content

Commit

Permalink
Merge branch 'net-macb-few-code-cleanups'
Browse files Browse the repository at this point in the history
Claudiu Beznea says:

====================
net: macb: few code cleanups

Patches in this series cleanup a bit macb code.

Changes in v2:
- in patch 2/4 use hweight32() instead of hweight_long()
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
David S. Miller committed Jul 2, 2020
2 parents 9eb6206 + 8932b5a commit 44947c0
Showing 1 changed file with 5 additions and 14 deletions.
19 changes: 5 additions & 14 deletions drivers/net/ethernet/cadence/macb_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1467,7 +1467,7 @@ static void macb_hresp_error_task(unsigned long data)
{
struct macb *bp = (struct macb *)data;
struct net_device *dev = bp->dev;
struct macb_queue *queue = bp->queues;
struct macb_queue *queue;
unsigned int q;
u32 ctrl;

Expand Down Expand Up @@ -1933,7 +1933,7 @@ static netdev_tx_t macb_start_xmit(struct sk_buff *skb, struct net_device *dev)
unsigned long flags;
unsigned int desc_cnt, nr_frags, frag_size, f;
unsigned int hdrlen;
bool is_lso, is_udp = 0;
bool is_lso;
netdev_tx_t ret = NETDEV_TX_OK;

if (macb_clear_csum(skb)) {
Expand All @@ -1949,10 +1949,8 @@ static netdev_tx_t macb_start_xmit(struct sk_buff *skb, struct net_device *dev)
is_lso = (skb_shinfo(skb)->gso_size != 0);

if (is_lso) {
is_udp = !!(ip_hdr(skb)->protocol == IPPROTO_UDP);

/* length of headers */
if (is_udp)
if (ip_hdr(skb)->protocol == IPPROTO_UDP)
/* only queue eth + ip headers separately for UDP */
hdrlen = skb_transport_offset(skb);
else
Expand Down Expand Up @@ -3482,8 +3480,6 @@ static void macb_probe_queues(void __iomem *mem,
unsigned int *queue_mask,
unsigned int *num_queues)
{
unsigned int hw_q;

*queue_mask = 0x1;
*num_queues = 1;

Expand All @@ -3497,13 +3493,8 @@ static void macb_probe_queues(void __iomem *mem,
return;

/* bit 0 is never set but queue 0 always exists */
*queue_mask = readl_relaxed(mem + GEM_DCFG6) & 0xff;

*queue_mask |= 0x1;

for (hw_q = 1; hw_q < MACB_MAX_QUEUES; ++hw_q)
if (*queue_mask & (1 << hw_q))
(*num_queues)++;
*queue_mask |= readl_relaxed(mem + GEM_DCFG6) & 0xff;
*num_queues = hweight32(*queue_mask);
}

static int macb_clk_init(struct platform_device *pdev, struct clk **pclk,
Expand Down

0 comments on commit 44947c0

Please sign in to comment.