patch-2.1.116 linux/drivers/net/shaper.c

Next file: linux/drivers/net/tlan.c
Previous file: linux/drivers/net/plip.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.115/linux/drivers/net/shaper.c linux/drivers/net/shaper.c
@@ -128,6 +128,7 @@
   
 static void shaper_setspeed(struct shaper *shaper, int bitspersec)
 {
+	shaper->bitspersec=bitspersec;
 	shaper->bytespertick=(bitspersec/HZ)/8;
 	if(!shaper->bytespertick)
 		shaper->bytespertick++;
@@ -549,17 +550,27 @@
 {
 	struct shaperconf *ss= (struct shaperconf *)&ifr->ifr_data;
 	struct shaper *sh=dev->priv;
-	struct device *them=dev_get(ss->ss_name);
 	switch(ss->ss_cmd)
 	{
 		case SHAPER_SET_DEV:
+		{
+			struct device *them=dev_get(ss->ss_name);
 			if(them==NULL)
 				return -ENODEV;
 			if(sh->dev)
 				return -EBUSY;
 			return shaper_attach(dev,dev->priv, them);
+		}
+		case SHAPER_GET_DEV:
+			if(sh->dev==NULL)
+				return -ENODEV;
+			memcpy(ss->ss_name, sh->dev->name, sizeof(ss->ss_name));
+			return 0;
 		case SHAPER_SET_SPEED:
 			shaper_setspeed(sh,ss->ss_speed);
+			return 0;
+		case SHAPER_GET_SPEED:
+			ss->ss_speed=sh->bitspersec;
 			return 0;
 		default:
 			return -EINVAL;

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov