[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Linux-ATM-General] SONET to SDH on LE155 ATM adapter
In message <FFECLICFNBJAHONLGAKMMEBLCLAA.gklug@giga-stream.de>,"Georg Klug" wri
tes:
>struct atmif_sioc satm;
>
>satm.number = atm_device_number;
>satm.length = sizeof (int) ;
>satm.arg = SONET_FRAME_SDH;
>
>path = socket(AF_ATMPVC, SOCK_DGRAM, 0);
>ioctl(path, SONET_SETFRAMING, &satm);
>
>So there is an ioctl and it might be used also with your card.
i dont think that will work with the le155. the phy used on that
card (s/uni of some flavor) doesnt support setting the framing.
at one point i wrote but didnt test some code for the suni driver.
you could patching the suni driver with the following and then
see if the ioctl above works (sonetdiag probably should be capable
of issuing the ioctl and changing between sonet and sdh).
Index: drivers/atm/suni.c
===================================================================
RCS file: /afs/cmf/project/cvsroot/linux/drivers/atm/suni.c,v
retrieving revision 1.2
retrieving revision 1.4
diff -u -r1.2 -r1.4
--- drivers/atm/suni.c 4 Mar 2002 21:16:19 -0000 1.2
+++ drivers/atm/suni.c 17 Mar 2003 16:13:16 -0000 1.4
@@ -174,6 +174,37 @@
return 0;
}
+static int set_framing(struct atm_dev *dev, int mode)
+{
+ switch (mode) {
+ case SONET_FRAME_SONET:
+ REG_CHANGE(SUNI_TPOP_APM_S,SUNI_TPOP_APM_S_SHIFT,SUNI_TPOP_S_SONET,
+ TPOP_APM); /* use SONET */
+ break;
+ case SONET_FRAME_SDH:
+ REG_CHANGE(SUNI_TPOP_APM_S,SUNI_TPOP_APM_S_SHIFT,SUNI_TPOP_S_SDH,
+ TPOP_APM); /* use SDH */
+ break;
+ default:
+ return -EINVAL;
+ }
+ return 0;
+}
+
+static int get_framing(struct atm_dev *dev, void *arg)
+{
+ switch ((GET(TPOP_APM) & SUNI_TPOP_APM_S) >> SUNI_TPOP_APM_S_SHIFT) {
+ case SUNI_TPOP_S_SONET:
+ put_user(SONET_FRAME_SONET, (int *) arg);
+ break;
+ case SUNI_TPOP_S_SDH:
+ put_user(SONET_FRAME_SDH, (int *) arg);
+ break;
+ default:
+ return -EINVAL;
+ }
+ return 0;
+}
static int suni_ioctl(struct atm_dev *dev,unsigned int cmd,void *arg)
{
@@ -189,11 +220,9 @@
case SONET_GETDIAG:
return get_diag(dev,arg);
case SONET_SETFRAMING:
- if (arg != SONET_FRAME_SONET) return -EINVAL;
- return 0;
+ return set_framing(dev, (int) (long) arg);
case SONET_GETFRAMING:
- return put_user(SONET_FRAME_SONET,(int *) arg) ?
- -EFAULT : 0;
+ return get_framing(dev, arg);
case SONET_GETFRSENSE:
return -EINVAL;
case ATM_SETLOOP:
-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100006ave/direct;at.asp_061203_01/01
_______________________________________________
Linux-atm-general mailing list
Linux-atm-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-atm-general