[net.unix-wizards] Problem with modem ports

cmoore@amdimage.UUCP (chris moore) (05/15/85)

We seem to be having a problem with our modem ports.  We
are running an 11/730 with a dmf-32 interface.  I have
the modems into the two modem ports (ports 0 and 1) on the
dmf.  It seems to work most of the time, but every now and
then when I logout from the modem line, the system doesn't
drop DTR and hang up the modem.  When this happens, if I
hang up the line from the terminal end, the getty on that
port goes away (as it should) and leaves an init, but when
that line is called again I don't get a new getty; the system
just hangs in the init.   The only way to get it back is to
go in and kill the init on that line so that the master init
(process 1) will restart a new one.  

Has anyone seen this problem before, and is there a fix?
By the way, we're running 4.2bsd, if that makes a difference.

Thanks in advance.

-- 

Of course we have backup tapes.  Do you want last year or the
 year before?

 Chris Moore (408) 749-4692
 UUCP: {ucbvax,decwrl,ihnp4,allegra}!amdcad!amdimage!cmoore

kwlalonde@watmath.UUCP (Ken Lalonde) (05/17/85)

The DMF driver stops listening for carrier transitions when the
other end hangs up.  Look at vaxuba/dmf.c, function dmfrint().
Change the code to read as shown below.
			
			} else {
				if (tp->t_state & TS_CARR_ON) {
					gsignal(tp->t_pgrp, SIGHUP);
					gsignal(tp->t_pgrp, SIGCONT);
					addr->dmfcsr = DMF_IE | DMFIR_LCR |
						((c>>8)&07);
				/* next line used to read addr->dmftms = 0; */
					addr->dmfun.dmfirw = DMFLCR_ENA;
					ttyflush(tp, FREAD|FWRITE);
				}
				tp->t_state &= ~TS_CARR_ON;
			}

In fact, all references to field dmftms are in error, since that register
is not byte addressable.
While you have your feet wet, there is a missing splx() in dmfparam():
	
	/*
	 * Block interrupts so parameters will be set
	 * before the line interrupts.
	 */
	s = spl5();
	addr->dmfcsr = (unit&07) | DMFIR_LCR | DMF_IE;
	if ((tp->t_ispeed)==0) {
		tp->t_state |= TS_HUPCLS;
		(void) dmfmctl(unit, DMF_OFF, DMSET);
		splx(s);	/* This was missing */
		return;
	}

Also, the first argument to dmfparam() is sometimes a device number,
sometimes a minor number.  It should always be the minor number,
since some callers don't have the device number handy.

	- Ken Lalonde		ihnp4!watmath!kwlalonde

hubert@entropy.UUCP (Steve Hubert) (05/18/85)

> We seem to be having a problem with our modem ports.  We
> are running an 11/730 with a dmf-32 interface.  I have
> the modems into the two modem ports (ports 0 and 1) on the
> dmf.  It seems to work most of the time, but every now and
> then when I logout from the modem line, the system doesn't
> drop DTR and hang up the modem.  When this happens, if I
> hang up the line from the terminal end, the getty on that
> port goes away (as it should) and leaves an init, but when
> that line is called again I don't get a new getty; the system
> just hangs in the init.   The only way to get it back is to
> go in and kill the init on that line so that the master init
> (process 1) will restart a new one.  
> 
> Has anyone seen this problem before, and is there a fix?
> By the way, we're running 4.2bsd, if that makes a difference.
> 
>  Chris Moore (408) 749-4692
>  UUCP: {ucbvax,decwrl,ihnp4,allegra}!amdcad!amdimage!cmoore

I'm not sure if my problem is the same one but it is certainly
similar.  My dmf 0 and 1 ports are connected to terminals through a
Micom switch at 9600 baud.  Sometimes an init will hang in the open on
the dmf tty.  I am using the standard 4.2 dmf.c (it is version 6.1,
83/07/29).  I have looked at the tp->t_state variable of a hung line
using adb.  One of these lines waiting for its open to complete usually
has t_state = 0x2 = TS_WOPEN.  If that is the case, the line is not
hung and the open will succeed when the carrier is raised on the line.
When the line IS hung it has t_state = 0x206 which is TS_WOPEN |
TS_ISOPEN | TS_HUPCLS.  I can't figure out how the state ever gets set to
206.  I don't see anywhere where HUPCLS is set and it doesn't look like
ISOPEN and WOPEN should be able to be on at the same time.  We must be
at the following sleep in dmfopen() waiting for the wakeup in dmfrint(),
or maybe not.  Any ideas from the wizards?

	s = spl5();
	while ((tp->t_state & TS_CARR_ON) == 0) {
		tp->t_state |= TS_WOPEN;
		sleep((caddr_t)&tp->t_rawq, TTIPRI);
	}

Steve Hubert
 Dept. of Stat., U. of Wash, Seattle
 {decvax,ihnp4,ucbvax!lbl-csam}!uw-beaver!entropy!hubert
 hubert%entropy@uw-beaver