staging: et131x: Use skb_headlen() where appropriate
(skb->len - skb->data_len) is used in several places in the et131x driver code. Converted all instances of this to use skb_headlen() which is more readable. Signed-off-by: Mark Einon <mark.einon@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
355d8ae57b
commit
f1b540b92c
|
@ -3313,12 +3313,11 @@ static int nic_send_packet(struct et131x_adapter *adapter, struct tcb *tcb)
|
||||||
* This will work until we determine why the hardware
|
* This will work until we determine why the hardware
|
||||||
* doesn't seem to like large fragments.
|
* doesn't seem to like large fragments.
|
||||||
*/
|
*/
|
||||||
if ((skb->len - skb->data_len) <= 1514) {
|
if (skb_headlen(skb) <= 1514) {
|
||||||
desc[frag].addr_hi = 0;
|
desc[frag].addr_hi = 0;
|
||||||
/* Low 16bits are length, high is vlan and
|
/* Low 16bits are length, high is vlan and
|
||||||
unused currently so zero */
|
unused currently so zero */
|
||||||
desc[frag].len_vlan =
|
desc[frag].len_vlan = skb_headlen(skb);
|
||||||
skb->len - skb->data_len;
|
|
||||||
|
|
||||||
/* NOTE: Here, the dma_addr_t returned from
|
/* NOTE: Here, the dma_addr_t returned from
|
||||||
* dma_map_single() is implicitly cast as a
|
* dma_map_single() is implicitly cast as a
|
||||||
|
@ -3331,13 +3330,11 @@ static int nic_send_packet(struct et131x_adapter *adapter, struct tcb *tcb)
|
||||||
desc[frag++].addr_lo =
|
desc[frag++].addr_lo =
|
||||||
dma_map_single(&adapter->pdev->dev,
|
dma_map_single(&adapter->pdev->dev,
|
||||||
skb->data,
|
skb->data,
|
||||||
skb->len -
|
skb_headlen(skb),
|
||||||
skb->data_len,
|
|
||||||
DMA_TO_DEVICE);
|
DMA_TO_DEVICE);
|
||||||
} else {
|
} else {
|
||||||
desc[frag].addr_hi = 0;
|
desc[frag].addr_hi = 0;
|
||||||
desc[frag].len_vlan =
|
desc[frag].len_vlan = skb_headlen(skb) / 2;
|
||||||
(skb->len - skb->data_len) / 2;
|
|
||||||
|
|
||||||
/* NOTE: Here, the dma_addr_t returned from
|
/* NOTE: Here, the dma_addr_t returned from
|
||||||
* dma_map_single() is implicitly cast as a
|
* dma_map_single() is implicitly cast as a
|
||||||
|
@ -3350,13 +3347,11 @@ static int nic_send_packet(struct et131x_adapter *adapter, struct tcb *tcb)
|
||||||
desc[frag++].addr_lo =
|
desc[frag++].addr_lo =
|
||||||
dma_map_single(&adapter->pdev->dev,
|
dma_map_single(&adapter->pdev->dev,
|
||||||
skb->data,
|
skb->data,
|
||||||
((skb->len -
|
(skb_headlen(skb) / 2),
|
||||||
skb->data_len) / 2),
|
|
||||||
DMA_TO_DEVICE);
|
DMA_TO_DEVICE);
|
||||||
desc[frag].addr_hi = 0;
|
desc[frag].addr_hi = 0;
|
||||||
|
|
||||||
desc[frag].len_vlan =
|
desc[frag].len_vlan = skb_headlen(skb) / 2;
|
||||||
(skb->len - skb->data_len) / 2;
|
|
||||||
|
|
||||||
/* NOTE: Here, the dma_addr_t returned from
|
/* NOTE: Here, the dma_addr_t returned from
|
||||||
* dma_map_single() is implicitly cast as a
|
* dma_map_single() is implicitly cast as a
|
||||||
|
@ -3369,10 +3364,8 @@ static int nic_send_packet(struct et131x_adapter *adapter, struct tcb *tcb)
|
||||||
desc[frag++].addr_lo =
|
desc[frag++].addr_lo =
|
||||||
dma_map_single(&adapter->pdev->dev,
|
dma_map_single(&adapter->pdev->dev,
|
||||||
skb->data +
|
skb->data +
|
||||||
((skb->len -
|
(skb_headlen(skb) / 2),
|
||||||
skb->data_len) / 2),
|
(skb_headlen(skb) / 2),
|
||||||
((skb->len -
|
|
||||||
skb->data_len) / 2),
|
|
||||||
DMA_TO_DEVICE);
|
DMA_TO_DEVICE);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -3521,7 +3514,7 @@ static int send_packet(struct sk_buff *skb, struct et131x_adapter *adapter)
|
||||||
|
|
||||||
tcb->skb = skb;
|
tcb->skb = skb;
|
||||||
|
|
||||||
if (skb->data != NULL && skb->len - skb->data_len >= 6) {
|
if (skb->data != NULL && skb_headlen(skb) >= 6) {
|
||||||
shbufva = (u16 *) skb->data;
|
shbufva = (u16 *) skb->data;
|
||||||
|
|
||||||
if ((shbufva[0] == 0xffff) &&
|
if ((shbufva[0] == 0xffff) &&
|
||||||
|
|
Loading…
Reference in New Issue