All of lore.kernel.org
 help / color / mirror / Atom feed
From: Konrad <kcem@tlen.pl>
To: lartc@vger.kernel.org
Subject: Re: [LARTC] htb: HowTo identify squid cache hits
Date: Fri, 27 May 2005 09:13:49 +0000	[thread overview]
Message-ID: <4296E4CD.5070407@tlen.pl> (raw)
In-Reply-To: <20050526133242.GA11315@sysop-2.atlascollege.nl>

tc filter add dev <dev> protocol ip parent 1:0 pref 1 u32 match ip dst 
192.168.0.12 match ip sport 8080 0xffff match ip tos 8 0xff flowid 1:12
#If squid miss, traffic will go to user queue.


tc filter add dev imq1 protocol ip parent 1:0 pref 2 u32 match ip src 
192.168.0.22 match ip sport 8080 0xffff flowid 1:30
#this catch all traffic from source port Squid... but with priority 2 
and throw in LAN class.

I'm using this patch:

--- CUT ---

diff -cr squid-2.5.STABLE3/src/client_side.c 
squid-2.5.STABLE3.patched/src/client_side.c
*** squid-2.5.STABLE3/src/client_side.c	2003-05-24 13:08:41.000000000 +0200
--- squid-2.5.STABLE3.patched/src/client_side.c	2003-08-05 
22:08:15.000000000 +0200
***************
*** 2005,2010 ****
--- 2005,2013 ----
   	/* Avoid copying to MemBuf for non-range requests */
   	/* Note, if we're here, then 'rep' is known to be NULL */
   	http->out.offset += body_size;
+ 	{   int tos=isTcpHit(http->log_type) ? 0 : 8;
+ 	    setsockopt(fd,SOL_IP,IP_TOS,&tos,4);
+ 	}
   	comm_write(fd, buf, size, clientWriteBodyComplete, http, NULL);
   	/* NULL because clientWriteBodyComplete frees it */
   	return;
***************
*** 2062,2067 ****
--- 2065,2073 ----
       if (!http->request->range && http->request->method = METHOD_GET)
   	assert(check_size = size);
       /* write */
+     {	int tos=isTcpHit(http->log_type) ? 0 : 8;
+ 	setsockopt(fd,SOL_IP,IP_TOS,&tos,4);
+     }
       comm_write_mbuf(fd, mb, clientWriteComplete, http);
       /* if we don't do it, who will? */
       memFree(buf, MEM_CLIENT_SOCK_BUF);

--- CUT ---

If squid HIT then TOS is 0, if miss then 1.

Here is the place where you can download this: 
http://sed.pl/~mrk/qos/squid_hit_miss_mark.patch

Throw in to queue of LAN only traffic coming from Squid.
Upload traffic from Squid always queue in users classes.
_______________________________________________
LARTC mailing list
LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc

  parent reply	other threads:[~2005-05-27  9:13 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-05-26 13:32 [LARTC] htb: HowTo identify squid cache hits Peter Kaagman
2005-05-26 13:49 ` Justin Schoeman
2005-05-26 14:00 ` Marcin Kałuża
2005-05-26 14:04 ` Evgeni Gechev
2005-05-26 14:05 ` Daniel Lupescu
2005-05-26 14:33 ` Peter Surda
2005-05-26 17:49 ` Pan'ko Alexander
2005-05-26 18:56 ` Andy Furniss
2005-05-26 19:13 ` Pan'ko Alexander
2005-05-26 19:41 ` Andy Furniss
2005-05-26 19:47 ` Peter Kaagman
2005-05-26 19:59 ` Peter Kaagman
2005-05-27  0:09 ` Lewis Shobbrook
2005-05-27  9:13 ` Konrad [this message]
2005-05-30 15:01 ` Andy Furniss

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=4296E4CD.5070407@tlen.pl \
    --to=kcem@tlen.pl \
    --cc=lartc@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.