From patchwork Fri May 25 09:11:46 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rostislav Lisovy X-Patchwork-Id: 161258 X-Patchwork-Delegate: shemminger@vyatta.com Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3B1EFB6F6E for ; Fri, 25 May 2012 19:12:13 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753331Ab2EYJMG (ORCPT ); Fri, 25 May 2012 05:12:06 -0400 Received: from mail-wg0-f44.google.com ([74.125.82.44]:48571 "EHLO mail-wg0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753099Ab2EYJMB (ORCPT ); Fri, 25 May 2012 05:12:01 -0400 Received: by wgbdr13 with SMTP id dr13so670093wgb.1 for ; Fri, 25 May 2012 02:12:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=xWaA9SptU4fDOzUdJwxZIkX502Erg6x9mPZ/SSiEUPY=; b=IrmiI0OgDBALZKMPXWBWVdAS1sDZ5g9bIgBjJJVRQN78dOseAzN0i1l58AuNOL9dTe +VZrOUbrfzl+RF/PKnovTA8Ipc0wcS5/AqDFNXlghnqU5f2cXQAeo004mbMmiiDwfjmm Yug2Mil3OIo6+PkKEqwZzNAu8Q0wL3CfhyU7cR9w2i3VMcVGNRiFaDs1ar+/fxWnU6z3 8R2n+m3y0sXRObB5kVibcvNMjoTSSoa7w0TyZTVWSrJFbwDg3j03u6GxhruB9tardsnw ZMcuvILb3mG8zFxgPHHolxs6qVwWIFNoCWAGM/xp3rhp19o5+lxXDTubsi0S6K3UrHhW D4CA== Received: by 10.180.75.241 with SMTP id f17mr5463582wiw.11.1337937119902; Fri, 25 May 2012 02:11:59 -0700 (PDT) Received: from lolumad.felk.cvut.cz ([147.32.86.168]) by mx.google.com with ESMTPS id et10sm53753461wib.2.2012.05.25.02.11.58 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 25 May 2012 02:11:59 -0700 (PDT) From: Rostislav Lisovy To: netdev@vger.kernel.org Cc: linux-can@vger.kernel.org, pisa@cmp.felk.cvut.cz, sojkam1@fel.cvut.cz, oliver@hartkopp.net, Rostislav Lisovy Subject: [PATCH iproute2 3/3] CAN Filter/Classifier -- Documentation Date: Fri, 25 May 2012 11:11:46 +0200 Message-Id: <1337937106-7640-4-git-send-email-lisovy@gmail.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1337937106-7640-1-git-send-email-lisovy@gmail.com> References: <1337937106-7640-1-git-send-email-lisovy@gmail.com> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Added manpage describing usage of CAN Filter. Signed-off-by: Rostislav Lisovy --- man/man8/tc-can.8 | 97 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 man/man8/tc-can.8 diff --git a/man/man8/tc-can.8 b/man/man8/tc-can.8 new file mode 100644 index 0000000..54ee96a --- /dev/null +++ b/man/man8/tc-can.8 @@ -0,0 +1,97 @@ +.TH CAN 8 "8 May 2012" "iproute2" "Linux" +.SH NAME +CAN \- Controller Area Network classifier +.SH SYNOPSIS +.B tc filter ... dev +DEV +.B parent +CLASSID +.B [ prio +PRIORITY +.B ] [ protocol can ] [ handle +HANDLE +.B ] can [ +MATCHSPEC +.B ] [ flowid +FLOWID +.B ] + +.B CLASSID := major:minor +.br +.B FLOWID := major:minor +.br +.B MATCHSPEC := { sffid +FILTERID +.B | effid +FILTERID +.B | MATCHSPEC ... } +.br +.B FILTERID := canid[:mask] + +.BR CLASSID , +.BR FLOWID , +.BR canid +and +.B mask +are parsed as hexadecimal input. + + +.SH DESCRIPTION +The CAN classifier may be used with any available +.B qdisc +on Controller Area Network (CAN) frames passed through AF_CAN +networking subsystem. The classifier classifies CAN frames according +to their identifiers. It can be used on CAN frames with both SFF or +EFF identifiers. + +It is possible to add CAN classifier to any qdisc configured on any networking +device, however it will ignore non-CAN packets. + + +.SH CLASSIFICATION +The filtering rules for EFF frames are stored in an array, which is traversed +during classification. This means that the worst-case time needed for +classification of EFF frames increases with the number of configured rules. + +The filter implements an optimization for matching SFF frames using a bitmap +with one bit for every ID. With this optimization, the classification time +for SFF frames is nearly constant independently of the number of rules. + +.SH EXAMPLE +This example shows how to set +.B prio qdisc +with +.B CAN +classifier. + +.nf +tc qdisc add dev can0 root handle 1: prio + +tc filter add dev can0 parent 1:0 prio 1 handle 0xa \\ + can sffid 0x7ff:0xf flowid 1:1 +tc filter add dev can0 parent 1:0 prio 2 handle 0xb \\ + can sffid 0xC0:0x7ff effid 0x80:0x7ff flowid 1:2 +tc filter add dev can0 parent 1:0 prio 3 \\ + can sffid 0x80:0x7ff flowid 1:2 +tc filter add dev can0 parent 1:0 prio 4 \\ + can sffid 0x0:0x0 effid 0x0:0x0 flowid 1:3 +.fi + + +.SH BUGS +The maximum number or rules passed from +.BR tc(8) +utility to CAN classifier is fixed. The limit is set at compilation time +(default is 128). + + +.SH SEE ALSO +.BR tc(8) + + +.SH AUTHORS +Michal Sojka , Pavel Pisa , +Rostislav Lisovy . + +This manpage maintained by Rostislav Lisovy +