Skip to contentSkip to conversation

CBQ DEVICE BW?

LARTC Srikanth 2 participants 6 messages May 23, 2003 – May 24, 2003

lore
Share & tools
lore

Srikanth

author
#0 lore raw

Hi,

The CBQ config file shud be some thing like this.

DEVICE=eth0,10Mbit,1Mbit
RATE=50Kbit
WEIGHT=5Kbit

Shall i hardcode the DEVICE BW as 10/100 Mbit
or
Shall i use any other tool like ethtool for getting this. ethtool gives Speed: 10Mbps

If so, how about, if i use some other Interfaces other than eth0, like ppp0 or some other?

C'd anybody can give a suggestion over this?

thanks & regards,
Srikanth.

#1 lore raw
Quoted 13 lines · Srikanth

Hi,

The CBQ config file shud be some thing like this.

DEVICE=eth0,10Mbit,1Mbit
RATEPKbit
WEIGHT=5Kbit

Shall i hardcode the DEVICE BW as 10/100 Mbit
or
Shall i use any other tool like ethtool for getting this. ethtool gives Speed: 10Mbps

Quoted 4 lines

If so, how about, if i use some other Interfaces other than eth0, like ppp0 or some other?

C'd anybody can give a suggestion over this?

Bandwidth should be the real physical bandwidth of the device.

Stef

Signature · 8 lines
[email protected]
 "Using Linux as bandwidth manager"
     http://www.docum.org/
     #lartc @ irc.oftc.net

_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
author
#2 lore raw
In reply to Srikanth

Thanks Stef,

I need to clarify more please.

Quoted 16 lines · Stef Coene
Quoted 13 lines · Srikanth

Hi,

The CBQ config file shud be some thing like this.

DEVICE=eth0,10Mbit,1Mbit
RATE=50Kbit
WEIGHT=5Kbit

Shall i hardcode the DEVICE BW as 10/100 Mbit
or
Shall i use any other tool like ethtool for getting this. ethtool gives Speed: 10Mbps

Quoted 8 lines
Quoted 6 lines

If so, how about, if i use some other Interfaces other than eth0, like ppp0 or some other?

C'd anybody can give a suggestion over this?

Bandwidth should be the real physical bandwidth of the device.

Forgive me, if i'm wrong.

As of my understanding, are the below lines right?

DEVICE BW = Real physical bandwidth of the device

So, Here DEVICE means only the Interface, not the Link, am i right?

&

RATE = Rate assigned to perticular user/network/service.

How much the user/network/service can aquire max. allowable rate?

I can consider as 10/100 Mbps for ethernet interface. So, how about, when i use ppp0 (pppoe) in my CBQ, is it same? bcoz, pppoe uses eth0, am i right?

Quoted 3 lines

Stef

reg,
Srikanth.

Quoted 3 lines
author
#3 lore raw
In reply to Srikanth

One more question,

Quoted 16 lines · Stef Coene
Quoted 13 lines · Srikanth

Hi,

The CBQ config file shud be some thing like this.

DEVICE=eth0,10Mbit,1Mbit
RATE=50Kbit
WEIGHT=5Kbit

Shall i hardcode the DEVICE BW as 10/100 Mbit
or
Shall i use any other tool like ethtool for getting this. ethtool gives Speed: 10Mbps

Quoted 9 lines
Quoted 6 lines

If so, how about, if i use some other Interfaces other than eth0, like ppp0 or some other?

C'd anybody can give a suggestion over this?

Bandwidth should be the real physical bandwidth of the device.

How do i get the real physical bandwidth of the device?

The below program attached is giving the value 6, on my system. In some other systems, it's giving 2 (don't know whether Kbps/Mbps).

Quoted 2 lines

Stef

/*
* Gets the bandwidth of the interface.
*/

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <errno.h>

#include <db.h>
#include <sys/types.h>
#include <sys/time.h>
#include <fcntl.h>

#include <sys/socket.h>
#include <sys/ioctl.h>
//#include <netdb.h>

#include <linux/in.h>
#include <linux/if.h>
#include "ifstats.h"

extern int errno;

