Skip to contentSkip to conversation

Submission for S2io 10GbE driver

DISCUSSION Applied Leonid Grossman 11 participants 46 messages Jan 23, 2004 – Mar 22, 2004

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

Hi all,
Please fund attached a source code for S2io 10GbE adapter (with some disclaimers below).
Send me your comments/suggestions on the source please, and we will address the code changes (if any) in real time.

Regards, Leonid

Leonid Grossman
Vice President, SW Engineering
S2io Inc.
www.s2io.com

-----Original Message-----
From: Leonid Grossman [mailto:[email protected]]
Sent: Tuesday, January 20, 2004 8:13 PM
To: 'Jeff Garzik'
Subject: Submission for S2io 10GbE driver

Hi Jeff,
Per your suggestion, attached is the driver source.

Couple disclaimers -
1. There are some history logs from our CVS at the end of the source files, you will probably want us to remove these.

2. We are working on adding more loadable tunable parameters.

3. This is a shipping (as of last October) card, and Linux driver got some reasonable mileage on 2.6 kernel and number of 2.4 distributions, mostly 2.4.21 based. Having said that, we still run performance and stress tests in QA since 10GbE is fairly new.

All comments/suggestions are very welcome; let me know if you need anything besides the source from our end.

Regards, Leonid

Quoted 25 lines

-----Original Message-----
From: Jeff Garzik [mailto:[email protected]]
Sent: Monday, January 12, 2004 1:36 PM
To: Leonid Grossman
Subject: Re: FW: Submission for 10GbE driver

Just a suggestion, but it might be a good idea to email me your driver
sooner than later.

_Almost all_ drivers require changes before being submitting, so delaying source release due to a Q/A cycle or similar is probably just
wasting time, if the driver will likely have to be updated and re-submitted, possibly several times.

Don't let me scare you :) Going through 1-2 iterations before a driver
passes review is normal for most vendors, particularly the first one. The key is listening to kernel developers' feedback.

Jeff

#1 lore raw
Quoted 6 lines · On Fri, 23 Jan 2004 13:22:11 -0800 "Leonid Grossman"…

Hi all,
Please fund attached a source code for S2io 10GbE adapter (with some disclaimers below).
Send me your comments/suggestions on the source please, and we will address the code changes (if any) in real time.

Quoted 8 lines

Regards, Leonid

Leonid Grossman
Vice President, SW Engineering
S2io Inc.
www.s2io.com

Okay, but next time how about only sending the source of the driver as a kernel patch. Not a whole build directory including binaries and CVS!

#2 lore raw
Quoted 11 lines

-----Original Message-----
From: Stephen Hemminger [mailto:[email protected]]
Sent: Friday, January 23, 2004 1:54 PM
To: Leonid Grossman
Cc: [email protected]
Subject: Re: Submission for S2io 10GbE driver Okay, but next time how about only sending the source of the driver as a kernel patch. Not a whole build directory including binaries and CVS!

Will do next time.
Leonid

#3 lore raw
In reply to Leonid Grossman
Quoted 7 lines · On Fri, 23 Jan 2004 13:22:11 -0800 "Leonid Grossman"…

Hi all,
Please fund attached a source code for S2io 10GbE adapter (with some disclaimers below).
Send me your comments/suggestions on the source please, and we will address the code changes (if any) in real time.

From a quick look:

The debugging ioctls look quite dangerous. iirc they are not root projected by higher level code. Either remove them or add a root check at least, otherwise you'll have a potential root hole.

All the ARCH_PPC64 ifdefs shouldn't be needed. Can you remove that? If there are problems in ppc64 code they should be fixed there, not worked around. Same with the ifdefs for kernel 2.6 features. An driver integrated into the kernel should not contain such ifdefs.

mdelay(100) is quite evil. Better make that a schedule_timeout() in process context.

ETH_GREGS/GEEPROM/SEEPROM/GSTRINGS ioctl handlers: seems to leak memory on error paths

ETH_SEEPROM: len should be limit checked

Running the driver through scripts/Lindent may not be a bad idea.

initNic: the jiffies check does not handle jiffies wrapping. 2.6 forces a jiffies wrap 5 minutes after boot, so this may be fatal. Use the right macros for this.

init_nic: x86-64 supports consistent dma masks too. in fact they should be just used unconditionally.

-Andi

#4 lore raw

Noticed the setup loopback test seems to register for a packet type and then forget to unregister that type!

Also nothing really restricts the packet type to only coming in on the expected interface; therefore if someone sends the same packet in over another interface, then sp->loop_pkt_cnt will end up incrementing some other drivers private data structure *bad*.

IMHO the whole loopback test frame stuff seems like something in a test bed driver, not production code.

#35 lore raw
In reply to Leonid Grossman

Leonid Grossman <[email protected]> :
[...]

Quoted 2 lines

Send me your comments/suggestions on the source please, and we will address the code changes (if any) in real time.

No need to hurry.

s2io.c:

[...]
int s2io_starter(void);
void s2io_closer(void);
void s2io_tx_watchdog(struct net_device *dev); void s2io_tasklet(unsigned long dev_addr);
void s2io_set_multicast(struct net_device *dev); int rxOsmHandler(nic_t *sp,u16 len,RxD_t *rxdp,int ring_no); void s2io_link(nic_t *sp, int link);
void s2io_reset(nic_t *sp);

-> s2io_tx_watchdog()...s2io_reset() probably want to be 'static'

#ifdef CONFIGURE_NAPI_SUPPORT
static int s2io_poll(struct net_device *dev, int *budget); #endif

#define TASKLET_IN_USE test_and_set_bit(0, (unsigned long *)&sp->tasklet_status)
#define PANIC 1
#define LOW 2
static inline int rx_buffer_level(nic_t *sp, int rxb_size, int ring)

{
	int level = 0;
	if((sp->pkt_cnt[ring] - rxb_size) > 128) {
		level = LOW;
		if(rxb_size < sp->pkt_cnt[ring]/8)
			level = PANIC;

-> whitespaces after the C keywords help sometimes (especially at 1:00 am)

	}
	
	return level;
}

