Skip to content
Browse files

drivers: eth: gmac: Restore original frags data after transmitting

The pointers to pkt->frags->data are changed after transmitting.
Other layers (e.g. the gPTP drivers) assume that these will remain
unchanged. This patch adds a workaround for that issue and restores the
original pointers.

Signed-off-by: Tomasz Gorochowik <>
  • Loading branch information...
tgorochowik authored and jukkar committed Apr 18, 2018
1 parent 6101e23 commit 525b0ce81b2e06f795d04a3fe8b3aa06cdc4b092
Showing with 7 additions and 1 deletion.
  1. +7 −1 drivers/ethernet/eth_sam_gmac.c
@@ -751,7 +751,7 @@ static int eth_tx(struct net_if *iface, struct net_pkt *pkt)
struct gmac_desc_list *tx_desc_list = &queue->tx_desc_list;
struct gmac_desc *tx_desc;
struct net_buf *frag;
u8_t *frag_data;
u8_t *frag_data, *frag_orig;
u16_t frag_len;
u32_t err_tx_flushed_count_at_entry = queue->err_tx_flushed_count;
unsigned int key;
@@ -761,6 +761,9 @@ static int eth_tx(struct net_if *iface, struct net_pkt *pkt)


/* Store the original frag data pointer */
frag_orig = pkt->frags->data;

/* First fragment is special - it contains link layer (Ethernet
* in our case) header. Modify the data pointer to account for more data
* in the beginning of the buffer.
@@ -817,6 +820,9 @@ static int eth_tx(struct net_if *iface, struct net_pkt *pkt)
frag = frag->frags;

/* Restore the original frag data pointer */
pkt->frags->data = frag_orig;

key = irq_lock();

/* Check if tx_error_handler() function was executed */

0 comments on commit 525b0ce

Please sign in to comment.
You can’t perform that action at this time.