Date: Sat, 28 Feb 2015 12:02:32 +0000 (UTC) From: Edward Tomasz Napierala <trasz@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r279392 - head/usr.sbin/ctld Message-ID: <201502281202.t1SC2W5v028671@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: trasz Date: Sat Feb 28 12:02:32 2015 New Revision: 279392 URL: https://svnweb.freebsd.org/changeset/base/279392 Log: 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 Modified: head/usr.sbin/ctld/ctl.conf.5 head/usr.sbin/ctld/ctld.c head/usr.sbin/ctld/ctld.h head/usr.sbin/ctld/kernel.c head/usr.sbin/ctld/login.c head/usr.sbin/ctld/parse.y Modified: head/usr.sbin/ctld/ctl.conf.5 ============================================================================== --- head/usr.sbin/ctld/ctl.conf.5 Sat Feb 28 05:14:42 2015 (r279391) +++ head/usr.sbin/ctld/ctl.conf.5 Sat Feb 28 12:02:32 2015 (r279392) @@ -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 list .\".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 Modified: head/usr.sbin/ctld/ctld.c ============================================================================== --- head/usr.sbin/ctld/ctld.c Sat Feb 28 05:14:42 2015 (r279391) +++ head/usr.sbin/ctld/ctld.c Sat Feb 28 12:02:32 2015 (r279392) @@ -637,6 +637,7 @@ portal_group_delete(struct portal_group 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_gr } 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 *ta 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"); } } Modified: head/usr.sbin/ctld/ctld.h ============================================================================== --- head/usr.sbin/ctld/ctld.h Sat Feb 28 05:14:42 2015 (r279391) +++ head/usr.sbin/ctld/ctld.h Sat Feb 28 12:02:32 2015 (r279392) @@ -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 por 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 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); Modified: head/usr.sbin/ctld/kernel.c ============================================================================== --- head/usr.sbin/ctld/kernel.c Sat Feb 28 05:14:42 2015 (r279391) +++ head/usr.sbin/ctld/kernel.c Sat Feb 28 12:02:32 2015 (r279392) @@ -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) Modified: head/usr.sbin/ctld/login.c ============================================================================== --- head/usr.sbin/ctld/login.c Sat Feb 28 05:14:42 2015 (r279391) +++ head/usr.sbin/ctld/login.c Sat Feb 28 12:02:32 2015 (r279392) @@ -687,7 +687,7 @@ login_negotiate(struct connection *conn, * 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; Modified: head/usr.sbin/ctld/parse.y ============================================================================== --- head/usr.sbin/ctld/parse.y Sat Feb 28 05:14:42 2015 (r279391) +++ head/usr.sbin/ctld/parse.y Sat Feb 28 12:02:32 2015 (r279392) @@ -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 ST } ; +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_PORTA } ; -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;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201502281202.t1SC2W5v028671>