[...]
static char s2io_gstrings[][ETH_GSTRING_LEN] = { "Register test\t(offline)",
"Eeprom test\t(offline)",
"Loop back test\t(online)",
"Link test\t(online)",
"RLDRAM test\t(offline)",
"BIST Test\t(offline)"

-> please add a tab before the strings

};
[...]

	if(size > MAX_AVAILABLE_TXDS) {
		DBG_PRINT(ERR_DBG,"%s: Total number of Tx FIFOs ",dev->name);
		DBG_PRINT(ERR_DBG,"exceeds the maximum value ");
		DBG_PRINT(ERR_DBG,"that can be used\n");
		return FAILURE;	
                       ^^^^^^^

-> -ESOMETHING ?

[...]

	for(i=0;i<nic->config.TxFIFONum;i++) {
		nic->mac_control.txdl_start_phy[i] = tmp_p_addr;
		nic->mac_control.txdl_start[i] = (TxD_t *)tmp_v_addr;
		nic->mac_control.tx_curr_put_info[i].offset = 0;
		nic->mac_control.tx_curr_put_info[i].fifo_len =
		nic->config.TxCfg[i].FifoLen-1;
		nic->mac_control.tx_curr_get_info[i].offset = 0;
		nic->mac_control.tx_curr_get_info[i].fifo_len =
		nic->config.TxCfg[i].FifoLen-1;

-> you probably want to add local variables (as well as an helper function ?)
to avoid repeating 'nic->mac_control' over and over.

		tmp_p_addr += (nic->config.TxCfg[i].FifoLen*(sizeof(TxD_t))*
			nic->config.MaxTxDs);
		tmp_v_addr += (nic->config.TxCfg[i].FifoLen*(sizeof(TxD_t))*
			 nic->config.MaxTxDs);
	}

/* Allocation and initialization of RXDs in Rings */

	size = 0;
	for(i=0; i<nic->config.RxRingNum; i++) {
		if(nic->config.RxCfg[i].NumRxd % 128) {
			DBG_PRINT(ERR_DBG,"%s: RxD count of ",dev->name);
			DBG_PRINT(ERR_DBG,"Ring%d is not a multiple of ", i);
			DBG_PRINT(ERR_DBG,"RxDs per Block");
			return FAILURE;
		}
		size += nic->config.RxCfg[i].NumRxd;
		nic->block_count[i] = 
			nic->config.RxCfg[i].NumRxd/(MAX_RXDS_PER_BLOCK+1);
		nic->pkt_cnt[i] = 
			nic->config.RxCfg[i].NumRxd-nic->block_count[i];

-> please add local variables.

[...]
/* Enable DTX_Control registers. */
/* LATEST Fix given by Richard to fix XAUI Configuration */

	write64(&bar0->dtx_control,0x8000051500000000);
	udelay(50);	
	write64(&bar0->dtx_control,0x80000515000000E0);
	udelay(50);	
	write64(&bar0->dtx_control,0x80000515D93500E4);
	udelay(50);	

	write64(&bar0->dtx_control,0x8001051500000000);
	udelay(50);	
	write64(&bar0->dtx_control,0x80010515000000E0);
	udelay(50);	
	write64(&bar0->dtx_control,0x80010515001E00E4);
	udelay(50);	

	write64(&bar0->dtx_control,0x8002051500000000);
	udelay(50);	
	write64(&bar0->dtx_control,0x80020515000000E0);
	udelay(50);	
	write64(&bar0->dtx_control,0x80020515F21000E4);
	udelay(50);

[...]

-> this is a loop in disguise.

[...]

		switch(i) {
			case 1:
			write64(&bar0->tx_fifo_partition_0, val64);
			val64 = 0;
			break;
			case 3:
			write64(&bar0->tx_fifo_partition_1, val64);
			val64 = 0;
			break;
			case 5:
			write64(&bar0->tx_fifo_partition_2, val64);
			val64 = 0;
			break;
			case 7:
			write64(&bar0->tx_fifo_partition_3, val64);
			break;

-> please indent (see Documentation/CodingStyle as a general guide).

/*
* New procedure to clear mac address reading problems on Alpha platforms *
*/
void FixMacAddress(nic_t *sp)
{

	XENA_dev_config_t *bar0 = (XENA_dev_config_t *)sp->bar0;

	write64(&bar0->gpio_control,0x0060000000000000);
	udelay(10);
	write64(&bar0->gpio_control,0x0060600000000000);
	udelay(10);

[...]

-> this is a loop in disguise.

* Description:
* Free all queued Tx buffers.
*/
void freeTxBuffers(struct s2io_nic *nic)
{
[...]

			if(skb == NULL) {
				DBG_PRINT(ERR_DBG,"%s: NULL skb ",dev->name);
				DBG_PRINT(ERR_DBG,"in Tx Int\n");
				spin_unlock(&nic->tx_lock);

-> just goto to the normal spin_unlock and avoid an extra return statement.

				return;
			}
			#if DEBUG_ON
			cnt++;
			#endif
			dev_kfree_skb(skb);
			memset(txdp, 0, sizeof(TxD_t));
		}
		#if DEBUG_ON
		DBG_PRINT(INTR_DBG,"%s:forcibly freeing %d skbs on FIFO%d\n",
			dev->name,cnt,i);
		#endif

-> Please factor these #ifdef.

	}
	spin_unlock(&nic->tx_lock);
}

[...]
int s2io_close(struct net_device *dev)

{
	nic_t *sp = (nic_t *)dev->priv;
	XENA_dev_config_t *bar0 = (XENA_dev_config_t *)sp->bar0;
	register u64 val64 = 0;
	u16 cnt=0;

	spin_lock(&sp->isr_lock);
	netif_stop_queue(dev);

/* disable Tx and Rx traffic on the NIC */

	stopNic(sp);

/* If the device tasklet is running, wait till its done before killing it */

	while(atomic_read(&(sp->tasklet_status))) {
		mdelay(100);
	}
	tasklet_kill(&sp->task);

-> this can schedule() while the driver holds a spinlock.

[...]
#ifdef AS_A_MODULE
MODULE_AUTHOR("Raghavendra Koushik <[email protected]>"); MODULE_LICENSE("GPL");
MODULE_PARM(ring_num, "1-" __MODULE_STRING(1) "i"); MODULE_PARM(frame_len, "1-" __MODULE_STRING(8) "i"); MODULE_PARM(ring_len, "1-" __MODULE_STRING(8) "i"); MODULE_PARM(fifo_num, "1-" __MODULE_STRING(1) "i"); MODULE_PARM(fifo_len, "1-" __MODULE_STRING(8) "i"); MODULE_PARM(rx_prio, "1-" __MODULE_STRING(1) "i"); MODULE_PARM(tx_prio, "1-" __MODULE_STRING(1) "i"); MODULE_PARM(latency_timer, "1-" __MODULE_STRING(1) "i"); #endif

-> Probably slowly old-fashioning. See include/linux/moduleparam.h

[...]
static int __devinit
s2io_init_nic(struct pci_dev *pdev,const struct pci_device_id *pre)

{
	nic_t *sp;
	struct net_device *dev;
	char *dev_name="S2IO 10GE NIC";
	int i,j, ret;
	int dma_flag = FALSE;
	u32 mac_up, mac_down;
	u64 val64 = 0, tmp64 = 0;
	XENA_dev_config_t *bar0 = NULL;

	if((ret = pci_enable_device(pdev))) {
		DBG_PRINT(ERR_DBG,"s2io_init_nic: pci_enable_device failed\n");
		return ret;
	}

	if (!pci_set_dma_mask(pdev, 0xffffffffffffffff)) {
		DBG_PRINT(INIT_DBG,"s2io_init_nic: Using 64bit DMA\n");
		dma_flag = TRUE;

		#if defined (XENA_ARCH_64) || (PPC_ARCH64)	
		#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,00)
		if (pci_set_consistent_dma_mask(pdev, 0xffffffffffffffffULL)) {
       			DBG_PRINT(ERR_DBG,"Unable to obtain 64bit DMA for \
					consistent allocations\n");
       			return -ENOMEM;

-> missing pci_disable_device(). You should probably gotoize this part.

[...]

	/* Tx side parameters. */
	if(fifo_num) {
    	sp->config.TxFIFONum = fifo_num;
	} else {
	    sp->config.TxFIFONum = 1;
	}

-> sp->config.TxFIFONum = fifo_num ? fifo_num : 1;

[...]

	/* Rx side parameters. */
	if(ring_num) {
		sp->config.RxRingNum = ring_num;
	} else {
		sp->config.RxRingNum = 1;
	}

-> sp->config.RxRingNum = ring_num ? ring_num : 1;

[...]
/* The features the device supports. */

	dev->features |= NETIF_F_SG|NETIF_F_HW_CSUM;
	if(sp->high_dma_flag == TRUE)
		dev->features |= NETIF_F_HIGHDMA;
	#ifdef NETIF_F_TSO
	dev->features |= NETIF_F_TSO;
	#endif

/* Setting the Tx watch dog timeout value and timer functio. */

	dev->tx_timeout = &s2io_tx_watchdog;
	dev->watchdog_timeo = WATCH_DOG_TIMEOUT;

/* Register Device with OS. */

	if(register_netdev(dev)) {
		DBG_PRINT(ERR_DBG, "Device registration failed\n");
		goto register_failed;
	}

/* Save PCI state. */

	pci_save_state(sp->pdev, sp->config_space);

-> the previous comments add no information.

[...]
init_failed:

	pci_disable_device(pdev);
	pci_release_regions(pdev);
	pci_set_drvdata(pdev, NULL);
	kfree(dev);

-> "free_netdev(dev)"

	return -ENODEV;
}

[...]
static void __exit s2io_rem_nic(struct pci_dev *pdev) {
[...]

	#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,00)
	free_netdev(dev);
	#else
	kfree(dev);
	#endif

-> please take this #ifdef to a common place (start of file/header).

}

int s2io_starter(void)

{
	return pci_module_init(&s2io_driver) ? -ENODEV :0;

-> no ternary operator needed.

--
Ueimor

#36 lore raw
In reply to Leonid Grossman
Quoted 5 lines · Leonid Grossman

Hi all,
Please fund attached a source code for S2io 10GbE adapter (with some disclaimers below).
Send me your comments/suggestions on the source please, and we will address the code changes (if any) in real time.

Would be interesting to see perfomance numbers. BTW, your specs seem to indicate two interesting features:
- Support for up to 32 concurrent PCI-X split transactions
- Adaptive Interrupt Coalescence

can you elaborate on these?

Also indent -kr -i8 may help.

cheers,
jamal

#37 lore raw

Hi Jamal,
Please see answers below.
Thanks, Leonid

Quoted 1 line

Would be interesting to see performance numbers.

Your mileage will vary... Speaking of generic Linux and windows platforms (that can't take advantage of many of the advanced features in the ASIC yet), we have demonstrated 7.5 Gbps on Linux at SC2003, and 7.2 Gbps on Windows at the earlier Gartner show. These numbers are for a 1.5 GHz 2-way Itanium in one-to-many setup via 10GbE switch. Back-to-back numbers between two systems are somewhat lower, pushing 6Gbps. Opteron numbers are surprisingly close, 32-bit systems are slower since FSB is a bottleneck. These numbers are with Jumbos and/or LSO, with 1500 bytes frames performance is much lower... We have a complete matrix that normally goes to customers, but it is not on a generic website yet. The numbers are for TCP benchmarks - Chariot, nttcp, Iometer; raw performance is higher and pushing pci-x 133 theoretical limit. PCI-X 133 bus is still a bottleneck for 10GbE for now, at least till PCI-X 266 systems show up. Hopefully, it will not be long...

In Linux, there are couple performance issues that we see
- transmit performance is noticeably worse than in Windows
- checksum in 2.4 seems to be calculated by the host even if the device enables checksum offload
- Large Send Offload in 2.6 (no LSO in 2.4) give much smaller boost comparing to Windows; on some systems there is no gain from LSO at all.

Quoted 1 line

BTW, your specs seem to indicate two interesting features:

There are several hw features and assists that current Linux driver doesn't have since generic systems can't take advantage of yet.

Quoted 1 line

- Support for up to 32 concurrent PCI-X split transactions

The device can match bridge split capabilities for up to 32 splits, for better PCI-X bus utilization - the bus is a major bottleneck and we are trying to utilize it very efficiently; splits just one part of this.

Quoted 1 line

- Adaptive Interrupt Coalescence

There are several interrupt schemes, in the utilization scheme the device can be programmed to automatically adjust interrupt rate based upon link utilization, independently for tx and rx interrupts. For instance, if the utilization is in single percentage digits then the device can be programmed to get an interrupt per every packet since interrupt rate doesn't matter much; If the utilization gets closer to 100%, it will probably make sense to program device for, say, one interrupt per 200 packets - the number will somewhat vary for different systems and packet sizes.

Quoted 8 lines

can you elaborate on these?

Also indent -kr -i8 may help.

cheers,
jamal

#38 lore raw
Quoted 2 lines · On Fri, 23 Jan 2004 21:10:28 -0800 "Leonid Grossman"…

In Linux, there are couple performance issues that we see
- transmit performance is noticeably worse than in Windows

In Linux 2.6 with TSO?

Other than that I would suggest to enable oprofile on 2.6 and post the profile numbers on the list.

Quoted 2 lines

- checksum in 2.4 seems to be calculated by the host even if the device enables checksum offload

You have to use sendfile() for TX checksum off load. Without that the data needs to be copied anyways and a copy+csum is about the same cost as a simple copy.

Quoted 2 lines

- Large Send Offload in 2.6 (no LSO in 2.4) give much smaller boost comparing to Windows; on some systems there is no gain from LSO at all.

You mean TSO? Are you sure the test programs submitted big enough buffers to the TCP stack?

-Andi

#39 lore raw

Leonid,

What would also be interesting to see is a packet that never leaves the kernel such is in forwarding. If theres a way you can stash two of those cards in a box and just have them forward packets coming in from one to another - would be nice to see the numbers with varying packet size example { 64,256,512,1518, 4K, 9K}

cheers,
jamal

#43 lore raw
In reply to Leonid Grossman
Quoted 12 lines · Leonid Grossman
Quoted 1 line

- Adaptive Interrupt Coalescence

There are several interrupt schemes, in the utilization scheme the device can be programmed to automatically adjust interrupt rate based upon link utilization, independently for tx and rx interrupts. For instance, if the utilization is in single percentage digits then the device can be programmed to get an interrupt per every packet since interrupt rate doesn't matter much; If the utilization gets closer to 100%, it will probably make sense to program device for, say, one interrupt per 200 packets - the number will somewhat vary for different systems and packet sizes.

How effective is this?
Example you could easily fill up a link with larger packets (less interupts) than with smaller packets (more interupts). The latter overloads the system more.
getting feedback from the system (which you can in Linux) and adjusting the rate that way would be more effective it seems. Adjusting interupt rates based on a moving window averaging of the packet arrival rate would also be useful.

cheers,
jamal

#40 lore raw
In reply to jamal
Quoted 10 lines

Leonid,

What would also be interesting to see is a packet that never leaves the kernel such is in forwarding. If theres a way you can stash two of those cards in a box and just have them forward packets coming in from one to another - would be nice to see the numbers with varying packet size example { 64,256,512,1518, 4K, 9K}

Quoted 2 lines

cheers,
jamal

Hi Jamal,
Are you suggesting to run a benchmark between two back-to-back hosts, and then run the same benchmark between the two hosts via a third box (with two 10GbE cards) that would just forward traffic, and compare the results?
Or you had a different setup in mind?
Not sure what the application for something like this would be (I think 10GbE will be mainly deployed in a datacenter for a while), but we can probably run something like that and get the numbers; I'll let you know.

Thanks, Leonid

#44 lore raw
In reply to jamal
Quoted 22 lines

-----Original Message-----
From: jamal [mailto:[email protected]]
Sent: Saturday, January 24, 2004 10:00 AM
To: Leonid Grossman
Cc: [email protected]
Subject: RE: FW: Submission for S2io 10GbE driver

Quoted 4 lines · Leonid Grossman
Quoted 1 line

- Adaptive Interrupt Coalescence

There are several interrupt schemes, in the utilization scheme the device can be programmed to automatically adjust interrupt

rate based

Quoted 2 lines

upon link utilization, independently for tx and rx interrupts. For instance, if the utilization is in single percentage digits

then the

Quoted 2 lines

device can be programmed to get an interrupt per every packet since interrupt rate doesn't matter much; If the utilization gets

Quoted 7 lines

closer to

Quoted 4 lines

100%, it will probably make sense to program device for, say, one interrupt per 200 packets - the number will somewhat vary for different systems and packet sizes.

How effective is this?

Today with a legacy pin iterrupts it's reasonably efective, and I have higher hopes for MSI and MSI-X when systems and the OS starts supporting it.

Quoted 5 lines

Example you could easily fill up a link with larger packets (less interupts) than with smaller packets (more interupts). The latter overloads the system more.
getting feedback from the system (which you can in Linux) and adjusting the rate that way would be more effective it seems.

These schemes could be complimentary, right now we do see that different thresholds need to be programmed for regular and Jumbo traffic.

One thing I did not mention is that our ASIC supports several utilization thresholds on per interrupt basis (up to 64 MSI-X interrupts). There are also independent tx and rx queues, and each can have it's own interrupt. There is a pretty large number of parameters that traffic could be steered upon, packet size is one of them.

So, if you want to have different interrupt moderation schemes for different packet sizes, you just need to steer packets to separate queues based upon size, and then assign a separate MSI interrupt to these queues and set different utilization thresholds for different interrupts. At any given workload, you will be getting interrupts at different rate for small and for big packets.

Anyway, you are right there are many interrupt moderation schemes that host driver can deploy, our goal was to provide a flexible hardware assist.

Thanks, Leonid

Quoted 6 lines

Adjusting interupt rates based on a moving window averaging of the packet arrival rate would also be useful.

cheers,
jamal

#42 lore raw
In reply to Andi Kleen
Quoted 5 lines
Quoted 3 lines

In Linux, there are couple performance issues that we see
- transmit performance is noticeably worse than in Windows

In Linux 2.6 with TSO?

You are right, sorry.. It's TS0 not LSO in Linux and Unix. After doing first ndis Send offload implementation back at Alteon, LSO acronym got engraved into my brain :-)

Quoted 3 lines

Other than that I would suggest to enable oprofile on 2.6 and post the profile numbers on the list.

Will do. Also - it's a bit embarrassing to admit but I suspect 2.6 installations that my test and development teams do are still more art than science, I'm not sure we always end up with a trusted setup. Could someone point me towards a good description of upgrading to 2.6 kernel, either from RH AS 3.0 or from Suse distribution?

Quoted 7 lines
Quoted 3 lines

- checksum in 2.4 seems to be calculated by the host even if the device enables checksum offload

You have to use sendfile() for TX checksum off load. Without that the data needs to be copied anyways and a copy+csum is about the same cost as a simple copy.

We've done couple quick tests on this recently with benchmarking software - Chariot has some scripts that use sendfile(), and also one of nttcp versions has -f option. In both cases, using sendfile() did not seem to improve the maximum send performance on 10GbE; we are planning to do some more testing though...

Quoted 7 lines
Quoted 4 lines

- Large Send Offload in 2.6 (no LSO in 2.4) give much smaller boost comparing to Windows; on some systems there is no gain from LSO at all.

You mean TSO? Are you sure the test programs submitted big enough buffers to the TCP stack?

The driver is definitely getting large send requests, if this is what you are asking. Our testing with 2.6 up to date is pretty limited, but on some server configurations we see some noticeable performance gain from TSO (the gain is smaller than from LSO in Windows though), on other setups performance with TSO enabled is the same or even less that without TSO enabled.

Thanks for the advice, looks like we have couple things to try. Regards, Leonid

Quoted 4 lines

-Andi

#41 lore raw
In reply to Leonid Grossman
Quoted 11 lines · Leonid Grossman
Quoted 9 lines

What would also be interesting to see is a packet that never leaves the kernel such is in forwarding. If theres a way you can stash two of those cards in a box and just have them forward packets coming in from one to another - would be nice to see the numbers with varying packet size example { 64,256,512,1518, 4K, 9K}

cheers,
jamal

Quoted 6 lines

Hi Jamal,
Are you suggesting to run a benchmark between two back-to-back hosts, and then run the same benchmark between the two hosts via a third box (with two 10GbE cards) that would just forward traffic, and compare the results?
Or you had a different setup in mind?

Just a simple test for packets that dont cross user space - kernel boundary. Example forwarding of some form where a packet comes in, data gets touched (ttl, csum etc) and gets forwarded to the egress port. The setup will include a single box with two NICs; one connected to a traffic generator source the other to a sink which records stats. The interesting measurements will packet latency and throughput. Get a off the shelf traffic generator like an IXIA (pktgen may be used too); i.e forget ttcp and relatives.
For starters you could even have a packet coming in and being DMAed to the otehr NIC untouched.

Quoted 4 lines

Not sure what the application for something like this would be (I think 10GbE will be mainly deployed in a datacenter for a while), but we can probably run something like that and get the numbers; I'll let you know.

Apps would be any middle box (router, firewall, accounting etc). Interest is more from a linux side what can we do to improve things.

cheers,
jamal

#45 lore raw
In reply to Leonid Grossman
Quoted 9 lines · Leonid Grossman

These schemes could be complimentary, right now we do see that different thresholds need to be programmed for regular and Jumbo traffic.

One thing I did not mention is that our ASIC supports several utilization thresholds on per interrupt basis (up to 64 MSI-X interrupts). There are also independent tx and rx queues, and each can have it's own interrupt. There is a pretty large number of parameters that traffic could be steered upon, packet size is one of them.

Would be interesting to see what these queue selection parameters are. For example, an extremely important thing to avoid is reordering of packets. You reorder packets on a TCP flow and you perfomance goes beserk.

Quoted 6 lines

So, if you want to have different interrupt moderation schemes for different packet sizes, you just need to steer packets to separate queues based upon size, and then assign a separate MSI interrupt to these queues and set different utilization thresholds for different interrupts. At any given workload, you will be getting interrupts at different rate for small and for big packets.

Does sound interesting, but i am suspcious about reordering; i.e you dont want a 64 byte packet from one flow to be in a different queue than another which is 1500 bytes. The 2 packet must be processed strictly in FIFO manner.

Quoted 3 lines

Anyway, you are right there are many interrupt moderation schemes that host driver can deploy, our goal was to provide a flexible hardware assist.

So is it possible to program it such that if a threshold interupt rate is crossed it adjusts its mitigation values? actually i should say its the second order effect that is of interest to the threshold i.e the integral of the interupt arrival rate.

cheers,
jamal

#5 lore raw
In reply to Stephen Hemminger

Hi Stephen,
Below are responses from our developer.

Thanks for the input, Leonid

Quoted 10 lines

-----Original Message-----
From: Stephen Hemminger [mailto:[email protected]]
Sent: Friday, January 23, 2004 4:22 PM
To: Andi Kleen
Cc: Leonid Grossman; [email protected]
Subject: Re: Submission for S2io 10GbE driver

Noticed the setup loopback test seems to register for a packet type and then forget to unregister that type!

The packet type gets unregistered at the end of the test in the 'reset_loopback'
function through the system call 'dev_remove_pack()'

Quoted 6 lines

Also nothing really restricts the packet type to only coming in on the expected interface; therefore if someone sends the same packet in over another interface, then sp->loop_pkt_cnt will end up incrementing some other drivers private data structure *bad*.

Correct, that's why in the s2io.c source where I define the packet_type's protocol value
through the Macro 'ETH_LOOP_TEST_TYPE' there's a ToDo to obtain a private protocol ID.
This way no app in the real world can ever pass a frame with that T/L field in the packet.
Also, the problem can only happen during the 3 second duration when this test is in progress.

Quoted 3 lines

IMHO the whole loopback test frame stuff seems like something in a test bed driver, not production code.

The loopback test is there as a part of the ethtool's diagnostic option.

There are pros and cons of having the test in there I guess, anyone else has an opinion on this?

Do other net drivers normally support loopback and other diag tests as a part of the ethtool support,
or they provide little/no support for the option and ship a standalone diag program instead?

Thanks, Leonid

Quoted 1 line
#6 lore raw
Quoted 10 lines · Leonid Grossman

The loopback test is there as a part of the ethtool's diagnostic option.

There are pros and cons of having the test in there I guess, anyone else has an opinion on this?

Do other net drivers normally support loopback and other diag tests as a part of the ethtool support,
or they provide little/no support for the option and ship a standalone diag program instead?

The ethtool diag stuff is more of a quick sanity test than anything exhaustive.

I definitely want to discourage tons of test code in drivers, as its code that users will almost-never run, it bloats the driver, and can be done with a special diag-only driver or diag program (or a combination of both).

A lot of the 10/100 drivers originated from Donald Becker, who typically creates a userland (i.e. separate) diag program for each driver he writes.

Jeff

#7 lore raw
Quoted 13 lines

The ethtool diag stuff is more of a quick sanity test than anything exhaustive.

I definitely want to discourage tons of test code in drivers, as its code that users will almost-never run, it bloats the driver, and can be
done with a special diag-only driver or diag program (or a combination
of both).

Quoted 4 lines

A lot of the 10/100 drivers originated from Donald Becker, who typically
creates a userland (i.e. separate) diag program for each driver he writes.

I see the point; we'll go ahead and get rid of the loopback. We actually have pretty extensive standalone diag tool that is based on diag driver.

Thanks, Leonid

Quoted 5 lines

Jeff

#8 lore raw
In reply to Andi Kleen
Quoted 7 lines

All the ARCH_PPC64 ifdefs shouldn't be needed. Can you remove that? If there are problems in ppc64 code they should be fixed there, not worked around. Same with the ifdefs for kernel 2.6 features. An driver integrated into the kernel should not contain such ifdefs.

Hi Andi,
You are right some of the ifdefs are not needed and we are removing these; it is not clear if we can get rid of all of them for the following reasons:

1) We did't find quad word memory operations(writeq and readq) on PCI bus for PPC64 architecture.

2) We did't had a chance to test the driver on other big endian systems apart from PPC64. In PPC64 architecture though,
I write/read a value to/from ioremaped address it swaps the value and behaves like a little endian m/c:

For ex: if I do writel(0x12345678, addr) then in it writes
addr: 78, (addr+1):56, (addr+2):34, (addr+3):12

On a little endian m/c like IA32 also writel writes same values in a similar manner as shown above.
So the question is -
Do all big endian machines with linux OS swap the values and write in little endian format??

3)In PPC64 architecture dma_addr_t is u32, unlike remaining 64 bit architectures where it is defined as u64. Because
of this we have to deal separately for PP64.
So any suggestions will be useful, .i.e. generally how PPC64 developers deal with this?

Say if we have some structure corresponding to memory region of our hardware device which should be of 16 bytes.

struct hw {
dma_addr_t phys;
char *virt;
#ifdef ARCH32
u64 dummy;
#endif
}

Then above definition will not work for PPC64, we need to modify it like this:
struct hw {
dma_addr_t phys;
char *virt;
#ifdef ARCH32
u64 dummy;
#endif
#ifdef ARCH_PPC64
u32 dummy;
#endif
}

#9 lore raw
Quoted 2 lines · Leonid Grossman

1) We did't find quad word memory operations(writeq and readq) on PCI bus for PPC64 architecture.

I would consider that a bug in the PPC64 port. You can submit a patch to add a readq/writeq implementation using 32-bit ops if the PCI Host controller doesn't support 64-bit transactions. This doesn't always work since two 32-bit writes to a 64-bit register is not the same as one 64-bit write. Your HW needs to be aware of that if you want to support that platform.

Quoted 7 lines

2) We did't had a chance to test the driver on other big endian systems apart from PPC64. In PPC64 architecture though,
I write/read a value to/from ioremaped address it swaps the value and behaves like a little endian m/c:

For ex: if I do writel(0x12345678, addr) then in it writes
addr: 78, (addr+1):56, (addr+2):34, (addr+3):12

...

Quoted 5 lines

On a little endian m/c like IA32 also writel writes same values in a similar manner as shown above.
So the question is -
Do all big endian machines with linux OS swap the values and write in little endian format??

Yes - I believe so.
There are ways to avoid the byte swap but I'm really not keen on advocating this path. byte swapping is so much cheaper than the PIO Reads, it just doesn't make sense to obfuscate the code most of the time.

Quoted 3 lines

3)In PPC64 architecture dma_addr_t is u32, unlike remaining 64 bit architectures where it is defined as u64. Because of this we have to deal separately for PP64.

You shouldn't be using dma_addr_t for layout of data structures shared with the card. Several architectures *only* use 32-bit DMA addresses (IOMMU for all DMA). It makes sense on those architectures to define dma_addr_t as u32.
Try "fgrep dma_addr_t include/asm*/* | fgrep typedef" on linux-2.6 tree.

Quoted 2 lines

So any suggestions will be useful, .i.e. generally how PPC64 developers deal with this?

Only use dma_addr_t to map data and not to define data structures consumed by the card.

Some history from my perspective:
Fri, 9 Feb 2001, I started a discussion on [email protected] mailing list on exactly this issue for linux-2.4. At the time Dave Miller "owned" DMA interface and insisted dma_addr_t be u32.
He offered dma64_addr_t would be introduced in linux-2.5. So far so good.

The only problem was IA64 was already defining dma_addr_t as u64 and mips was using "unsigned long".

Issue came up again on linux-kernel/linux-ia64 Feb 6, 2002. (Subject: Proper fix for sym53c8xx_2 driver and dma64_addr_t) It was pretty clear pci_dac_XXX() was the "preferred" interface to use. But it made it impossible for a driver to support multiple chips that supported both.

Somewhere along the line, I think with more thrashing about on pci_set_dma_mask(), it was decided it was ok for dma_addr_t to be u64 on architectures that supported it.

Last step into this mess was "64 Bits DMA Addresses for Alloc Consistent Interfaces" thread started by SGI. Altix box needed it in order to support PCI-X devices in PCI-X mode. (15 May 2003)
This resulted in "pci_set_consistent_dma_mask()" interface in order to change the dma_mask for pci_alloc_consistent() calls. AlexW just submitted support for this a week or two ago to 2.6 kernel.

Quoted 2 lines

Say if we have some structure corresponding to memory region of our hardware device which should be of 16 bytes.

...

Quoted 4 lines

Then above definition will not work for PPC64, we need to modify it like this:
struct hw {
dma_addr_t phys;

Quoted 8 lines

char *virt;
#ifdef ARCH32
u64 dummy;
#endif
#ifdef ARCH_PPC64
u32 dummy;
#endif
}

Use "u64 phys" and it will always be correct.

And "char * virt" has the same problem. "char *" will vary in size depending arch (ILP32 vs LP64 data model) as well. You did claim this code worked on i386, ia64 and PPC64, right?

hth,
grant

#10 lore raw
Quoted 5 lines

Use "u64 phys" and it will always be correct.

And "char * virt" has the same problem. "char *" will vary in size depending arch (ILP32 vs LP64 data model) as well. You did claim this code worked on i386, ia64 and PPC64, right?

Yes (Opteron platforms too).
Thanks for the input!
Leonid

Quoted 4 lines

hth,
grant

#26 lore raw
In reply to Leonid Grossman
Quoted 9 lines · On Wed, 4 Feb 2004 12:44:21 -0800 "Leonid Grossman" <[email protected]>…
Quoted 7 lines

All the ARCH_PPC64 ifdefs shouldn't be needed. Can you remove that? If there are problems in ppc64 code they should be fixed there, not worked around. Same with the ifdefs for kernel 2.6 features. An driver integrated into the kernel should not contain such ifdefs.

Quoted 7 lines

Hi Andi,
You are right some of the ifdefs are not needed and we are removing these; it is not clear if we can get rid of all of them for the following reasons:

1) We did't find quad word memory operations(writeq and readq) on PCI bus for PPC64 architecture.

