Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: Manish Lachwani <mlachwani@mvista.com>
To: TheNop <TheNop@gmx.net>
Cc: linux-mips@linux-mips.org
Subject: Re: Titan ethernet driver broken
Date: Fri, 19 Nov 2004 09:32:00 -0800	[thread overview]
Message-ID: <419E2E10.5020304@mvista.com> (raw)
In-Reply-To: <419D1F76.6010603@gmx.net>

Hello !

If you are interested in creating a patch for supporting Titan GE in 
older Titan versions (1.0 and 1.1), then I have indicated the part of 
the diffs below that you will need to apply to the current driver

>  
>  /*
> + * Do the slowpath route. This route is kicked off
> + * when the IP header is misaligned. Grrr ..
> + */
> +static int titan_ge_slowpath(struct sk_buff *skb,
> +				titan_ge_packet *packet,
> +				struct net_device *netdev)
> +{
> +	struct sk_buff *copy_skb;
> +
> +	copy_skb = dev_alloc_skb(packet->len + 2);
> +
> +	if (!copy_skb) {
> +		dev_kfree_skb_any(packet->skb);
> +		return -1;
> +	}
> +
> +	copy_skb->dev = netdev;
> +	skb_reserve(copy_skb, 2);
> +	skb_put(copy_skb, packet->len);
> +
> +	memcpy(copy_skb->data, skb->data, packet->len);
> +
> +	/* Titan supports Rx checksum offload */
> +	copy_skb->ip_summed = CHECKSUM_HW;
> +	copy_skb->csum = packet->checksum;
> +
> +	copy_skb->protocol = eth_type_trans(copy_skb, netdev);
> +
> +	dev_kfree_skb_any(packet->skb);
> +#ifdef TITAN_RX_NAPI
> +	netif_receive_skb(copy_skb);
> +#else
> +	netif_rx(copy_skb);
> +#endif
> +
> +	return 0;
> +}
> +
> +/*
>   * Threshold beyond which we do the cleaning of
>   * Tx queue and new allocation for the Rx
>   * queue
> @@ -1434,10 +1421,11 @@
>  
>  		titan_ge_eth->rx_ring_skbs--;
>  
> +#ifdef TITAN_RX_NAPI
>  		if (--titan_ge_eth->rx_work_limit < 0)
>  			break;
>  		received_packets++;
> -
> +#endif
>  		stats->rx_packets++;
>  		stats->rx_bytes += packet.len;
>  
> @@ -1456,36 +1444,41 @@
>  		 * idea is to cut down the number of checks and improve
>  		 * the fastpath.
>  		 */
> +		skb_put(skb, packet.len);
>  
> -		skb_put(skb, packet.len - 2);
> -
> -		/*
> -		 * Increment data pointer by two since thats where
> -		 * the MAC starts
> -		 */
> -		skb_reserve(skb, 2);
> -		skb->protocol = eth_type_trans(skb, netdev);
> -		netif_receive_skb(skb);
> +		if (titan_ge_slowpath(skb, &packet, netdev) < 0) 
> +			goto out_next;
>  
> +#ifdef TITAN_RX_NAPI
>  		if (titan_ge_eth->rx_threshold > RX_THRESHOLD) {
>  			ack = titan_ge_rx_task(netdev, titan_ge_eth);
>  			TITAN_GE_WRITE((0x5048 + (port_num << 8)), ack);
>  			titan_ge_eth->rx_threshold = 0;
>  		} else
>  			titan_ge_eth->rx_threshold++;
> +#else
> +		ack = titan_ge_rx_task(netdev, titan_ge_eth);
> +		TITAN_GE_WRITE((0x5048 + (port_num << 8)), ack);
> +#endif
>  
> +out_next:
> +
> +#ifdef TITAN_RX_NAPI
>  		if (titan_ge_eth->tx_threshold > TX_THRESHOLD) {
>  			titan_ge_eth->tx_threshold = 0;
>  			titan_ge_free_tx_queue(titan_ge_eth);
>  		}
>  		else
>  			titan_ge_eth->tx_threshold++;
> +#endif
>  
>  	}
>  	return received_packets;
>  }
>  

Thanks
Manish Lachwani

      parent reply	other threads:[~2004-11-19 17:32 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-18 20:19 Titan ethernet driver broken TheNop
2004-11-18 20:23 ` Manish Lachwani
2004-11-18 21:41   ` TheNop
2004-11-18 21:42     ` Manish Lachwani
2004-11-18 21:54       ` TheNop
2004-11-18 22:17         ` TheNop
2004-11-18 22:23           ` Manish Lachwani
2004-11-18 22:43             ` TheNop
2004-11-18 23:43               ` Manish Lachwani
2004-11-20  9:54               ` Ralf Baechle
2004-11-21  7:26                 ` Manish Lachwani
2004-11-19 17:32           ` Manish Lachwani [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=419E2E10.5020304@mvista.com \
    --to=mlachwani@mvista.com \
    --cc=TheNop@gmx.net \
    --cc=linux-mips@linux-mips.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox