- 论坛徽章:
- 0
|
有拿到两个版本的内核代码,下面是linux2.6.23的内核(也是freescale linux bsp里的提供的)
- static int gfar_start_xmit(struct sk_buff *skb, struct net_device *dev)
- {
- 。。。。。。。
- if (likely((dev->features & NETIF_F_IP_CSUM)
- && (CHECKSUM_PARTIAL == skb->ip_summed))) {
- fcb = gfar_add_fcb(skb, txbdp);
- status |= TXBD_TOE;
- gfar_tx_checksum(skb, fcb);
- }
- if (priv->vlan_enable &&
- unlikely(priv->vlgrp && vlan_tx_tag_present(skb))) {
- if (unlikely(NULL == fcb)) {
- fcb = gfar_add_fcb(skb, txbdp);
- status |= TXBD_TOE;
- }
- gfar_tx_vlan(skb, fcb);
- }
- #if defined(CONFIG_GFAR_PTP)
- /* Enable ptp flag so that Tx time stamping happens */
- [b]if (gfar_ptp_do_txstamp(skb)) {[/b] if (fcb == NULL)
- fcb = gfar_add_fcb(skb, txbdp);
- fcb->ptp = 0x01;
- status |= TXBD_TOE;
- }
- #endif
- /* Set buffer length and pointer */
- txbdp->length = skb->len;
- txbdp->bufPtr = dma_map_single(NULL, skb->data,
- skb->len, DMA_TO_DEVICE);
- ......................
- }
- #define GFAR_PTP_PKT_TYPE_OFFS 0x31 //困惑的地方是这个偏移值为什么是这个数值?
- #define GFAR_PTP_MULTI_ADDR_OFFS 0x38
- int gfar_ptp_do_txstamp(struct sk_buff *skb)
- {
- u32 *multicast_addr;
- char *pkt_type;
- if (skb->len > 42) {
- pkt_type = (char *)(skb->data + GFAR_PTP_PKT_TYPE_OFFS);
- multicast_addr = (u32 *)(skb->data + GFAR_PTP_MULTI_ADDR_OFFS);
- if ((*multicast_addr == GFAR_PTP_DOMAIN_DLFT) &&
- (*pkt_type == GFAR_PACKET_TYPE_UDP))
- return 1;
- }
- return 0;
- }
复制代码
[ 本帖最后由 unixgg1984 于 2009-6-27 22:06 编辑 ] |
|