That's a bug in ppc64 then. Can you complain to them?

I would go ahead and just use them in the driver unconditionally and wait for the ppc64 to fix it. Or just add them there, it's probably simple.

Quoted 7 lines

2) We did't had a chance to test the driver on other big endian systems apart from PPC64. In PPC64 architecture though,
I write/read a value to/from ioremaped address it swaps the value and behaves like a little endian m/c:

For ex: if I do writel(0x12345678, addr) then in it writes
addr: 78, (addr+1):56, (addr+2):34, (addr+3):12

Hmm, weird. Don't know, ask the ppc64 people.

Quoted 5 lines

On a little endian m/c like IA32 also writel writes same values in a similar manner as shown above.
So the question is -
Do all big endian machines with linux OS swap the values and write in little endian format??

I hope not.

Quoted 5 lines

3)In PPC64 architecture dma_addr_t is u32, unlike remaining 64 bit architectures where it is defined as u64. Because
of this we have to deal separately for PP64.
So any suggestions will be useful, .i.e. generally how PPC64 developers deal with this?

You could just use u64 in your structure definitions for now.

-Andi

#27 lore raw
Quoted 7 lines
Quoted 3 lines

1) We did't find quad word memory operations(writeq and readq) on PCI bus for PPC64 architecture.

That's a bug in ppc64 then. Can you complain to them? I would go ahead and just use them in the driver unconditionally and wait for the ppc64 to fix it. Or just add them there, it's probably simple.

