Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F152945647
D48771.id150292.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
4 KB
Referenced Files
None
Subscribers
None
D48771.id150292.diff
View Options
diff --git a/usr.sbin/ctld/ctld.h b/usr.sbin/ctld/ctld.h
--- a/usr.sbin/ctld/ctld.h
+++ b/usr.sbin/ctld/ctld.h
@@ -352,11 +352,6 @@
int kernel_lun_modify(struct lun *lun);
int kernel_lun_remove(struct lun *lun);
void kernel_handoff(struct ctld_connection *conn);
-void kernel_limits(const char *offload, int s,
- int *max_recv_data_segment_length,
- int *max_send_data_segment_length,
- int *max_burst_length,
- int *first_burst_length);
int kernel_port_add(struct port *port);
int kernel_port_update(struct port *port, struct port *old);
int kernel_port_remove(struct port *port);
diff --git a/usr.sbin/ctld/kernel.c b/usr.sbin/ctld/kernel.c
--- a/usr.sbin/ctld/kernel.c
+++ b/usr.sbin/ctld/kernel.c
@@ -907,60 +907,6 @@
}
}
-void
-kernel_limits(const char *offload, int s, int *max_recv_dsl, int *max_send_dsl,
- int *max_burst_length, int *first_burst_length)
-{
- struct ctl_iscsi req;
- struct ctl_iscsi_limits_params *cilp;
-
- bzero(&req, sizeof(req));
-
- req.type = CTL_ISCSI_LIMITS;
- cilp = (struct ctl_iscsi_limits_params *)&(req.data.limits);
- if (offload != NULL) {
- strlcpy(cilp->offload, offload, sizeof(cilp->offload));
- }
- cilp->socket = s;
-
- if (ioctl(ctl_fd, CTL_ISCSI, &req) == -1) {
- log_err(1, "error issuing CTL_ISCSI ioctl; "
- "dropping connection");
- }
-
- if (req.status != CTL_ISCSI_OK) {
- log_errx(1, "error returned from CTL iSCSI limits request: "
- "%s; dropping connection", req.error_str);
- }
-
- if (cilp->max_recv_data_segment_length != 0) {
- *max_recv_dsl = cilp->max_recv_data_segment_length;
- *max_send_dsl = cilp->max_recv_data_segment_length;
- }
- if (cilp->max_send_data_segment_length != 0)
- *max_send_dsl = cilp->max_send_data_segment_length;
- if (cilp->max_burst_length != 0)
- *max_burst_length = cilp->max_burst_length;
- if (cilp->first_burst_length != 0)
- *first_burst_length = cilp->first_burst_length;
- if (*max_burst_length < *first_burst_length)
- *first_burst_length = *max_burst_length;
-
- if (offload != NULL) {
- log_debugx("Kernel limits for offload \"%s\" are "
- "MaxRecvDataSegment=%d, max_send_dsl=%d, "
- "MaxBurstLength=%d, FirstBurstLength=%d",
- offload, *max_recv_dsl, *max_send_dsl, *max_burst_length,
- *first_burst_length);
- } else {
- log_debugx("Kernel limits are "
- "MaxRecvDataSegment=%d, max_send_dsl=%d, "
- "MaxBurstLength=%d, FirstBurstLength=%d",
- *max_recv_dsl, *max_send_dsl, *max_burst_length,
- *first_burst_length);
- }
-}
-
int
kernel_port_add(struct port *port)
{
diff --git a/usr.sbin/ctld/login.c b/usr.sbin/ctld/login.c
--- a/usr.sbin/ctld/login.c
+++ b/usr.sbin/ctld/login.c
@@ -29,20 +29,80 @@
*
*/
-#include <sys/cdefs.h>
+#include <sys/time.h>
#include <assert.h>
#include <stdbool.h>
+#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <netinet/in.h>
+#include <cam/ctl/ctl.h>
+#include <cam/ctl/ctl_io.h>
+#include <cam/ctl/ctl_ioctl.h>
#include "ctld.h"
#include "iscsi_proto.h"
+#define MAX_DATA_SEGMENT_LENGTH (128 * 1024)
+
static void login_send_error(struct pdu *request,
char class, char detail);
+static void
+kernel_limits(const char *offload, int s, int *max_recv_dsl, int *max_send_dsl,
+ int *max_burst_length, int *first_burst_length)
+{
+ struct ctl_iscsi req;
+ struct ctl_iscsi_limits_params *cilp;
+
+ bzero(&req, sizeof(req));
+
+ req.type = CTL_ISCSI_LIMITS;
+ cilp = (struct ctl_iscsi_limits_params *)&(req.data.limits);
+ if (offload != NULL) {
+ strlcpy(cilp->offload, offload, sizeof(cilp->offload));
+ }
+ cilp->socket = s;
+
+ if (ioctl(ctl_fd, CTL_ISCSI, &req) == -1) {
+ log_err(1, "error issuing CTL_ISCSI ioctl; "
+ "dropping connection");
+ }
+
+ if (req.status != CTL_ISCSI_OK) {
+ log_errx(1, "error returned from CTL iSCSI limits request: "
+ "%s; dropping connection", req.error_str);
+ }
+
+ if (cilp->max_recv_data_segment_length != 0) {
+ *max_recv_dsl = cilp->max_recv_data_segment_length;
+ *max_send_dsl = cilp->max_recv_data_segment_length;
+ }
+ if (cilp->max_send_data_segment_length != 0)
+ *max_send_dsl = cilp->max_send_data_segment_length;
+ if (cilp->max_burst_length != 0)
+ *max_burst_length = cilp->max_burst_length;
+ if (cilp->first_burst_length != 0)
+ *first_burst_length = cilp->first_burst_length;
+ if (*max_burst_length < *first_burst_length)
+ *first_burst_length = *max_burst_length;
+
+ if (offload != NULL) {
+ log_debugx("Kernel limits for offload \"%s\" are "
+ "MaxRecvDataSegment=%d, max_send_dsl=%d, "
+ "MaxBurstLength=%d, FirstBurstLength=%d",
+ offload, *max_recv_dsl, *max_send_dsl, *max_burst_length,
+ *first_burst_length);
+ } else {
+ log_debugx("Kernel limits are "
+ "MaxRecvDataSegment=%d, max_send_dsl=%d, "
+ "MaxBurstLength=%d, FirstBurstLength=%d",
+ *max_recv_dsl, *max_send_dsl, *max_burst_length,
+ *first_burst_length);
+ }
+}
+
static void
login_set_nsg(struct pdu *response, int nsg)
{
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Apr 19, 6:10 AM (21 h, 4 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
31731328
Default Alt Text
D48771.id150292.diff (4 KB)
Attached To
Mode
D48771: ctld: Move kernel_limits into login.c where it is used
Attached
Detach File
Event Timeline
Log In to Comment