mirror of
				https://gitea.osmocom.org/cellular-infrastructure/osmo-mgw.git
				synced 2025-11-03 21:43:32 +00:00 
			
		
		
		
	[ipaccess] Send a NVATTR to activate the new software after load end
* The struct is similiar to the one in abis_nm.. * The generation of the data is similiar to sw_end_load and sw_init_load and we should unite this..
This commit is contained in:
		@@ -51,6 +51,18 @@ static char *unit_id;
 | 
				
			|||||||
static u_int16_t nv_flags;
 | 
					static u_int16_t nv_flags;
 | 
				
			||||||
static u_int16_t nv_mask;
 | 
					static u_int16_t nv_mask;
 | 
				
			||||||
static char *software = NULL;
 | 
					static char *software = NULL;
 | 
				
			||||||
 | 
					static int sw_load_state = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					struct sw_load {
 | 
				
			||||||
 | 
						u_int8_t file_id[255];
 | 
				
			||||||
 | 
						u_int8_t file_id_len;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						u_int8_t file_version[255];
 | 
				
			||||||
 | 
						u_int8_t file_version_len;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static struct sw_load *sw_load1 = NULL;
 | 
				
			||||||
 | 
					static struct sw_load *sw_load2 = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
static u_int8_t prim_oml_attr[] = { 0x95, 0x00, 7, 0x88, 192, 168, 100, 11, 0x00, 0x00 };
 | 
					static u_int8_t prim_oml_attr[] = { 0x95, 0x00, 7, 0x88, 192, 168, 100, 11, 0x00, 0x00 };
 | 
				
			||||||
@@ -170,9 +182,10 @@ static int nm_sig_cb(unsigned int subsys, unsigned int signal,
 | 
				
			|||||||
/* callback function passed to the ABIS OML code */
 | 
					/* callback function passed to the ABIS OML code */
 | 
				
			||||||
static int percent;
 | 
					static int percent;
 | 
				
			||||||
static int percent_old;
 | 
					static int percent_old;
 | 
				
			||||||
static int swload_cbfn(unsigned int hook, unsigned int event, struct msgb *msg,
 | 
					static int swload_cbfn(unsigned int hook, unsigned int event, struct msgb *_msg,
 | 
				
			||||||
		       void *data, void *param)
 | 
							       void *data, void *param)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
						struct msgb *msg;
 | 
				
			||||||
	struct gsm_bts *bts;
 | 
						struct gsm_bts *bts;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (hook != GSM_HOOK_NM_SWLOAD)
 | 
						if (hook != GSM_HOOK_NM_SWLOAD)
 | 
				
			||||||
@@ -190,14 +203,35 @@ static int swload_cbfn(unsigned int hook, unsigned int event, struct msgb *msg,
 | 
				
			|||||||
		break;
 | 
							break;
 | 
				
			||||||
	case NM_MT_LOAD_END_ACK:
 | 
						case NM_MT_LOAD_END_ACK:
 | 
				
			||||||
		fprintf(stderr, "LOAD END ACK...");
 | 
							fprintf(stderr, "LOAD END ACK...");
 | 
				
			||||||
#if 0
 | 
							/* now make it the default */
 | 
				
			||||||
		if (data) {
 | 
							sw_load_state = 1;
 | 
				
			||||||
			/* we did a safety load and must activate it */
 | 
					
 | 
				
			||||||
			abis_nm_software_activate(g_bts, fname_safety,
 | 
							msg = msgb_alloc(1024, "sw: nvattr");
 | 
				
			||||||
						  swload_cbfn, bts);
 | 
							msg->l2h = msgb_put(msg, 3);
 | 
				
			||||||
			sleep(5);
 | 
							msg->l3h = &msg->l2h[3];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							/* activate software */
 | 
				
			||||||
 | 
							if (sw_load1) {
 | 
				
			||||||
 | 
								msgb_v_put(msg, NM_ATT_SW_DESCR);
 | 
				
			||||||
 | 
								msgb_tl16v_put(msg, NM_ATT_FILE_ID, sw_load1->file_id_len, sw_load1->file_id);
 | 
				
			||||||
 | 
								msgb_tl16v_put(msg, NM_ATT_FILE_VERSION, sw_load1->file_version_len,
 | 
				
			||||||
 | 
										sw_load1->file_version);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
#endif
 | 
					
 | 
				
			||||||
 | 
							if (sw_load2) {
 | 
				
			||||||
 | 
								msgb_v_put(msg, NM_ATT_SW_DESCR);
 | 
				
			||||||
 | 
								msgb_tl16v_put(msg, NM_ATT_FILE_ID, sw_load2->file_id_len, sw_load1->file_id);
 | 
				
			||||||
 | 
								msgb_tl16v_put(msg, NM_ATT_FILE_VERSION, sw_load2->file_version_len,
 | 
				
			||||||
 | 
										sw_load2->file_version);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							/* fill in the data */
 | 
				
			||||||
 | 
							msg->l2h[0] = NM_ATT_IPACC_CUR_SW_CFG;
 | 
				
			||||||
 | 
							msg->l2h[1] = msgb_l3len(msg) >> 8;
 | 
				
			||||||
 | 
							msg->l2h[2] = msgb_l3len(msg) & 0xff;
 | 
				
			||||||
 | 
							printf("Foo l2h: %p l3h: %p... length l2: %u  l3: %u\n", msg->l2h, msg->l3h, msgb_l2len(msg), msgb_l3len(msg));
 | 
				
			||||||
 | 
							abis_nm_ipaccess_set_nvattr(bts, msg->l2h, msgb_l2len(msg));
 | 
				
			||||||
 | 
							msgb_free(msg);
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
	case NM_MT_LOAD_END_NACK:
 | 
						case NM_MT_LOAD_END_NACK:
 | 
				
			||||||
		fprintf(stderr, "ERROR: Software Load End NACK\n");
 | 
							fprintf(stderr, "ERROR: Software Load End NACK\n");
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user