Yep ppc64 should define them. If you are submitting a driver for inclusion in 2.6 leave these bits out, its my fault they arent defined and I'll get them added in.

Turns out lots of architectures are missing these, I'll fire an email off to linux-arch about it.

Quoted 7 lines
Quoted 5 lines

On a little endian m/c like IA32 also writel writes same values in a similar manner as shown above.
So the question is -
Do all big endian machines with linux OS swap the values and write in little endian format??

I hope not.

Thats how all big endian platforms work. in* and out*, read* and write* byteswap.

Quoted 7 lines
Quoted 5 lines

3)In PPC64 architecture dma_addr_t is u32, unlike remaining 64 bit architectures where it is defined as u64. Because
of this we have to deal separately for PP64.
So any suggestions will be useful, .i.e. generally how PPC64 developers deal with this?

You could just use u64 in your structure definitions for now.

Its up to the architecture as to what a dma_addr_t looks like. On our current machines we only support operating through the IOMMU, so all PCI bus address are in fact 32bit. Most drivers dont care how big a dma_addr_t is, is there something you are doing that does?

Anton

#28 lore raw
Quoted 4 lines
Quoted 4 lines
Quoted 3 lines

1) We did't find quad word memory operations(writeq and readq) on PCI bus for PPC64 architecture.

Quoted 8 lines
Quoted 2 lines

That's a bug in ppc64 then. Can you complain to them? I would go ahead and just use them in the driver unconditionally and

wait for the

Quoted 1 line

ppc64 to fix it. Or just add them there, it's probably simple.

Yep ppc64 should define them. If you are submitting a driver for inclusion in 2.6 leave these bits out, its my fault they arent defined and I'll get them added in.

Hi Anton,
We are submitting for inclusion in 2.6 kernel but we'd like to have same code for
2.4 kernels as well, most our customers will stay with 2.4 for a while... If you add the bits to 2.6, we would still need a solution for 2.4 kernel.

Quoted 11 lines
Quoted 1 line
Quoted 1 line

On a little endian m/c like IA32 also writel writes same

values in a

Quoted 2 lines
Quoted 2 lines

similar manner as shown above. So the question is - Do all big endian machines with linux OS swap the values

and write in

Quoted 3 lines
Quoted 1 line

little endian format??

I hope not.

