net: ethernet: stmmac: GMAC4.xx: Fix TX descriptor preparation
authorAlexandre TORGUE <alexandre.torgue@st.com>
Fri, 8 Apr 2016 09:18:03 +0000 (11:18 +0200)
committerDavid S. Miller <davem@davemloft.net>
Thu, 14 Apr 2016 02:35:17 +0000 (22:35 -0400)
On GMAC4.xx each descriptor contains 2 buffers of 16KB (each).
Initially, those 2 buffers was filled in dwmac4_rd_prepare_tx_desc but
it is actually not needed. Indeed, stmmac driver supports frame up to
9000 bytes (jumbo). So only one buffer is needed.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Alexandre TORGUE <alexandre.torgue@st.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c

index d4952c7a836dbcf4cdd8346e51e41f2c837d858c..4ec7397e7fb378d1d82368c5fb9aff28e5340c6c 100644 (file)
@@ -254,14 +254,7 @@ static void dwmac4_rd_prepare_tx_desc(struct dma_desc *p, int is_fs, int len,
 {
        unsigned int tdes3 = p->des3;
 
-       if (unlikely(len > BUF_SIZE_16KiB)) {
-               p->des2 |= (((len - BUF_SIZE_16KiB) <<
-                            TDES2_BUFFER2_SIZE_MASK_SHIFT)
-                           & TDES2_BUFFER2_SIZE_MASK)
-                           | (BUF_SIZE_16KiB & TDES2_BUFFER1_SIZE_MASK);
-       } else {
-               p->des2 |= (len & TDES2_BUFFER1_SIZE_MASK);
-       }
+       p->des2 |= (len & TDES2_BUFFER1_SIZE_MASK);
 
        if (is_fs)
                tdes3 |= TDES3_FIRST_DESCRIPTOR;