diff options
author | trasz <trasz@FreeBSD.org> | 2015-02-28 12:02:32 +0000 |
---|---|---|
committer | trasz <trasz@FreeBSD.org> | 2015-02-28 12:02:32 +0000 |
commit | 8f6e16a6825f63f55594b1cb1bea3910ede52b43 (patch) | |
tree | a8d21bcf9ab3db261bf12280633585ecfbbe0a30 /usr.sbin/ctld | |
parent | 692b5ee9dca7e3612a693ed1e7553ac42d635793 (diff) | |
download | FreeBSD-src-8f6e16a6825f63f55594b1cb1bea3910ede52b43.zip FreeBSD-src-8f6e16a6825f63f55594b1cb1bea3910ede52b43.tar.gz |
Move the "offload" clause from the target section to portal-group
section; it makes more sense there.
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Diffstat (limited to 'usr.sbin/ctld')
-rw-r--r-- | usr.sbin/ctld/ctl.conf.5 | 7 | ||||
-rw-r--r-- | usr.sbin/ctld/ctld.c | 35 | ||||
-rw-r--r-- | usr.sbin/ctld/ctld.h | 6 | ||||
-rw-r--r-- | usr.sbin/ctld/kernel.c | 5 | ||||
-rw-r--r-- | usr.sbin/ctld/login.c | 2 | ||||
-rw-r--r-- | usr.sbin/ctld/parse.y | 26 |
6 files changed, 41 insertions, 40 deletions
diff --git a/usr.sbin/ctld/ctl.conf.5 b/usr.sbin/ctld/ctl.conf.5 index 6854f87..7049969 100644 --- a/usr.sbin/ctld/ctl.conf.5 +++ b/usr.sbin/ctld/ctl.conf.5 @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 11, 2015 +.Dd February 27, 2015 .Dt CTL.CONF 5 .Os .Sh NAME @@ -228,6 +228,9 @@ An IPv4 or IPv6 address and port to listen on for incoming connections. .\".It Ic listen-iser Ar address .\"An IPv4 or IPv6 address and port to listen on for incoming connections .\"using iSER (iSCSI over RDMA) protocol. +.It Ic offload Ar driver +Define iSCSI hardware offload driver to use for this +.Sy portal-group . .It Ic redirect Ar address IPv4 or IPv6 address to redirect initiators to. When configured, all initiators attempting to connect to portal @@ -311,8 +314,6 @@ This clause is mutually exclusive with .Sy auth-group ; one cannot use both in a single target. -.It Ic offload Ar driver -Define iSCSI hardware offload driver to use for this target. .It Ic portal-group Ar name Op Ar agname Assign a previously defined portal group to the target. The default portal group is diff --git a/usr.sbin/ctld/ctld.c b/usr.sbin/ctld/ctld.c index 425f591..2f4f147 100644 --- a/usr.sbin/ctld/ctld.c +++ b/usr.sbin/ctld/ctld.c @@ -637,6 +637,7 @@ portal_group_delete(struct portal_group *pg) TAILQ_FOREACH_SAFE(portal, &pg->pg_portals, p_next, tmp) portal_delete(portal); free(pg->pg_name); + free(pg->pg_offload); free(pg->pg_redirection); free(pg); } @@ -1023,6 +1024,22 @@ portal_group_set_filter(struct portal_group *pg, const char *str) } int +portal_group_set_offload(struct portal_group *pg, const char *offload) +{ + + if (pg->pg_offload != NULL) { + log_warnx("cannot set offload to \"%s\" for " + "portal-group \"%s\"; already defined", + offload, pg->pg_name); + return (1); + } + + pg->pg_offload = checked_strdup(offload); + + return (0); +} + +int portal_group_set_redirection(struct portal_group *pg, const char *addr) { @@ -1361,22 +1378,6 @@ target_set_redirection(struct target *target, const char *addr) return (0); } -int -target_set_offload(struct target *target, const char *offload) -{ - - if (target->t_offload != NULL) { - log_warnx("cannot set offload to \"%s\" for " - "target \"%s\"; already defined", - offload, target->t_name); - return (1); - } - - target->t_offload = checked_strdup(offload); - - return (0); -} - struct lun * lun_new(struct conf *conf, const char *name) { @@ -1619,8 +1620,6 @@ conf_print(struct conf *conf) fprintf(stderr, "target %s {\n", targ->t_name); if (targ->t_alias != NULL) fprintf(stderr, "\t alias %s\n", targ->t_alias); - if (targ->t_offload != NULL) - fprintf(stderr, "\t offload %s\n", targ->t_offload); fprintf(stderr, "}\n"); } } diff --git a/usr.sbin/ctld/ctld.h b/usr.sbin/ctld/ctld.h index 36e6bc4..52ffad0 100644 --- a/usr.sbin/ctld/ctld.h +++ b/usr.sbin/ctld/ctld.h @@ -120,6 +120,7 @@ struct portal_group { bool pg_unassigned; TAILQ_HEAD(, portal) pg_portals; TAILQ_HEAD(, port) pg_ports; + char *pg_offload; char *pg_redirection; uint16_t pg_tag; @@ -180,7 +181,6 @@ struct target { TAILQ_HEAD(, port) t_ports; char *t_name; char *t_alias; - char *t_offload; char *t_redirection; }; @@ -336,6 +336,8 @@ int portal_group_add_listen(struct portal_group *pg, const char *listen, bool iser); int portal_group_set_filter(struct portal_group *pg, const char *filter); +int portal_group_set_offload(struct portal_group *pg, + const char *offload); int portal_group_set_redirection(struct portal_group *pg, const char *addr); @@ -366,8 +368,6 @@ struct target *target_find(struct conf *conf, const char *name); int target_set_redirection(struct target *target, const char *addr); -int target_set_offload(struct target *target, - const char *offload); struct lun *lun_new(struct conf *conf, const char *name); void lun_delete(struct lun *lun); diff --git a/usr.sbin/ctld/kernel.c b/usr.sbin/ctld/kernel.c index 129c725..c9e4468 100644 --- a/usr.sbin/ctld/kernel.c +++ b/usr.sbin/ctld/kernel.c @@ -816,9 +816,10 @@ kernel_handoff(struct connection *conn) sizeof(req.data.handoff.initiator_isid)); strlcpy(req.data.handoff.target_name, conn->conn_target->t_name, sizeof(req.data.handoff.target_name)); - if (conn->conn_target->t_offload != NULL) { + if (conn->conn_portal->p_portal_group->pg_offload != NULL) { strlcpy(req.data.handoff.offload, - conn->conn_target->t_offload, sizeof(req.data.handoff.offload)); + conn->conn_portal->p_portal_group->pg_offload, + sizeof(req.data.handoff.offload)); } #ifdef ICL_KERNEL_PROXY if (proxy_mode) diff --git a/usr.sbin/ctld/login.c b/usr.sbin/ctld/login.c index 11d97cf..9f9ef3c 100644 --- a/usr.sbin/ctld/login.c +++ b/usr.sbin/ctld/login.c @@ -687,7 +687,7 @@ login_negotiate(struct connection *conn, struct pdu *request) * In case of offload, it depends on hardware capabilities. */ assert(conn->conn_target != NULL); - kernel_limits(conn->conn_target->t_offload, + kernel_limits(conn->conn_portal->p_portal_group->pg_offload, &conn->conn_data_segment_limit); } else { conn->conn_data_segment_limit = MAX_DATA_SEGMENT_LENGTH; diff --git a/usr.sbin/ctld/parse.y b/usr.sbin/ctld/parse.y index 51b8923..76873d4 100644 --- a/usr.sbin/ctld/parse.y +++ b/usr.sbin/ctld/parse.y @@ -342,6 +342,8 @@ portal_group_entry: | portal_group_listen_iser | + portal_group_offload + | portal_group_redirect ; @@ -398,6 +400,17 @@ portal_group_listen_iser: LISTEN_ISER STR } ; +portal_group_offload: OFFLOAD STR + { + int error; + + error = portal_group_set_offload(portal_group, $2); + free($2); + if (error != 0) + return (1); + } + ; + portal_group_redirect: REDIRECT STR { int error; @@ -463,8 +476,6 @@ target_entry: | target_initiator_portal | - target_offload - | target_portal_group | target_port @@ -656,17 +667,6 @@ target_initiator_portal: INITIATOR_PORTAL STR } ; -target_offload: OFFLOAD STR - { - int error; - - error = target_set_offload(target, $2); - free($2); - if (error != 0) - return (1); - } - ; - target_portal_group: PORTAL_GROUP STR STR { struct portal_group *tpg; |