Thats how all big endian platforms work. in* and out*, read* and write* byteswap.

So, we should make the code big endian specific rather than PPC64 specific, right?

Thanks, Leonid

#29 lore raw
Quoted 6 lines

We are submitting for inclusion in 2.6 kernel but we'd like to have same code for
2.4 kernels as well, most our customers will stay with 2.4 for a while... If you add the bits to 2.6, we would still need a solution for 2.4 kernel.

OK, It should be easy to get the readq/writeq macros put into 2.4 as well.

Quoted 5 lines
Quoted 2 lines

Thats how all big endian platforms work. in* and out*, read* and write* byteswap.

So, we should make the code big endian specific rather than PPC64 specific, right?

Well there are non byteswapping versions on some architectures (__raw_read*/__raw_write*). However at least on ppc32 they dont contain memory barriers so you could into trouble using them.

What does your code look like? You could key off __BIG_ENDIAN if you really need to. Is it performance critical?

Anton

#30 lore raw
Quoted 3 lines · Anton Blanchard

Well there are non byteswapping versions on some architectures (__raw_read*/__raw_write*). However at least on ppc32 they dont contain memory barriers so you could into trouble using them.

FWIW the __raw_xxx are not supposed to contain memory barriers. That's for when the driver writer decides he is smart enough to do the byte swapping and barriers himself, for possibly increased speed :)

Jeff

#31 lore raw
In reply to Leonid Grossman
Quoted 5 lines · Leonid Grossman
Quoted 1 line

Thats how all big endian platforms work. in* and out*, read* and write* byteswap.

So, we should make the code big endian specific rather than PPC64 specific, right?

{read,write}[bwlq] should work the same regardless of whether its big endian or little endian. The rule is "PCI is defined to be little endian". On little endian platforms, no byte swapping occurs. On big endian platforms, the platform will byteswap. Thus, the driver should not have big-endian-specific or PPC64-specific code...

(you still have to do your own byteswapping for DMA)

Jeff

#32 lore raw
Quoted 5 lines

{read,write}[bwlq] should work the same regardless of whether its big endian or little endian. The rule is "PCI is defined to be little endian". On little endian platforms, no byte swapping occurs. On big endian platforms, the platform will byteswap. Thus,

the

Quoted 3 lines

driver should not have big-endian-specific or PPC64-specific code... (you still have to do your own byteswapping for DMA)
Jeff

Hi Jeff,

It looks like for the swapper issue we can get rid of PPC64-specific code, but not necessarily of big-endian-specific code.
The behavior you describe is generic for Linux but not for the platform
- on the same box, another OS will not byteswap, for example on the same pSeries box AIX will not byteswap while Linux will.

So, our ASIC is designed in a way that for a big endian machine the swapper control need not be touched, and for little endian box both register and DMA accesses have to be configured to swap - it would be nice to have the same configuration working on all systems, but this did not seem possible.

So, for Linux we configure the ASIC to byteswap register access for both big and little endian boxes.
For DMA (as you pointed out) we need to configure the ASIC to do our own byteswap, so this init code (or rather just a config parameter) will be different on big and little endian machine.
Another small difference will be that the ASIC has actually slightly different statistic counters for big and little endian.
We can move these (very few) big/little definition into a header file so the source itself is clean, but I don't see a way to completely get rid of these...

Also, looks like we can get rid of all PPC64-specific stuff. Thanks to everybody who pointed toward a solution (and/or promised to fix PPC :-)).

Leonid

#33 lore raw
Quoted 2 lines · Leonid Grossman

It looks like for the swapper issue we can get rid of PPC64-specific code, but not necessarily of big-endian-specific code.

right

Quoted 3 lines

The behavior you describe is generic for Linux but not for the platform
- on the same box, another OS will not byteswap, for example on the same pSeries box AIX will not byteswap while Linux will.

While I understand the desire to share the same driver across OSs, providing "glue" code like sym53c8xx_2 drivers does can be very ugly. You might look at that driver a bit and try to compare 2.4 vs 2.6.

Quoted 5 lines

So, our ASIC is designed in a way that for a big endian machine the swapper control need not be touched, and for little endian box both register and DMA accesses have to be configured to swap - it would be nice to have the same configuration working on all systems, but this did not seem possible.

It's probably not. It sounds like the Tigon2 driver (acenic) which has similar HW support. You see how endianess is handled there.

...

Quoted 5 lines

Another small difference will be that the ASIC has actually slightly different statistic counters for big and little endian.
We can move these (very few) big/little definition into a header file so the source itself is clean, but I don't see a way to completely get rid of these...

that's ok I think.

cheers,
grant

#34 lore raw
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Grant" == Grant Grundler <[email protected]> writes:

Grant> On Thu, Feb 05, 2004 at 02:09:09PM -0800, Leonid Grossman

Quoted 5 lines · Grant> wrote:
Quoted 5 lines

So, our ASIC is designed in a way that for a big endian machine the swapper control need not be touched, and for little endian box both register and DMA accesses have to be configured to swap - it would be nice to have the same configuration working on all systems, but this did not seem possible.

Grant> It's probably not. It sounds like the Tigon2 driver (acenic) Grant> which has similar HW support. You see how endianess is handled Grant> there.

Grant,

I have a feeling Leonid is fairly familiar with the acenic design ;-)

But yes it's very similar, I made the same mistake originally in the acenic driver trying to set different swap modes for little vs big endian.

Cheers,
Jes

#11 lore raw
In reply to Grant Grundler

Hi all,
Attached is the second submission for our 10GbE Adapter.

Many thanks for the input; I believe we have addressed all the comments to date (I cc everybody who helped us with the comments, to make sure their concerns have been addressed).

s2io_linux_drv_submission02.tar : Contains the new driver source files s2io_linux_drv_patches.tar : Contains the patch files that can be applied on the files we originally submitted.

All the utilities/diagnostics/tuning scripts are removed from the submission.

Also, couple questions -

1. At the moment, lspci output looks like
"02:02.0 Ethernet controller: Unknown device 17d5:5831 (rev 02)"; do we need to submit a patch for drivers/pci/pci.ids?

2. The card fully supports Ethernet and TCP header separation in hardware (so called receive 3-buffer mode).
The mode may have some performance advantages but so far we did not implement the mode in Linux since it seems that Linux stack can't handle the fragmented buffers in the receive path. Is this a correct assumption, does receive buffer has to be continuous?

Thanks, Leonid

#12 lore raw
Quoted 3 lines · Leonid Grossman

1. At the moment, lspci output looks like
"02:02.0 Ethernet controller: Unknown device 17d5:5831 (rev 02)"; do we need to submit a patch for drivers/pci/pci.ids?

http://pciids.sourceforge.net/

The file drivers/pci/pci.ids is only associated with /proc/pci strings, and I'm trying to deprecate it :)

Quoted 6 lines

2. The card fully supports Ethernet and TCP header separation in hardware (so called receive 3-buffer mode).
The mode may have some performance advantages but so far we did not implement the mode in Linux since it seems that Linux stack can't handle the fragmented buffers in the receive path. Is this a correct assumption, does receive buffer has to be continuous?

In theory, the skb can be fragmented. I'm not as much as an expert in the ipv4/tcp/socket levels of the net stack, but I don't recall any place that yet supports skb frags on receive?

I think that's likely an area that would need some minor adjustments/additions in the upstream kernels, but not major surgery, since the skb already supports creating, noticing, and freeing frags.

Jeff

#13 lore raw
Quoted 4 lines

http://pciids.sourceforge.net/
The file drivers/pci/pci.ids is only associated with /proc/pci strings,

and I'm trying to deprecate it :)

Done, thanks for the pointer!

Quoted 11 lines
Quoted 6 lines

2. The card fully supports Ethernet and TCP header separation in hardware (so called receive 3-buffer mode). The mode may have some performance advantages but so far we did not implement the mode in Linux since it seems that Linux stack can't handle the fragmented buffers in the receive path. Is this a correct assumption, does receive buffer has to be continuous?

In theory, the skb can be fragmented. I'm not as much as an expert in the ipv4/tcp/socket levels of the net stack, but I don't recall any place that yet supports skb frags on receive?

Quoted 5 lines

I think that's likely an area that would need some minor adjustments/additions in the upstream kernels, but not major surgery, since the skb already supports creating, noticing, and freeing frags.

Jeff

I think it will be a good idea to have full support for skb frags in general, and not just for our product.

Please let me know if there is a consensus (and hopefully a timeframe :-) for this;
We volunteer to implement the mode in our driver and test the solution.

Leonid

#14 lore raw
In reply to Leonid Grossman

A bunch of comments:

- if you want to submit the driver for inclusion please submit a patch against a kernel tree, not a tarball.
- please try to avoid version ifdefs by provoding the newer APIs on older kernels, e.g.:

#ifndef IRQ_RETVAL
#define irqreturn_t void
#define IRQ_RETVAL(foo)
#endif

#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,00)
#define free_netdev kfree
#endif

- your AS_A_MODULE ifdef is bogs - everything under it is fine for a non-modular driver, too
- your XENA_ARCH_64 is not good - just cast 64bit values to (unsigned long long) always and use the ll format specifier always. You missed a few 64bit arches, btw :)
- can you get rid of all those BOOL/TRUE/FALSE/SUCCESS/etc.. ifdefs?
- s2io_driver wants to be converted to C99 initializers (.foo instead of foo:)
- In Linux comments usually are on the same indentation level as surrounding code
- CONFIGURE_NAPI_SUPPORT should probably become CONFIG_XENA_NAPI or whatever
- you want to use ethtool_ops instead of the ioctl variant
- there's lots of non-static symbols in s2io.c - these shouldn't exist in a single source-file driver
- you can't return -ENOMEM from the isr - just IRQ_HANDLED or IRQ_NONE
- having the RCS log at the end of the source files looks ... odd

#15 lore raw
Quoted 6 lines · On Tue, 17 Feb 2004 00:11:12 +0000 Christoph Hellwig <[email protected]> wrote:

A bunch of comments:

- if you want to submit the driver for inclusion please submit a patch against a kernel tree, not a tarball.
- please try to avoid version ifdefs by provoding the newer APIs on older kernels, e.g.:

Quoted 8 lines

#ifndef IRQ_RETVAL
#define irqreturn_t void
#define IRQ_RETVAL(foo)
#endif

#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,00)
#define free_netdev kfree
#endif

The proper way for that is:

#ifndef HAVE_FREE_NETDEV
#define free_netdev(x) kfree(x)
#endif

#16 lore raw

