mirror of
https://github.com/schoebel/mars
synced 2025-01-12 01:29:50 +00:00
client: allow polling on separate info_timeout
This commit is contained in:
parent
7301fc976b
commit
a6487909aa
@ -39,14 +39,13 @@
|
|||||||
|
|
||||||
#define CLIENT_HASH_MAX (PAGE_SIZE / sizeof(struct list_head))
|
#define CLIENT_HASH_MAX (PAGE_SIZE / sizeof(struct list_head))
|
||||||
|
|
||||||
|
int mars_client_info_timeout = 0;
|
||||||
|
|
||||||
int mars_client_abort = 10;
|
int mars_client_abort = 10;
|
||||||
EXPORT_SYMBOL_GPL(mars_client_abort);
|
|
||||||
|
|
||||||
int max_client_channels = 2;
|
int max_client_channels = 2;
|
||||||
EXPORT_SYMBOL_GPL(max_client_channels);
|
|
||||||
|
|
||||||
int max_client_bulk = 16;
|
int max_client_bulk = 16;
|
||||||
EXPORT_SYMBOL_GPL(max_client_bulk);
|
|
||||||
|
|
||||||
///////////////////////// own helper functions ////////////////////////
|
///////////////////////// own helper functions ////////////////////////
|
||||||
|
|
||||||
@ -380,13 +379,15 @@ done:
|
|||||||
}
|
}
|
||||||
|
|
||||||
static
|
static
|
||||||
long _compute_timeout(struct client_brick *brick)
|
long _compute_timeout(struct client_brick *brick, bool for_info)
|
||||||
{
|
{
|
||||||
long io_timeout = brick->power.io_timeout;
|
long io_timeout = brick->power.io_timeout;
|
||||||
|
|
||||||
if (io_timeout <= 0)
|
if (io_timeout <= 0)
|
||||||
io_timeout = global_net_io_timeout;
|
io_timeout = global_net_io_timeout;
|
||||||
|
if (for_info && io_timeout > mars_client_info_timeout)
|
||||||
|
io_timeout = mars_client_info_timeout;
|
||||||
|
|
||||||
return io_timeout;
|
return io_timeout;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -395,12 +396,16 @@ long _compute_timeout(struct client_brick *brick)
|
|||||||
static int client_get_info(struct client_output *output, struct mars_info *info)
|
static int client_get_info(struct client_output *output, struct mars_info *info)
|
||||||
{
|
{
|
||||||
struct client_brick *brick = output->brick;
|
struct client_brick *brick = output->brick;
|
||||||
long io_timeout = _compute_timeout(brick);
|
long io_timeout = _compute_timeout(brick, true);
|
||||||
int status;
|
int status;
|
||||||
|
|
||||||
output->got_info = false;
|
if (!brick->power.led_on) {
|
||||||
if (!brick->power.led_on)
|
if (output->got_info)
|
||||||
|
return 0;
|
||||||
|
output->get_info = true;
|
||||||
|
wake_up_interruptible_all(&output->bundle.sender_event);
|
||||||
goto timeout;
|
goto timeout;
|
||||||
|
}
|
||||||
|
|
||||||
output->get_info = true;
|
output->get_info = true;
|
||||||
wake_up_interruptible_all(&output->bundle.sender_event);
|
wake_up_interruptible_all(&output->bundle.sender_event);
|
||||||
@ -408,9 +413,10 @@ static int client_get_info(struct client_output *output, struct mars_info *info)
|
|||||||
wait_event_interruptible_timeout(output->info_event, output->got_info, io_timeout * HZ);
|
wait_event_interruptible_timeout(output->info_event, output->got_info, io_timeout * HZ);
|
||||||
timeout:
|
timeout:
|
||||||
status = -ETIME;
|
status = -ETIME;
|
||||||
if (output->got_info && info) {
|
if (output->got_info) {
|
||||||
memcpy(info, &output->info, sizeof(*info));
|
|
||||||
status = 0;
|
status = 0;
|
||||||
|
if (info)
|
||||||
|
memcpy(info, &output->info, sizeof(*info));
|
||||||
}
|
}
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
@ -685,7 +691,7 @@ void _do_timeout(struct client_output *output, struct list_head *anchor, int *ro
|
|||||||
struct list_head *tmp;
|
struct list_head *tmp;
|
||||||
struct list_head *prev;
|
struct list_head *prev;
|
||||||
LIST_HEAD(tmp_list);
|
LIST_HEAD(tmp_list);
|
||||||
long io_timeout = _compute_timeout(brick);
|
long io_timeout = _compute_timeout(brick, false);
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (list_empty(anchor))
|
if (list_empty(anchor))
|
||||||
@ -956,12 +962,16 @@ static int client_switch(struct client_brick *brick)
|
|||||||
if (brick->power.led_on)
|
if (brick->power.led_on)
|
||||||
goto done;
|
goto done;
|
||||||
mars_power_led_off((void*)brick, false);
|
mars_power_led_off((void*)brick, false);
|
||||||
status = _setup_bundle(&output->bundle, brick->brick_name);
|
if (!output->bundle.sender.thread) {
|
||||||
if (likely(status >= 0)) {
|
status = _setup_bundle(&output->bundle, brick->brick_name);
|
||||||
output->get_info = true;
|
if (likely(status >= 0)) {
|
||||||
brick->connection_state = 1;
|
brick->connection_state = 1;
|
||||||
mars_power_led_on((void*)brick, true);
|
}
|
||||||
}
|
}
|
||||||
|
if (output->bundle.sender.thread && !output->get_info) {
|
||||||
|
client_get_info(output, NULL);
|
||||||
|
}
|
||||||
|
mars_power_led_on((void*)brick, output->got_info);
|
||||||
} else {
|
} else {
|
||||||
if (brick->power.led_off)
|
if (brick->power.led_off)
|
||||||
goto done;
|
goto done;
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
|
|
||||||
extern struct mars_limiter client_limiter;
|
extern struct mars_limiter client_limiter;
|
||||||
extern int global_net_io_timeout;
|
extern int global_net_io_timeout;
|
||||||
|
extern int mars_client_info_timeout;
|
||||||
extern int mars_client_abort;
|
extern int mars_client_abort;
|
||||||
extern int max_client_channels;
|
extern int max_client_channels;
|
||||||
extern int max_client_bulk;
|
extern int max_client_bulk;
|
||||||
|
@ -405,6 +405,7 @@ struct ctl_table mars_table[] = {
|
|||||||
// changing makes no sense because the server will immediately start upon modprobe
|
// changing makes no sense because the server will immediately start upon modprobe
|
||||||
INT_ENTRY("mars_port", mars_net_default_port, 0400),
|
INT_ENTRY("mars_port", mars_net_default_port, 0400),
|
||||||
INT_ENTRY("network_io_timeout", global_net_io_timeout, 0600),
|
INT_ENTRY("network_io_timeout", global_net_io_timeout, 0600),
|
||||||
|
INT_ENTRY("client_info_timeout", mars_client_info_timeout, 0600),
|
||||||
INT_ENTRY("parallel_connections", max_client_channels, 0600),
|
INT_ENTRY("parallel_connections", max_client_channels, 0600),
|
||||||
INT_ENTRY("parallel_bulk_feed", max_client_bulk, 0600),
|
INT_ENTRY("parallel_bulk_feed", max_client_bulk, 0600),
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user