sms: Make the max_pending tunable via a vty runtime setting

Make it possible to change the max pending via the vty. This
can be useful to play with the performance of the queue.
diff --git a/openbsc/include/openbsc/sms_queue.h b/openbsc/include/openbsc/sms_queue.h
index 5bfa4b4..02dec73 100644
--- a/openbsc/include/openbsc/sms_queue.h
+++ b/openbsc/include/openbsc/sms_queue.h
@@ -10,5 +10,6 @@
 
 /* vty helper functions */
 int sms_queue_stats(struct gsm_sms_queue *, struct vty* vty);
+int sms_queue_set_max_pending(struct gsm_sms_queue *, int max);
 
 #endif
diff --git a/openbsc/src/sms_queue.c b/openbsc/src/sms_queue.c
index 1161b6c..4ffde62 100644
--- a/openbsc/src/sms_queue.c
+++ b/openbsc/src/sms_queue.c
@@ -407,3 +407,11 @@
 			pending->subscr->id, VTY_NEWLINE);
 	return 0;
 }
+
+int sms_queue_set_max_pending(struct gsm_sms_queue *smsq, int max_pending)
+{
+	LOGP(DSMS, LOGL_NOTICE, "SMSqueue old max: %d new: %d\n",
+	     smsq->max_pending, max_pending);
+	smsq->max_pending = max_pending;
+	return 0;
+}
diff --git a/openbsc/src/vty_interface_layer3.c b/openbsc/src/vty_interface_layer3.c
index 317d74c..51176fa 100644
--- a/openbsc/src/vty_interface_layer3.c
+++ b/openbsc/src/vty_interface_layer3.c
@@ -656,6 +656,17 @@
 	return CMD_SUCCESS;
 }
 
+DEFUN(smsqueue_max,
+      smsqueue_max_cmd,
+      "sms-queue max-pending <1-500>",
+      "SMS Queue\n" "SMS to attempt to deliver at the same time\n")
+{
+	struct gsm_network *net = gsmnet_from_vty(vty);
+
+	sms_queue_set_max_pending(net->sms_queue, atoi(argv[0]));
+	return CMD_SUCCESS;
+}
+
 int bsc_vty_init_extra(void)
 {
 	register_signal_handler(SS_SCALL, scall_cbfn, NULL);
@@ -680,6 +691,7 @@
 	install_element(ENABLE_NODE, &ena_subscr_a3a8_cmd);
 	install_element(ENABLE_NODE, &subscriber_purge_cmd);
 	install_element(ENABLE_NODE, &smsqueue_trigger_cmd);
+	install_element(ENABLE_NODE, &smsqueue_max_cmd);
 
 	return 0;
 }