Submission #3 for S2io 10GbE driver

In reply to Christoph Hellwig

Hi all,
Attached is a patch file for the driver that addresses (hopefully :-)) all the comments we received for the submission #2.
As always, thanks for everybody who took the time and effort to suggest improvements to our code.

This consists of a S2io folder in the ~/drivers/net folder and an enhanced
Kconfig file also in the same folder. The Kconfig file now reflects the S2IO and S2IO_NAPI config
and help details. Also the s2io source files in the s2io folder no longer contain the CVS messages
that get inserted during CVS commits.

As a side note, we've done more performance testing on the 2.6 kernel and I'd like to retract my earlier comment about marginal benefits of Linux TSO support.
At least with the latest kernel, we are getting extra ~8% transmit performance with large send offload; this is very much in line with results on other operating systems.

Regards, Leonid

drivers/net/Kconfig +12 -0
diff -urN vanilla-linux/drivers/net/Kconfig vanilla-linux-patch/drivers/net/Kconfig
@@ -2058,6 +2058,18 @@
 	bool "Use Rx Polling (NAPI) (EXPERIMENTAL)"
 	depends on IXGB && EXPERIMENTAL
 
+config S2IO
+	tristate "S2IO 10Gbe XFrame NIC"
+	depends on PCI
+	---help---
+	  This driver supports the 10Gbe XFrame NIC of S2IO. 
+	  For help regarding driver compilation, installation and 
+	  tuning please look into ~/drivers/net/s2io/README.txt.
+
+config S2IO_NAPI
+	bool "Use Rx Polling (NAPI) (EXPERIMENTAL)"
+	depends on S2IO && EXPERIMENTAL
+
 endmenu
 
 
drivers/net/s2io/Makefile +91 -0

91 lines not on this page · raw message

drivers/net/s2io/README.txt +55 -0

55 lines not on this page · raw message

drivers/net/s2io/regs.h +775 -0

775 lines not on this page · raw message

drivers/net/s2io/s2io.c +4436 -0

2,061 lines not on this page · raw message

drivers/net/s2io/s2io.h +832 -0

832 lines not on this page · raw message

drivers/net/s2io/sysctl_xframe.conf +21 -0
diff -urN vanilla-linux/drivers/net/s2io/sysctl_xframe.conf vanilla-linux-patch/drivers/net/s2io/sysctl_xframe.conf

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Part of the diff is not shown here. View the raw message.

#17 lore raw

Re: Submission #3 for S2io 10GbE driver

Looking a lot better. A few merge issues remain, and some operational ones as well. There are 39 issues in this review, but IMO they are mostly minor issues that don't require much thought or work.

Comments:

0) to repeat myself from an earlier review... grumble...
You CANNOT use NETIF_F_HW_CSUM, when your hardware does not provide the checksum value. You must use NETIF_F_IP_CSUM. Your use of NETIF_F_HW_CSUM + CHECKSUM_UNNECESSARY is flat out incorrect.

1) the makefile is for out-of-tree stuff. The proper makefile will be much smaller. So just submit a proper in-tree Makefile.

2) (in general) we don't want the compatibility stuff in-tree, that's for out-of-tree as well.

3) just submit a patch to include/linux/pci_ids.h instead of the following

+/* VENDOR and DEVICE ID of XENA. */
+#ifndef PCI_VENDOR_ID_S2IO

+#define PCI_VENDOR_ID_S2IO      0x17D5
+#define PCI_DEVICE_ID_S2IO_WIN  0x5731
+#define PCI_DEVICE_ID_S2IO_UNI  0x5831

+#endif

4) just delete the SET_NETDEV_DEV(), FREE_NETDEV, and IRQ_NONE compatibility defines. these are in 2.4 just like 2.6.

5) Many PCI posting bugs remain. FixMacAddress is an excellent illustration:

+       write64(&bar0->gpio_control, 0x0040600000000000ULL);
+       udelay(10);
+       write64(&bar0->gpio_control, 0x0000600000000000ULL);
+       udelay(10);
+       write64(&bar0->gpio_control, 0x0020600000000000ULL);
+       udelay(10);
+       write64(&bar0->gpio_control, 0x0060600000000000ULL);
+       udelay(10);

The delay is _not_ guaranteed at all, because you do not know when that write64() will actually be sent to the PCI bus. Only a read[bwl,64] is guaranteed to flush the write to the PCI device.

So, the above code does not function as you would expect, on all platforms.

6) More examples of PCI posting bugs, in startNic:

+       write64(&bar0->mc_rldram_mrs, val64);
+       set_current_state(TASK_UNINTERRUPTIBLE);
+       schedule_timeout(HZ / 10);

and

+       write64(&bar0->dtx_control, 0x8007051500000000ULL);
+       udelay(50);
+       write64(&bar0->dtx_control, 0x80070515000000E0ULL);
+       udelay(50);
+       write64(&bar0->dtx_control, 0x80070515001F00E4ULL);
+       udelay(50);

7) for fragmented skb's, you should be using pci_map_page() not pci_map_single(). Example in drivers/net/tg3.c.

8) (style) in alarmIntrHandler, due to line wrapping, Lindent has rendered the 'do' loop rather unreadable.

9) you cannot sleep inside the interrupt handler. Therefore the schedule_timeout() in alarmIntrHandler is very wrong.

10) never use a plain constant when calling schedule_timeout(), such as in waitForCmdComplete. Always calculate the desired delay based on the HZ constant. Otherwise, your delay varies depending on platform. HZ represents one second, in jiffies. So half a second delay would be "HZ / 2", etc. Also, when fixing, be careful that your HZ-based calculation will never evaluate to zero.

11) ditto s2io_reset

12) ditto s2io_close. etc.

13) in s2io_xmit, kfree the skb (drop it) if you don't have enough free space to queue it. this is normally a BUG condition, since proper use of netif_{start,stop,wake}_queue() will guarantee that s2io_xmit will only be called when there is free space to queue another skb.

14) spin_lock(), not spin_lock_irqsave(), in your interrupt handler. spin_lock_irqsave() is normally used in any of three cases: (1) don't know whether you're in an ISR or not, (2) definitely not in an ISR, or (3) your ISR is called from more than one hardware interrupt. None of these three is the case.

15) does s2io_get_stats need locking?

16) (style) If you are going to comment each function, you might as well do it in the "kernel-doc" style, which allows the comments to be picked up by automated tools. The format is

/**
* function_name - short description
* @argument1: argument 1 description
* @argument2: argument 2 description
* ...
* SOMETHING:
* blah blah blah
* SOMETHING ELSE:
* blah blah blah

The "ALL_CAPS:" indicates a new section/paragraph, in the document.

Once this is done, you may add a stub document to Documentation/DocBook/ and then create your driver's nicely-formatted documentation using "make pdfdocs", "make psdocs", or "make htmldocs".

17) this define belongs in include/linux/ethtool.h, if it's not there already... +#define SPEED_10000 10000

18) remove #ifdefs such as
+#if defined(ETHTOOL_GREGS)
+ info->regdump_len = XENA_REG_SPACE;
+#endif

since this exists in both 2.4 and 2.6 kernels.

19) ditto:
+#ifdef ETHTOOL_PHYS_ID

20) for the ethtool EEPROM and register dumps, it would be nice to submit a patch to me for ethtool (http://sf.net/projects/gkernel/), which generates a verbose dump rather than a bunch of hex numbers incomprehensible to the user. This is a long, boring, but easy task suitable to an intern, so I understand if it's not done immediately ;-)

21) s2io_ethtool_nway_reset should restart PHY autonegotiation, not reset the entire card

22) eliminate s2io_ethtool_get_link, it duplicates a generic (and equivalent) function in net/core/ethtool.c

23) ditto, for the s2io_ethtool_{get,set}_{sg,rx,tx}_csum stuff

24) don't explicitly set members to NULL in netdev_ethtool_ops

25) the update to s2io_tx_watchdog still leaves something to be desired.
You are no longer performing the could-take-a-long-time card reset
inside of spin_lock_bh()... you are now doing it inside the timer interrupt :( Move this to process context by using schedule_work() [2.6] or schedule_task [2.4]

27) Unconditional netif_wake_queue() in s2io_link() still unfixed. You must check for room for additional TX, before calling netif_{start,wake}_queue(). Consider what happens if the link goes down under the TX-full condition [netif_stop_queue]... instant bug.

28) do NOT specify PCI latency timer value as non-zero. pci_set_master() chooses an appropriate latency timer value. It is acceptable to leave this in as an option, as long as the module option's default is zero:

+static u8 latency_timer = 0xff;

29) (style) don't bother casting a void pointer:

+/* Private member variable initialized to s2io NIC structure */
+ sp = (nic_t *) dev->priv;

30) redundant assignment of 'sp':

+       dev->irq = pdev->irq;
+       dev->base_addr = (unsigned long) sp->bar0;
+       sp = (nic_t *) dev->priv;

31) kill the #ifdef

+#ifdef SET_ETHTOOL_OPS
+ SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops);
+#endif

This one is particularly silly, because SET_ETHTOOL_OPS() is -designed- to eliminate ifdefs. A driver wishing to be compatible will provide its own SET_ETHTOOL_OPS definition, guaranteeing it can be used unconditionally in the driver code here.

32) mark s2io_starter with "__init"

33) kill this:

+#ifndef ETH_ALEN
+#define ETH_ALEN 6
+#endif

34) the definitions of SUCCESS and FAILURE are incorrect. The driver should return 0 on success, and a negative errno-based error code on failure. -EBUSY, -EOPNOTSUPP, etc.

35) kill this:

+#ifndef SUPPORTED_10000baseT_Full
+#define SUPPORTED_10000baseT_Full (1 << 12)
+#endif

36) (feature addition) you have a ton of NIC-specific statistics. You should make those available to users, via ethtool.

37) kill all of this:

+/* OS related system calls */
+
+#ifndef readq
+static inline u64 read64(void *addr)
+{

+       u64 ret = 0;
+       ret = readl(addr + 4);
+       (u64) ret <<= 32;
+       (u64) ret |= readl(addr);

+
+ return ret;
+}
+#else
+static inline u64 read64(void *addr)
+{
+ u64 ret = readq(addr);
+ return ret;
+}
+#endif

+#define read32(addr, ret)  ret =  readl(addr);
+#define read16(addr, ret)  ret =  readw(addr);
+#define read8(addr, ret)   ret =  readb(addr);

+
+#ifndef writeq
+static inline void write64(void *addr, u64 val) +{
+ writel((u32) (val), addr);
+ writel((u32) (val >> 32), (addr + 4));
+}
+#else
+#define write64(addr, ret) writeq(ret,(void *)addr) +#endif
+#define write32(addr, ret) writel(ret,(void *)addr); +#define write16(addr, ret) writew(ret,(void *)addr); +#define write8(addr, ret) writeb(ret,(void *)addr);

38) sysctl_xframe.conf belongs somewhere in Documentation/*

#18 lore raw

RE: Submission #3 for S2io 10GbE driver

Hi Jeff,
Regarding comment #15, we don't think locking is required, because we just reflect what ever the statistics block is reflecting at the current moment.

Thanks,
Ravi

-----Original Message-----
From: Jeff Garzik [mailto:[email protected]]
Sent: Saturday, February 28, 2004 12:22 PM
To: Leonid Grossman
Cc: [email protected]; 'Stephen Hemminger'; 'Christoph Hellwig'; 'ravinandan arakali'; [email protected]
Subject: Re: Submission #3 for S2io 10GbE driver

Looking a lot better. A few merge issues remain, and some operational ones as well. There are 39 issues in this review, but IMO they are mostly minor issues that don't require much thought or work.

Comments:

<snipped>

15) does s2io_get_stats need locking?

<snipped>

#19 lore raw

Re: Submission #3 for S2io 10GbE driver

Quoted 4 lines · ravinandan arakali

Hi Jeff,
Regarding comment #15, we don't think locking is required, because we just reflect what ever the statistics block is reflecting at the current moment.

Cool.

Jeff

#20 lore raw

Submission #4 for S2io 10GbE driver

In reply to Jeff Garzik

All the issues are addressed, except for the ones that were discussed and resolved over e-mail.

Best Regards,
Leonid

Quoted 282 lines

-----Original Message-----
From: Jeff Garzik [mailto:[email protected]]
Sent: Saturday, February 28, 2004 12:22 PM
To: Leonid Grossman
Cc: [email protected]; 'Stephen Hemminger'; 'Christoph Hellwig'; 'ravinandan arakali'; [email protected]
Subject: Re: Submission #3 for S2io 10GbE driver

Looking a lot better. A few merge issues remain, and some operational
ones as well. There are 39 issues in this review, but IMO they are mostly minor issues that don't require much thought or work.

Comments:

0) to repeat myself from an earlier review... grumble... You CANNOT use NETIF_F_HW_CSUM, when your hardware does not provide the
checksum value. You must use NETIF_F_IP_CSUM. Your use of NETIF_F_HW_CSUM + CHECKSUM_UNNECESSARY is flat out incorrect.

1) the makefile is for out-of-tree stuff. The proper makefile will be
much smaller. So just submit a proper in-tree Makefile.

2) (in general) we don't want the compatibility stuff in-tree, that's for out-of-tree as well.

3) just submit a patch to include/linux/pci_ids.h instead of the following

(quoted diff) +6 -0
+/* VENDOR and DEVICE ID of XENA. */
+#ifndef PCI_VENDOR_ID_S2IO
+#define PCI_VENDOR_ID_S2IO      0x17D5
+#define PCI_DEVICE_ID_S2IO_WIN  0x5731
+#define PCI_DEVICE_ID_S2IO_UNI  0x5831
+#endif

4) just delete the SET_NETDEV_DEV(), FREE_NETDEV, and IRQ_NONE compatibility defines. these are in 2.4 just like 2.6.

5) Many PCI posting bugs remain. FixMacAddress is an excellent illustration:

(quoted diff) +8 -0
+       write64(&bar0->gpio_control, 0x0040600000000000ULL);
+       udelay(10);
+       write64(&bar0->gpio_control, 0x0000600000000000ULL);
+       udelay(10);
+       write64(&bar0->gpio_control, 0x0020600000000000ULL);
+       udelay(10);
+       write64(&bar0->gpio_control, 0x0060600000000000ULL);
+       udelay(10);

The delay is _not_ guaranteed at all, because you do not know when that
write64() will actually be sent to the PCI bus. Only a read[bwl,64] is
guaranteed to flush the write to the PCI device.

So, the above code does not function as you would expect, on all platforms.

6) More examples of PCI posting bugs, in startNic:

(quoted diff) +3 -0
+       write64(&bar0->mc_rldram_mrs, val64);
+       set_current_state(TASK_UNINTERRUPTIBLE);
+       schedule_timeout(HZ / 10);

and

(quoted diff) +6 -0
+       write64(&bar0->dtx_control, 0x8007051500000000ULL);
+       udelay(50);
+       write64(&bar0->dtx_control, 0x80070515000000E0ULL);
+       udelay(50);
+       write64(&bar0->dtx_control, 0x80070515001F00E4ULL);
+       udelay(50);

7) for fragmented skb's, you should be using pci_map_page() not pci_map_single(). Example in drivers/net/tg3.c.

8) (style) in alarmIntrHandler, due to line wrapping, Lindent has rendered the 'do' loop rather unreadable.

9) you cannot sleep inside the interrupt handler. Therefore the schedule_timeout() in alarmIntrHandler is very wrong.

10) never use a plain constant when calling schedule_timeout(), such as
in waitForCmdComplete. Always calculate the desired delay based on the
HZ constant. Otherwise, your delay varies depending on platform. HZ represents one second, in jiffies. So half a second delay would be "HZ
/ 2", etc. Also, when fixing, be careful that your HZ-based calculation
will never evaluate to zero.

11) ditto s2io_reset

12) ditto s2io_close. etc.

13) in s2io_xmit, kfree the skb (drop it) if you don't have enough free
space to queue it. this is normally a BUG condition, since proper use
of netif_{start,stop,wake}_queue() will guarantee that s2io_xmit will only be called when there is free space to queue another skb.

14) spin_lock(), not spin_lock_irqsave(), in your interrupt handler. spin_lock_irqsave() is normally used in any of three cases:
(1) don't
know whether you're in an ISR or not, (2) definitely not in an ISR, or
(3) your ISR is called from more than one hardware interrupt. None of
these three is the case.

15) does s2io_get_stats need locking?

16) (style) If you are going to comment each function, you might as well
do it in the "kernel-doc" style, which allows the comments to be picked
up by automated tools. The format is

/**
* function_name - short description
* @argument1: argument 1 description
* @argument2: argument 2 description
* ...
* SOMETHING:
* blah blah blah
* SOMETHING ELSE:
* blah blah blah

The "ALL_CAPS:" indicates a new section/paragraph, in the document.

Once this is done, you may add a stub document to Documentation/DocBook/
and then create your driver's nicely-formatted documentation using "make
pdfdocs", "make psdocs", or "make htmldocs".

17) this define belongs in include/linux/ethtool.h, if it's not there already...
+#define SPEED_10000 10000

18) remove #ifdefs such as

(quoted diff) +3 -0
+#if defined(ETHTOOL_GREGS)
+       info->regdump_len = XENA_REG_SPACE;
+#endif

since this exists in both 2.4 and 2.6 kernels.

19) ditto:
+#ifdef ETHTOOL_PHYS_ID

20) for the ethtool EEPROM and register dumps, it would be nice to submit a patch to me for ethtool (http://sf.net/projects/gkernel/),
which generates a verbose dump rather than a bunch of hex numbers incomprehensible to the user. This is a long, boring, but easy task suitable to an intern, so I understand if it's not done immediately ;-)

21) s2io_ethtool_nway_reset should restart PHY autonegotiation, not reset the entire card

22) eliminate s2io_ethtool_get_link, it duplicates a generic (and equivalent) function in net/core/ethtool.c

23) ditto, for the s2io_ethtool_{get,set}_{sg,rx,tx}_csum stuff

24) don't explicitly set members to NULL in netdev_ethtool_ops

25) the update to s2io_tx_watchdog still leaves something to be desired.
You are no longer performing the could-take-a-long-time card reset
inside of spin_lock_bh()... you are now doing it inside the timer interrupt :( Move this to process context by using schedule_work() [2.6] or schedule_task [2.4]

27) Unconditional netif_wake_queue() in s2io_link() still unfixed. You
must check for room for additional TX, before calling netif_{start,wake}_queue(). Consider what happens if the link goes down
under the TX-full condition [netif_stop_queue]... instant bug.

28) do NOT specify PCI latency timer value as non-zero. pci_set_master() chooses an appropriate latency timer value. It is acceptable to leave this in as an option, as long as the module option's
default is zero:

+static u8 latency_timer = 0xff;

29) (style) don't bother casting a void pointer:

(quoted diff) +2 -0
+/*  Private member variable initialized to s2io NIC structure */
+       sp = (nic_t *) dev->priv;

30) redundant assignment of 'sp':

(quoted diff) +3 -0
+       dev->irq = pdev->irq;
+       dev->base_addr = (unsigned long) sp->bar0;
+       sp = (nic_t *) dev->priv;

31) kill the #ifdef

(quoted diff) +3 -0
+#ifdef SET_ETHTOOL_OPS
+       SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops);
+#endif

This one is particularly silly, because SET_ETHTOOL_OPS() is -designed-
to eliminate ifdefs. A driver wishing to be compatible will provide its
own SET_ETHTOOL_OPS definition, guaranteeing it can be used unconditionally in the driver code here.

32) mark s2io_starter with "__init"

33) kill this:

(quoted diff) +3 -0
+#ifndef ETH_ALEN
+#define ETH_ALEN    6
+#endif

34) the definitions of SUCCESS and FAILURE are incorrect. The driver should return 0 on success, and a negative errno-based error code on failure. -EBUSY, -EOPNOTSUPP, etc.

35) kill this:

(quoted diff) +3 -0
+#ifndef SUPPORTED_10000baseT_Full
+#define SUPPORTED_10000baseT_Full (1 << 12)
+#endif

36) (feature addition) you have a ton of NIC-specific statistics. You
should make those available to users, via ethtool.

37) kill all of this:

(quoted diff) +35 -0
+/*  OS related system calls */
+
+#ifndef readq
+static inline u64 read64(void *addr)
+{
+       u64 ret = 0;
+       ret = readl(addr + 4);
+       (u64) ret <<= 32;
+       (u64) ret |= readl(addr);
+
+       return ret;
+}
+#else
+static inline u64 read64(void *addr)
+{
+       u64 ret = readq(addr);
+       return ret;
+}
+#endif
+#define read32(addr, ret)  ret =  readl(addr);
+#define read16(addr, ret)  ret =  readw(addr);
+#define read8(addr, ret)   ret =  readb(addr);
+
+#ifndef writeq
+static inline void write64(void *addr, u64 val)
+{
+       writel((u32) (val), addr);
+       writel((u32) (val >> 32), (addr + 4));
+}
+#else
+#define write64(addr, ret) writeq(ret,(void *)addr)
+#endif
+#define write32(addr, ret) writel(ret,(void *)addr);
+#define write16(addr, ret) writew(ret,(void *)addr);
+#define write8(addr, ret)  writeb(ret,(void *)addr);
Quoted 4 lines

