Esempio n. 1
0
void hsi_read_work(struct work_struct *work)
{
	//function registered with read work q
	struct hsi_channel *ch = (struct hsi_channel*) container_of(work, struct hsi_channel,read_work);
	int chno = ch->info->chno;
	struct x_data *data = NULL;
  
	if (hsi_channels[chno].read_queued == HSI_TRUE) {
#if MCM_DBG_ERR_LOG
		printk("\nmcm: read wq already in progress\n");
#endif
		return;
	}
  
	hsi_channels[chno].read_queued = HSI_TRUE;
  
	while ((data = read_q(chno, &hsi_channels[chno].rx_q)) != NULL) {
		char *buf = data->buf;
		hsi_channels[chno].curr = data;
		hsi_channels[chno].notify(chno);
		hsi_mem_free(buf);
	}
	hsi_channels[chno].read_queued = HSI_FALSE;
	spin_lock_bh(&hsi_channels[chno].lock);
	hsi_channels[chno].read_happening = HSI_FALSE; 
	spin_unlock_bh(&hsi_channels[chno].lock);
	wake_up(&hsi_channels[chno].read_wait);
}
Esempio n. 2
0
void hsi_read_work(struct work_struct *work)
{
	/* function registered with read work q */
	struct hsi_channel *ch = (struct hsi_channel*) container_of(work,
													struct hsi_channel,
													read_work);
	int chno = ch->info->chno;
	struct x_data *data = NULL;

	if (hsi_channels[chno].read_queued == HSI_TRUE) {
#if MCM_DBG_LOG
		printk("\nmcm: read wq already in progress\n");
#endif
		return;
	}

	hsi_channels[chno].read_queued = HSI_TRUE;

	while ((data = read_q(chno, &hsi_channels[chno].rx_q)) != NULL) {
		char *buf = data->buf;
		hsi_channels[chno].curr = data;

		if (hsi_mcm_state != HSI_MCM_STATE_ERR_RECOVERY) {
			hsi_channels[chno].notify(chno);
#if MCM_DBG_ERR_RECOVERY_LOG
		} else {
			printk("\nmcm:Dropping RX packets of channel %d from WQ as error recovery is in progress\n", chno);
#endif
		}

		hsi_mem_free(buf);
		if(chno >= 13) {
#if defined (HSI_LL_ENABLE_RX_BUF_RETRY_WQ)
			if(hsi_channels[chno].rx_blocked) {
				hsi_channels[chno].rx_blocked = 0;
				spin_lock_bh(&hsi_channels[chno].lock);
				hsi_channels[chno].pending_rx_msgs++;
				spin_unlock_bh(&hsi_channels[chno].lock);
				PREPARE_WORK(&hsi_channels[chno].buf_retry_work, hsi_buf_retry_work);
				queue_work(hsi_buf_retry_wq, &hsi_channels[chno].buf_retry_work);
			}
#endif
			hsi_channels[chno].pending_rx_msgs--;
		}
	}
	hsi_channels[chno].read_queued = HSI_FALSE;
	spin_lock_bh(&hsi_channels[chno].lock);
	hsi_channels[chno].read_happening = HSI_FALSE;
	spin_unlock_bh(&hsi_channels[chno].lock);

	wake_up(&hsi_channels[chno].read_wait);
}
Esempio n. 3
0
void hsi_write_work(struct work_struct *work)
{
	//function registered with write work q
	struct hsi_channel *ch = (struct hsi_channel*) container_of(work, struct hsi_channel,write_work);
	int chno = ch->info->chno;
	struct x_data *data = NULL;
	int err;

	if (hsi_channels[chno].write_queued == HSI_TRUE) {
#if MCM_DBG_ERR_LOG
		printk("\nmcm: write wq already in progress\n");
#endif
		return;
	}
  
	hsi_channels[chno].write_queued = HSI_TRUE;
  
	while ((data = read_q(chno, &hsi_channels[chno].tx_q)) != NULL) {
		hsi_channels[chno].write_happening = HSI_TRUE; //spinlock may be used for read_happening
		data->being_used = HSI_TRUE;
		err = hsi_ll_write(chno, (unsigned char *)data->buf, data->size);
		if (err < 0) {
#if MCM_DBG_ERR_LOG
			printk("\nmcm: hsi_ll_write failed\n");
#endif
			hsi_channels[chno].write_happening = HSI_FALSE;
		}
    
		if (hsi_channels[chno].write_happening == HSI_TRUE) { //spinlock may be used for write_happening
#if MCM_DBG_LOG
			printk("\nmcm:locking mutex for ch: %d\n",chno);
#endif
			wait_event(hsi_channels[chno].write_wait, hsi_channels[chno].write_happening == HSI_FALSE);
		}
		data->being_used = HSI_FALSE;
	}
	hsi_channels[chno].write_queued = HSI_FALSE;
}
Esempio n. 4
0
static void
q(void)
{
  read_q(&config_info);
  process_q();
}
Esempio n. 5
0
void hsi_write_work(struct work_struct *work)
{
	/* function registered with write work q */
	struct hsi_channel *ch = (struct hsi_channel*) container_of(work,
													struct hsi_channel,
													write_work);
	int chno = ch->info->chno;
	struct x_data *data = NULL;
	int err;

//                                                  
/* RIL recovery memory initialization  */
#if 0
	if (hsi_mcm_state == HSI_MCM_STATE_ERR_RECOVERY) {
#if MCM_DBG_ERR_RECOVERY_LOG
		printk("\nmcm:Dropping packets of channel %d from WQ as error recovery is in progress\n", chno);
#endif
		goto quit_write_wq;
	}
#endif
//                                                

	if (hsi_channels[chno].write_queued == HSI_TRUE) {
#if MCM_DBG_LOG
		printk("\nmcm: write wq already in progress\n");
#endif
		return;
	}

	hsi_channels[chno].write_queued = HSI_TRUE;

	while ((data = read_q(chno, &hsi_channels[chno].tx_q)) != NULL) {
//                                                  
/* RIL recovery memory initialization  */
#if 1
		if (hsi_mcm_state == HSI_MCM_STATE_ERR_RECOVERY) {
#if MCM_DBG_ERR_RECOVERY_LOG
			printk("\nmcm:Dropping packets of channel %d from WQ "
					"as error recovery is in progress\n", chno);
#endif
			hsi_mem_free(data->buf);
			continue;
		}
#endif
//                                                
		hsi_channels[chno].write_happening = HSI_TRUE;
		data->being_used = HSI_TRUE;
		err = hsi_ll_write(chno, (unsigned char *)data->buf, data->size);
		if (err < 0) {
#if MCM_DBG_ERR_LOG
			printk("\nmcm: hsi_ll_write failed\n");
#endif
			hsi_channels[chno].write_happening = HSI_FALSE;
		} else {
#if MCM_DBG_LOG
			printk("\nmcm:locking mutex for ch: %d\n",chno);
#endif
			wait_event(hsi_channels[chno].write_wait,
						hsi_channels[chno].write_happening == HSI_FALSE);
		}
		hsi_channels[chno].pending_tx_msgs--;
		data->being_used = HSI_FALSE;

		if (hsi_channels[chno].tx_blocked == 1) {
			hsi_channels[chno].tx_blocked = 0;
//#if MCM_DBG_LOG
			printk("\nmcm: Channel queue free , restarting TX queue for ch %d \n",chno);
//#endif
			rmnet_restart_queue(chno);
		}
	}

//                                                  
#if 0
/* RIL recovery memory initialization  */
quit_write_wq:
#endif
//                                                
	hsi_channels[chno].write_queued = HSI_FALSE;
}
Esempio n. 6
0
int main (int argc, char *argv[])
{
    int n, ib = 0, nb, flags = 0, has_q = 0;
    BINARYIO *bf;
    static char basename[33] = "Base";

    if (argc < 3)
        print_usage (usgmsg, NULL);

    /* get options */

    while ((n = getargs (argc, argv, options)) > 0) {
        switch (n) {
            case 'f':
                flags &= ~OPEN_FORTRAN;
                flags |= OPEN_ASCII;
                break;
            case 'u':
                flags &= ~OPEN_ASCII;
                flags |= OPEN_FORTRAN;
                break;
            case 's':
                mblock = 0;
                break;
            case 'p':
                whole = 0;
                break;
            case 'i':
                use_iblank = 1;
                /* fall through */
            case 'n':
                has_iblank = 1;
                break;
            case 'd':
                is_double = 1;
                break;
            case 'M':
                flags &= ~MACH_UNKNOWN;
                flags |= get_machine (argarg);
                break;
            case 'b':
                ib = atoi (argarg);
                break;
            case 'B':
                strncpy (basename, argarg, 32);
                basename[32] = 0;
                break;
            case 'g':
                gamma = atof (argarg);
                if (gamma <= 1.0)
                    FATAL (NULL, "invalid value for gamma");
                break;
            case 'c':
                convert = 1;
                break;
        }
    }

    if (argind > argc - 2)
        print_usage (usgmsg, "XYZfile and/or CGNSfile not given");

    /* read Plot3d file */

    printf ("reading PLOT3D grid file %s\n", argv[argind]);
    printf ("  as %s-block %s", mblock ? "multi" : "single",
        flags == OPEN_ASCII ? "ASCII" :
        (flags == OPEN_FORTRAN ? "FORTRAN unformatted" : "binary"));
    if (has_iblank) printf (" with iblank array");
    putchar ('\n');
    if (!file_exists (argv[argind]))
        FATAL (NULL, "XYZ file does not exist or is not a file");
    if (NULL == (bf = bf_open (argv[argind], flags | OPEN_READ))) {
        fprintf (stderr, "can't open <%s> for reading", argv[argind]);
        exit (1);
    }
    read_xyz (bf);
    bf_close (bf);

    if (use_iblank) build_interfaces ();

    /* read solution file if given */

    if (++argind < argc-1) {
        printf ("\nreading PLOT3D solution file %s\n", argv[argind]);
        if (!file_exists (argv[argind]))
            FATAL (NULL, "Solution file does not exist or is not a file");

        if (NULL == (bf = bf_open (argv[argind], flags | OPEN_READ))) {
            fprintf (stderr, "can't open <%s> for reading", argv[argind]);
            exit (1);
        }
        read_q (bf);
        bf_close (bf);
        argind++;
        has_q = 1;
    }

    /* open CGNS file */

    printf ("\nwriting CGNS file to %s\n", argv[argind]);
    nb = open_cgns (argv[argind], 0);
    if (ib) {
        if (ib > nb)
            FATAL (NULL, "specified base index out of range");
        if (cg_base_read (cgnsfn, ib, basename, &n, &n))
            FATAL (NULL, NULL);
    }
    if (cg_base_write (cgnsfn, basename, 3, 3, &cgnsbase) ||
        cg_goto (cgnsfn, cgnsbase, "end") ||
        cg_dataclass_write (CGNS_ENUMV(NormalizedByUnknownDimensional)))
        FATAL (NULL, NULL);
    printf ("  output to base %d - %s\n", cgnsbase, basename);

    write_zones ();
    for (n = 1; n <= nZones; n++) {
        printf ("writing zone %d ... grid", n);
        fflush (stdout);
        write_zone_grid (n);
        write_zone_interface (n);
        if (has_q) {
            printf (", solution");
            fflush (stdout);
            write_zone_solution (n, 1);
            write_solution_field (n, 1, 0);
        }
        puts (" done");
    }
    if (has_q) write_reference ();

    cg_close (cgnsfn);

    return 0;
}