int
IFSGetBandwidth (if_stats_desc_struct * ifsd)
{
//#ifdef HAS_SIOCGIFINDEX
int s, status;
struct ifreq ifr;
struct in_addr ina;
if_ip_addr_union ip;

if (ifsd == NULL)

   {
       printf("case 1\n");             
       return (-1);

}

/* Must have a specified interface. */
if (ifsd->interface == NULL)

   {             
       printf("case 2\n");             

return (-1);
}

/* Create a UDP socket. */
s = socket (AF_INET, SOCK_DGRAM, 0);
if (s < 0)

   {             
       printf("case 3\n");             

return (-1);
}

/* Set interface name explicitly from ifsd. */ strncpy (ifr.ifr_name, ifsd->interface, IFNAMSIZ); ifr.ifr_name[IFNAMSIZ - 1] = '\0';

/* Get bandwidth of interface and put into interface request
* * structure.
* */
status = ioctl(s, SIOCGIFINDEX, &ifr);

/* Close socket. */
close (s);

/* ioctl() failed? */
if (status < 0)

   {             
       perror("! Ioctl");       
     printf("case 4\n");             

return (-1);
}

ifsd->bandwidth = ifr.ifr_bandwidth;
printf("Hello World\n");
printf("Bandwidth: %i\n", ifsd->bandwidth);

//#endif /* HAS_SIOCGIFINDEX */

return (0);
}

main ()

{
     int retVal;

if_stats_desc_struct * ifsd;

   ifsd = (if_stats_desc_struct *) malloc(sizeof(if_stats_desc_struct));
   if (ifsd == NULL)
       perror("! Malloc");

ifsd->interface = (char *) malloc(20);
if (ifsd->interface == NULL)

       perror("! Malloc");
   strcpy(ifsd->interface, "eth0");   
     retVal = IFSGetBandwidth (ifsd);

free(ifsd->interface);
free(ifsd);
printf("retVal = %d\n", retVal);
}

regards,
Srikanth.

Quoted 3 lines
#4 lore raw
In reply to Srikanth
Quoted 7 lines

Forgive me, if i'm wrong.

As of my understanding, are the below lines right?

DEVICE BW = Real physical bandwidth of the device

So, Here DEVICE means only the Interface, not the Link, am i right?

Yes.

Quoted 5 lines

&

RATE = Rate assigned to perticular user/network/service.

How much the user/network/service can aquire max. allowable rate?

Yes. If you add the bounded parameter, you create a maximum for that class.

Quoted 3 lines

I can consider as 10/100 Mbps for ethernet interface. So, how about, when i use ppp0 (pppoe) in my CBQ, is it same? bcoz, pppoe uses eth0, am i right?

I'm not sure about that. But I think you have to use the eth0 speed. Or use htb, no more bandwidth questions needed :)

Stef

Signature · 8 lines
[email protected]
 "Using Linux as bandwidth manager"
     http://www.docum.org/
     #lartc @ irc.oftc.net

_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
author
#5 lore raw
In reply to Srikanth

Thanks Stef,

I've customized ethtool source, it's giving the correct values depends on the real physical I/F BW. (as per my requirements)

I need only speed from that.

Quoted 20 lines · Stef Coene
Quoted 9 lines

Forgive me, if i'm wrong.

As of my understanding, are the below lines right?

DEVICE BW = Real physical bandwidth of the device

So, Here DEVICE means only the Interface, not the Link, am i right?

Yes.

Quoted 7 lines

&

RATE = Rate assigned to perticular user/network/service.

How much the user/network/service can aquire max. allowable rate?

Yes. If you add the bounded parameter, you create a maximum for that class.

Quoted 8 lines
Quoted 5 lines

I can consider as 10/100 Mbps for ethernet interface. So, how about, when i use ppp0 (pppoe) in my CBQ, is it same? bcoz, pppoe uses eth0, am i right?

I'm not sure about that. But I think you have to use the eth0 speed. Or use htb, no more bandwidth questions needed :)

Yah, from now onwards, no more DEVICE BW questions.

Quoted 4 lines

Stef

Srikanth.