38) sysctl_xframe.conf belongs somewhere in Documentation/*

Documentation/networking/s2io.txt +48 -0
diff -urN vanilla-linux/Documentation/networking/s2io.txt vanilla-linux-patch/Documentation/networking/s2io.txt
@@ -0,0 +1,48 @@
+S2IO Technologies XFrame 10 Gig adapter.
+-------------------------------------------
+
+I. Module loadable parameters.
+When loaded as a module, the driver provides a host of Module loadable
+parameters, so the device can be tuned as per the users needs.
+A list of the Module params is given below.
+(i)	ring_num: This can be used to program the number of
+		 receive rings used in the driver.
+(ii)	ring_len: This defines the number of descriptors each ring
+		 can have. There can be a maximum of 8 rings.
+(iii)	frame_len: This is an array of size 8. Using this we can 
+		 set the maximum size of the received frame that can
+		 be steered into the corrsponding receive ring.	
+(iv)	fifo_num: This defines the number of Tx FIFOs thats used in
+		 the driver. 
+(v)	fifo_len: Each element defines the number of 
+ 		 Tx descriptors that can be associated with each 
+		 corresponding FIFO. There are a maximum of 8 FIFOs.
+(vi)	tx_prio: This is a bool, if module is loaded with a non-zero
+		value for tx_prio multi FIFO scheme is activated.
+(vii)	rx_prio: This is a bool, if module is loaded with a non-zero
+		value for tx_prio multi RING scheme is activated.
+(viii)	latency_timer: The value given against this param will be
+		 loaded	into the latency timer register in PCI Config
+		 space, else the register is left with its reset value.
+
+II. Performance tuning.
+ By changing a few sysctl parameters.
+	Copy the following lines into a file and run the following command,
+	"sysctl -p <file_name>"
+### IPV4 specific settings
+net.ipv4.tcp_timestamps = 0 # turns TCP timestamp support off, default 1, reduces CPU use
+net.ipv4.tcp_sack = 0 # turn SACK support off, default on
+# on systems with a VERY fast bus -> memory interface this is the big gainer
+net.ipv4.tcp_rmem = 10000000 10000000 10000000 # sets min/default/max TCP read buffer, default 4096 87380 174760
+net.ipv4.tcp_wmem = 10000000 10000000 10000000 # sets min/pressure/max TCP write buffer, default 4096 16384 131072
+net.ipv4.tcp_mem = 10000000 10000000 10000000 # sets min/pressure/max TCP buffer space, default 31744 32256 32768
+                                                                                
+### CORE settings (mostly for socket and UDP effect)
+net.core.rmem_max = 524287 # maximum receive socket buffer size, default 131071
+net.core.wmem_max = 524287 # maximum send socket buffer size, default 131071
+net.core.rmem_default = 524287 # default receive socket buffer size, default 65535
+net.core.wmem_default = 524287 # default send socket buffer size, default 65535
+net.core.optmem_max = 524287 # maximum amount of option memory buffers, default 10240
+net.core.netdev_max_backlog = 300000 # number of unprocessed input packets before kernel starts dropping them, default 300
+---End of performance tuning file---
+
drivers/net/Kconfig +12 -0
diff -urN vanilla-linux/drivers/net/Kconfig vanilla-linux-patch/drivers/net/Kconfig
@@ -2058,6 +2058,18 @@
 	bool "Use Rx Polling (NAPI) (EXPERIMENTAL)"
 	depends on IXGB && EXPERIMENTAL
 
+config S2IO
+	tristate "S2IO 10Gbe XFrame NIC"
+	depends on PCI
+	---help---
+	  This driver supports the 10Gbe XFrame NIC of S2IO. 
+	  For help regarding driver compilation, installation and 
+	  tuning please look into ~/drivers/net/s2io/README.txt.
+
+config S2IO_NAPI
+	bool "Use Rx Polling (NAPI) (EXPERIMENTAL)"
+	depends on S2IO && EXPERIMENTAL
+
 endmenu
 
 
drivers/net/s2io/Makefile +5 -0
diff -urN vanilla-linux/drivers/net/s2io/Makefile vanilla-linux-patch/drivers/net/s2io/Makefile
@@ -0,0 +1,5 @@
+#
+# Makefile for the S2IO Technologies XFrame 10Gig NIC
+#
+
+obj-$(CONFIG_S2IO) += s2io.o
drivers/net/s2io/regs.h +775 -0

775 lines not on this page · raw message

drivers/net/s2io/s2io.c +4389 -0

2,079 lines not on this page · raw message

drivers/net/s2io/s2io.h +855 -0

855 lines not on this page · raw message

drivers/net/tags +0 -1958

1,958 lines not on this page · raw message

include/linux/pci_ids.h +4 -0
diff -urN vanilla-linux/include/linux/pci_ids.h vanilla-linux-patch/include/linux/pci_ids.h

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Part of the diff is not shown here. View the raw message.

Applied
#21 lore raw

Re: Submission #4 for S2io 10GbE driver

applied to 2.6, thanks.

Note I made the attached changes, otherwise the build would throw a bunch of errors and warnings. Also, I merged it into drivers/net/s2io{.c,.h,-regs.h} since there isn't a need for a separate directory for just three files.

Jeff

===== drivers/net/s2io.h 1.1 vs 1.2 =====

drivers/net/s2io.h +4 -4
@@ -14,8 +14,8 @@
 #define _S2IO_H
 
 #define TBD 0
-#define BIT(loc)        (((u64)0x8000000000000000ULL) >> loc)
-#define vBIT(val, loc, sz)  (((u64)val) << (64-loc-sz))
+#define BIT(loc)		(1ULL << (loc))
+#define vBIT(val, loc, sz)	(((u64)val) << (64-loc-sz))
 
 #ifndef BOOL
 #define BOOL    int
@@ -531,7 +531,7 @@
 	RxD_t rxd[MAX_RXDS_PER_BLOCK];
 
 	u64 reserved_0;
-#define END_OF_BLOCK    0xFEFFFFFFFFFFFFFF
+#define END_OF_BLOCK    0xFEFFFFFFFFFFFFFFULL
 	u64 reserved_1;		/* 0xFEFFFFFFFFFFFFFF to mark last Rxd in this blk */
 	u64 reserved_2_pNext_RxD_block;	/*@ Logical ptr to next */
 	u64 pNext_RxD_Blk_physical;	/* Buff0_ptr.
@@ -738,7 +738,7 @@
 	u16 last_link_state;
 #define	LINK_DOWN	1
 #define	LINK_UP		2
-} nic_t __cacheline_aligned;
+} nic_t;
 
 #define RESET_ERROR 1;
 #define CMD_ERROR   2;

===== drivers/net/s2io.c 1.1 vs 1.2 =====

drivers/net/s2io.c +1 -1
@@ -65,7 +65,7 @@
 
 /* local include */
 #include "s2io.h"
-#include "regs.h"
+#include "s2io-regs.h"
 
 /* S2io Driver name & version. */
 static char s2io_driver_name[] = "s2io";
#22 lore raw

Re: Submission #4 for S2io 10GbE driver

drivers/net/s2io.h line 18

Quoted 11 lines · Jeff Garzik

===== drivers/net/s2io.h 1.1 vs 1.2 =====

drivers/net/s2io.h +2 -2
@@ -14,8 +14,8 @@
 #define _S2IO_H
 
 #define TBD 0
-#define BIT(loc)        (((u64)0x8000000000000000ULL) >> loc)
-#define vBIT(val, loc, sz)  (((u64)val) << (64-loc-sz))
+#define BIT(loc)		(1ULL << (loc))
+#define vBIT(val, loc, sz)	(((u64)val) << (64-loc-sz))

and here is a patch correcting an incorrect cleanup...

===== drivers/net/s2io.h 1.2 vs edited =====

drivers/net/s2io.h +1 -1
@@ -14,7 +14,7 @@
 #define _S2IO_H
 
 #define TBD 0
-#define BIT(loc)		(1ULL << (loc))
+#define BIT(loc)		(0x8000000000000000ULL >> (loc))
 #define vBIT(val, loc, sz)	(((u64)val) << (64-loc-sz))
 
 #ifndef BOOL
#25 lore raw

Re: Submission #4 for S2io 10GbE driver

In reply to Jeff Garzik
Quoted 6 lines · Jeff Garzik

applied to 2.6, thanks.

Note I made the attached changes, otherwise the build would throw a bunch of errors and warnings. Also, I merged it into drivers/net/s2io{.c,.h,-regs.h} since there isn't a need for a separate directory for just three files.

There's still lots of missing statics the might want to get fixed up.

#23 lore raw

RE: Submission #4 for S2io 10GbE driver

In reply to Jeff Garzik

Hi Jeff,
Thanks for the patch cleanup.
Can you pls send us the final copy of s2ioDriver.patch file that you applied
to the 2.6 kernel ?

Regards,
Ravi

-----Original Message-----
From: Jeff Garzik [mailto:[email protected]]
Sent: Saturday, March 20, 2004 2:01 AM
To: Leonid Grossman
Cc: [email protected]; 'ravinandan arakali';
[email protected]
Subject: Re: Submission #4 for S2io 10GbE driver

drivers/net/s2io.h line 18

Quoted 11 lines · Jeff Garzik

===== drivers/net/s2io.h 1.1 vs 1.2 =====

drivers/net/s2io.h +2 -2
@@ -14,8 +14,8 @@
 #define _S2IO_H
 
 #define TBD 0
-#define BIT(loc)        (((u64)0x8000000000000000ULL) >> loc)
-#define vBIT(val, loc, sz)  (((u64)val) << (64-loc-sz))
+#define BIT(loc)		(1ULL << (loc))
+#define vBIT(val, loc, sz)	(((u64)val) << (64-loc-sz))

and here is a patch correcting an incorrect cleanup...

#24 lore raw

Re: Submission #4 for S2io 10GbE driver

Attached is a patch representing my current net-drivers-2.6 queue, diff'd against 2.6.5-rc2.

It will go to Andrew/Linus after 2.6.5 is released, since it was received after 2.6.5-bk went into release candidate status.

Jeff