aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/ctld/parse.y
diff options
context:
space:
mode:
authorRichard Scheffenegger <rscheff@FreeBSD.org>2020-09-27 21:43:19 +0000
committerRichard Scheffenegger <rscheff@FreeBSD.org>2020-09-27 21:43:19 +0000
commit64ffe6d4409b71e5b513ebdda1446d722fd369d9 (patch)
treee5fd9021668eee8e8a2f459b94cc3f007c5e8a06 /usr.sbin/ctld/parse.y
parent1e2521ffaef4fd0950686f1302283a92ccf9c978 (diff)
downloadsrc-64ffe6d4409b71e5b513ebdda1446d722fd369d9.tar.gz
src-64ffe6d4409b71e5b513ebdda1446d722fd369d9.zip
Add DSCP support for network QoS to iscsi target.
In order to prioritize iSCSI traffic across a network, DSCP can be used. In order not to rely on "ipfw setdscp" or in-network reclassification, this adds the dscp value directly to the portal group (where TCP sessions are accepted). The incoming iSCSI session is first handled by ctld for any CHAP authentication and the socket is then handed off to the in-kernel iscsi driver without modification of the socket parameters. Simply setting up the socket in ctld is sufficient to keep sending outgoing iSCSI related traffic with the configured DSCP value. Reviewed by: mav, trasz MFC after: 2 weeks Sponsored by: NetApp, Inc. Differential Revision: https://reviews.freebsd.org/D26385
Notes
Notes: svn path=/head/; revision=366206
Diffstat (limited to 'usr.sbin/ctld/parse.y')
-rw-r--r--usr.sbin/ctld/parse.y52
1 files changed, 51 insertions, 1 deletions
diff --git a/usr.sbin/ctld/parse.y b/usr.sbin/ctld/parse.y
index c9478405599a..b6903890210b 100644
--- a/usr.sbin/ctld/parse.y
+++ b/usr.sbin/ctld/parse.y
@@ -41,6 +41,8 @@
#include <string.h>
#include "ctld.h"
+#include <netinet/in.h>
+#include <netinet/ip.h>
extern FILE *yyin;
extern char *yytext;
@@ -60,11 +62,13 @@ extern void yyrestart(FILE *);
%token ALIAS AUTH_GROUP AUTH_TYPE BACKEND BLOCKSIZE CHAP CHAP_MUTUAL
%token CLOSING_BRACKET CTL_LUN DEBUG DEVICE_ID DEVICE_TYPE
-%token DISCOVERY_AUTH_GROUP DISCOVERY_FILTER FOREIGN
+%token DISCOVERY_AUTH_GROUP DISCOVERY_FILTER DSCP FOREIGN
%token INITIATOR_NAME INITIATOR_PORTAL ISNS_SERVER ISNS_PERIOD ISNS_TIMEOUT
%token LISTEN LISTEN_ISER LUN MAXPROC OFFLOAD OPENING_BRACKET OPTION
%token PATH PIDFILE PORT PORTAL_GROUP REDIRECT SEMICOLON SERIAL SIZE STR
%token TAG TARGET TIMEOUT
+%token AF11 AF12 AF13 AF21 AF22 AF23 AF31 AF32 AF33 AF41 AF42 AF43
+%token BE EF CS0 CS1 CS2 CS3 CS4 CS5 CS6 CS7
%union
{
@@ -353,6 +357,8 @@ portal_group_entry:
portal_group_redirect
|
portal_group_tag
+ |
+ portal_group_dscp
;
portal_group_discovery_auth_group: DISCOVERY_AUTH_GROUP STR
@@ -463,6 +469,50 @@ portal_group_tag: TAG STR
}
;
+portal_group_dscp
+: DSCP STR
+ {
+ uint64_t tmp;
+
+ if (strcmp($2, "0x") == 0) {
+ tmp = strtol($2 + 2, NULL, 16);
+ } else if (expand_number($2, &tmp) != 0) {
+ yyerror("invalid numeric value");
+ free($2);
+ return(1);
+ }
+ if (tmp >= 0x40) {
+ yyerror("invalid dscp value");
+ return(1);
+ }
+
+ portal_group->pg_dscp = tmp;
+ }
+| DSCP BE { portal_group->pg_dscp = IPTOS_DSCP_CS0 >> 2 ; }
+| DSCP EF { portal_group->pg_dscp = IPTOS_DSCP_EF >> 2 ; }
+| DSCP CS0 { portal_group->pg_dscp = IPTOS_DSCP_CS0 >> 2 ; }
+| DSCP CS1 { portal_group->pg_dscp = IPTOS_DSCP_CS1 >> 2 ; }
+| DSCP CS2 { portal_group->pg_dscp = IPTOS_DSCP_CS2 >> 2 ; }
+| DSCP CS3 { portal_group->pg_dscp = IPTOS_DSCP_CS3 >> 2 ; }
+| DSCP CS4 { portal_group->pg_dscp = IPTOS_DSCP_CS4 >> 2 ; }
+| DSCP CS5 { portal_group->pg_dscp = IPTOS_DSCP_CS5 >> 2 ; }
+| DSCP CS6 { portal_group->pg_dscp = IPTOS_DSCP_CS6 >> 2 ; }
+| DSCP CS7 { portal_group->pg_dscp = IPTOS_DSCP_CS7 >> 2 ; }
+| DSCP AF11 { portal_group->pg_dscp = IPTOS_DSCP_AF11 >> 2 ; }
+| DSCP AF12 { portal_group->pg_dscp = IPTOS_DSCP_AF12 >> 2 ; }
+| DSCP AF13 { portal_group->pg_dscp = IPTOS_DSCP_AF13 >> 2 ; }
+| DSCP AF21 { portal_group->pg_dscp = IPTOS_DSCP_AF21 >> 2 ; }
+| DSCP AF22 { portal_group->pg_dscp = IPTOS_DSCP_AF22 >> 2 ; }
+| DSCP AF23 { portal_group->pg_dscp = IPTOS_DSCP_AF23 >> 2 ; }
+| DSCP AF31 { portal_group->pg_dscp = IPTOS_DSCP_AF31 >> 2 ; }
+| DSCP AF32 { portal_group->pg_dscp = IPTOS_DSCP_AF32 >> 2 ; }
+| DSCP AF33 { portal_group->pg_dscp = IPTOS_DSCP_AF33 >> 2 ; }
+| DSCP AF41 { portal_group->pg_dscp = IPTOS_DSCP_AF41 >> 2 ; }
+| DSCP AF42 { portal_group->pg_dscp = IPTOS_DSCP_AF42 >> 2 ; }
+| DSCP AF43 { portal_group->pg_dscp = IPTOS_DSCP_AF43 >> 2 ; }
+ ;
+
+
lun: LUN lun_name
OPENING_BRACKET lun_entries CLOSING_BRACKET
{