aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/cxgb3/sge.c
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2007-04-25 20:55:53 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-04-26 01:25:16 -0400
commitea2ae17d6443abddc79480dc9f7af8feacabddc4 (patch)
tree2d6f48a5e4a40f761b5b510af9aac1fca55004cb /drivers/net/cxgb3/sge.c
parentbadff6d01a8589a1c828b0bf118903ca38627f4e (diff)
[SK_BUFF]: Introduce skb_transport_offset()
For the quite common 'skb->h.raw - skb->data' sequence. Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/cxgb3/sge.c')
-rw-r--r--drivers/net/cxgb3/sge.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/net/cxgb3/sge.c b/drivers/net/cxgb3/sge.c
index a891f6f81527..d38b1bcd138e 100644
--- a/drivers/net/cxgb3/sge.c
+++ b/drivers/net/cxgb3/sge.c
@@ -1319,9 +1319,10 @@ static void write_ofld_wr(struct adapter *adap, struct sk_buff *skb,
1319 /* Only TX_DATA builds SGLs */ 1319 /* Only TX_DATA builds SGLs */
1320 1320
1321 from = (struct work_request_hdr *)skb->data; 1321 from = (struct work_request_hdr *)skb->data;
1322 memcpy(&d->flit[1], &from[1], skb->h.raw - skb->data - sizeof(*from)); 1322 memcpy(&d->flit[1], &from[1],
1323 skb_transport_offset(skb) - sizeof(*from));
1323 1324
1324 flits = (skb->h.raw - skb->data) / 8; 1325 flits = skb_transport_offset(skb) / 8;
1325 sgp = ndesc == 1 ? (struct sg_ent *)&d->flit[flits] : sgl; 1326 sgp = ndesc == 1 ? (struct sg_ent *)&d->flit[flits] : sgl;
1326 sgl_flits = make_sgl(skb, sgp, skb->h.raw, skb->tail - skb->h.raw, 1327 sgl_flits = make_sgl(skb, sgp, skb->h.raw, skb->tail - skb->h.raw,
1327 adap->pdev); 1328 adap->pdev);
@@ -1349,7 +1350,7 @@ static inline unsigned int calc_tx_descs_ofld(const struct sk_buff *skb)
1349 if (skb->len <= WR_LEN && cnt == 0) 1350 if (skb->len <= WR_LEN && cnt == 0)
1350 return 1; /* packet fits as immediate data */ 1351 return 1; /* packet fits as immediate data */
1351 1352
1352 flits = (skb->h.raw - skb->data) / 8; /* headers */ 1353 flits = skb_transport_offset(skb) / 8; /* headers */
1353 if (skb->tail != skb->h.raw) 1354 if (skb->tail != skb->h.raw)
1354 cnt++; 1355 cnt++;
1355 return flits_to_desc(flits + sgl_len(cnt)); 1356 return flits_to_desc(flits + sgl_len(cnt));