drivers/net/fddi/skfp/pmf.c

Source file repositories/reference/linux-study-clean/drivers/net/fddi/skfp/pmf.c

File Facts

System
Linux kernel
Corpus path
drivers/net/fddi/skfp/pmf.c
Extension
.c
Size
40119 bytes
Lines
1656
Domain
Driver Families
Bucket
drivers/net
Inferred role
Driver Families: implementation source
Status
source implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

if (reply) {
			sm = smtod(reply,struct smt_header *) ;
#ifdef	DEBUG
			dump_smt(smc,sm,"PMF Reply") ;
#endif
			smt_send_frame(smc,reply,FC_SMT_INFO,local) ;
		}
	}
}

static SMbuf *smt_build_pmf_response(struct s_smc *smc, struct smt_header *req,
				     int set, int local)
{
	SMbuf			*mb ;
	struct smt_header	*smt ;
	struct smt_para		*pa ;
	struct smt_p_reason	*res ;
	const struct s_p_tab	*pt ;
	int			len ;
	int			index ;
	int			idx_end ;
	int			error ;
	int			range ;
	SK_LOC_DECL(struct s_pcon,pcon) ;
	SK_LOC_DECL(struct s_pcon,set_pcon) ;

	/*
	 * build SMT header
	 */
	if (!(mb = smt_get_mbuf(smc)))
		return mb;

	smt = smtod(mb, struct smt_header *) ;
	smt->smt_dest = req->smt_source ;	/* DA == source of request */
	smt->smt_class = req->smt_class ;	/* same class (GET/SET) */
	smt->smt_type = SMT_REPLY ;
	smt->smt_version = SMT_VID_2 ;
	smt->smt_tid = req->smt_tid ;		/* same TID */
	smt->smt_pad = 0 ;
	smt->smt_len = 0 ;

	/*
	 * setup parameter status
	 */
	pcon.pc_len = SMT_MAX_INFO_LEN ;	/* max para length */
	pcon.pc_err = 0 ;			/* no error */
	pcon.pc_badset = 0 ;			/* no bad set count */
	pcon.pc_p = (void *) (smt + 1) ;	/* paras start here */

	/*
	 * check authoriziation and set count
	 */
	error = 0 ;
	if (set) {
		if (!local && smt_authorize(smc,req))
			error = SMT_RDF_AUTHOR ;
		else if (smt_check_set_count(smc,req))
			pcon.pc_badset = SMT_RDF_BADSET ;
	}
	/*
	 * add reason code and all mandatory parameters
	 */
	res = (struct smt_p_reason *) pcon.pc_p ;
	smt_add_para(smc,&pcon,(u_short) SMT_P_REASON,0,0) ;
	smt_add_para(smc,&pcon,(u_short) SMT_P1033,0,0) ;
	/* update 1035 and 1036 later if set */
	set_pcon = pcon ;
	smt_add_para(smc,&pcon,(u_short) SMT_P1035,0,0) ;
	smt_add_para(smc,&pcon,(u_short) SMT_P1036,0,0) ;

	pcon.pc_err = error ;
	len = req->smt_len ;
	pa = (struct smt_para *) (req + 1) ;
	/*
	 * process list of paras
	 */
	while (!pcon.pc_err && len > 0 ) {
		if (((u_short)len < pa->p_len + PARA_LEN) || (pa->p_len & 3)) {
			pcon.pc_err = SMT_RDF_LENGTH ;
			break ;
		}

		if (((range = (pa->p_type & 0xf000)) == 0x2000) ||
			range == 0x3000 || range == 0x4000) {
			/*
			 * get index for PART,MAC ad PATH group
			 */
			index = *((u_char *)pa + PARA_LEN + 3) ;/* index */
			idx_end = index ;
			if (!set && (pa->p_len != 4)) {

Annotation

Implementation Notes