James Carlson writes:

> Posting a patch won't lead to having any of the sources changed.
> You probably need to start here:

> http://www.opensolaris.org/os/about/faq/getting_started _developers/

> The short answer is that the place to start is to file a bug or RFE
> against the part of the system you're looking at.  Next, that issue
> will need to be evaluated and documented.  It may require
> architectural and design review, and will certainly require code
> review and testing.  It can then be integrated.

Jim, the issue of looping back a packet to the transmitting DLS
instance is documented in excruciating detail in this thread (i.e.,
the thread to which we are both posting):
http://www.opensolaris.org/jive/thread.jspa?threadID=6883&tstart=0

It is also documented as sub-item #1 in Bug ID: 6402493.

> The code changes are useful at that point in the effort.  Without at
> least a CR to document what's being done, it's unlikely that anyone
> will want to reverse-engineer your diffs in an attempt to figure out
> what you're fixing and why.

I offer the following short form "CR" to document the patch:

1) Goal: Modify the Sol 10/11 behavior so a packet transmitted on a
   promiscuously configured DLPI file descriptor is not returned
   (i.e., looped back) to be read by the same file descriptor.

2) The promiscuously configured file descriptor from item #1 is
   established in the kernel as a dls_impl_t instance.  In the current
   code, the dls_accept_loopback() function is called to determine
   whether to deliver a transmitted packet to a particular dls_impl_t.
   Unfortunately, the dls_accept_loopback() function does not know the
   dls_impl_t of the packet's transmitter; the attached patch fixes
   this deficiency (except for the case of an aggregated link, and the
   case of the SPARC only uts/sun4v/io/vsw.c consumer; neither one of
   which is relevant to our product).

Note: the new patch, attached hereto, superceeds the one I posted
before your 7/3-7/06 shutdown and has been tested by local rebuilding
("make") within the opensolaris B42 tree at the following directories:
/usr/src/uts/intel/dls
/usr/src/uts/intel/mac
/usr/src/uts/intel/aggr

The following resultant files were used to replace the corresponding
files on the S10 606 distribution:
/kernel/misc/amd64/dls
/kernel/misc/amd64/mac
/kernel/misc/dls
/kernel/misc/mac
/kernel/drv/amd64/aggr
/kernel/drv/aggr

The S10 606 system was rebooted and tested with two separate userland
programs (a unit test program and our company's SEP product) for the
revised behavior described in item #1 above.

Some items wrt your faq/getting_started _developers link above: A) How
does one go about getting a sponsor to be listed on the
bug_reports/request_sponsor table? B) What is the best way to
coordinate activity here with activity on the same subject being
conducted through Sun's Market Development Engineering unit? C) Why
can I post attachments sometimes and other (now for example) times
when I click on "Reply/Attach Files", I get a dialogue that says, "You
are not allowed to edit this message."?

Because of item C, above, the revised patch appears inline, below.


Regards, 
Mark Deric


> James Carlson, KISS Network <[EMAIL PROTECTED]>
> 1 Network Drive         71.232W   Vox +1 781 442 2084
> MS UBUR02-212 / Burlington MA 01803-2757   42.496N
>   Fax +1 781 442 1677
> _____________________________________________
> networking-discuss mailing list
> [email protected]
> 

--- usr/src/uts/common/sys/mac.h.fix_lo 2006-06-14 21:27:32.000000000 -0700
+++ usr/src/uts/common/sys/mac.h        2006-07-02 14:25:47.962970000 -0700
@@ -264,6 +264,7 @@
 typedef void           (*mac_resources_t)(void *);
 typedef void           (*mac_ioctl_t)(void *, queue_t *, mblk_t *);
 typedef mblk_t         *(*mac_tx_t)(void *, mblk_t *);
+typedef mblk_t         *(*mac_tx_lo_t)(void *, mblk_t *, void *);
 
 /*
  * MAC extensions. (Currently there are non defined).
@@ -330,7 +331,7 @@
 
 typedef void           (*mac_notify_t)(void *, mac_notify_type_t);
 typedef void           (*mac_rx_t)(void *, mac_resource_handle_t, mblk_t *);
-typedef void           (*mac_txloop_t)(void *, mblk_t *);
+typedef void           (*mac_txloop_t)(void *, mblk_t *, void *);
 typedef void           (*mac_blank_t)(void *, time_t, uint_t);
 
 /*
@@ -398,7 +399,7 @@
 extern void                    mac_notify(mac_handle_t);
 extern mac_rx_handle_t         mac_rx_add(mac_handle_t, mac_rx_t, void *);
 extern void                    mac_rx_remove(mac_handle_t, mac_rx_handle_t);
-extern mblk_t                  *mac_txloop(void *, mblk_t *);
+extern mblk_t                  *mac_txloop(void *, mblk_t *, void *);
 extern mac_txloop_handle_t     mac_txloop_add(mac_handle_t, mac_txloop_t,
     void *);
 extern void                    mac_txloop_remove(mac_handle_t,
--- usr/src/uts/common/sys/dls_impl.h.fix_lo    2006-06-14 21:27:33.000000000 
-0700
+++ usr/src/uts/common/sys/dls_impl.h   2006-07-05 11:05:02.406665000 -0700
@@ -145,8 +145,8 @@
 extern int             dls_fini(void);
 extern boolean_t       dls_accept(dls_impl_t *, const uint8_t *,
     dls_rx_t *, void **);
-extern boolean_t       dls_accept_loopback(dls_impl_t *, const uint8_t *,
-    dls_rx_t *, void **);
+extern boolean_t       dls_accept_loopback(dls_impl_t *, dls_impl_t *,
+    const uint8_t *, dls_rx_t *, void **);
 
 #ifdef __cplusplus
 }
--- usr/src/uts/common/io/dls/dls.c.fix_lo      2006-06-14 21:27:37.000000000 
-0700
+++ usr/src/uts/common/io/dls/dls.c     2006-07-05 14:06:05.229098000 -0700
@@ -795,7 +795,17 @@
 mblk_t *
 dls_tx(dls_channel_t dc, mblk_t *mp)
 {
-       const mac_txinfo_t *mtp = ((dls_impl_t *)dc)->di_txinfo;
+       dls_impl_t *dip = (dls_impl_t *)dc;
+       const mac_txinfo_t *mtp = dip->di_txinfo;
+       mac_handle_t mh = dip->di_mh;
+
+       if ((void*)mtp->mt_fn == (void*)mac_txloop) {
+               /* Only get here in the promisc loopback case */
+               /* cmn_err(CE_WARN,
+                  "dls_tx: Send promisc block"); */
+               return (((mac_tx_lo_t)mtp->mt_fn)
+                       (mtp->mt_arg, mp, dip));
+       }
 
        return (mtp->mt_fn(mtp->mt_arg, mp));
 }
@@ -904,9 +914,15 @@
 
 /*ARGSUSED*/
 boolean_t
-dls_accept_loopback(dls_impl_t *dip, const uint8_t *daddr, dls_rx_t *di_rx,
-    void **di_rx_arg)
+dls_accept_loopback(dls_impl_t *dip, dls_impl_t *dip_caller,
+    const uint8_t *daddr, dls_rx_t *di_rx, void **di_rx_arg)
 {
+       /* Only check accept of the promiscuous loopback call if the packet was
+          not sent (i.e., tx'ed) on our own dls_impl_t* */
+       /* cmn_err(CE_WARN, "dls_accept_loopback: caller: %lu; target: %lu",
+          (size_t)dip_caller, (size_t)dip); */
+       if (dip_caller == dip)
+               return (B_FALSE);
        /*
         * We must not accept packets if the dls_impl_t is not marked as bound
         * or is being removed.
--- usr/src/uts/common/io/dls/dls_link.c.fix_lo 2006-06-14 21:27:37.000000000 
-0700
+++ usr/src/uts/common/io/dls/dls_link.c        2006-07-05 11:17:38.480796000 
-0700
@@ -593,7 +593,7 @@
 }
 
 static void
-i_dls_link_ether_loopback(void *arg, mblk_t *mp)
+i_dls_link_ether_loopback(void *arg, mblk_t *mp, void* dip_caller)
 {
        dls_link_t                      *dlp = arg;
        mod_hash_t                      *hash = dlp->dl_impl_hash;
@@ -652,8 +652,8 @@
                 * Find dls_impl_t that will accept the sub-chain.
                 */
                for (dip = dhp->dh_list; dip != NULL; dip = dip->di_nextp) {
-                       if (!dls_accept_loopback(dip, daddr, &di_rx,
-                           &di_rx_arg))
+                       if (!dls_accept_loopback(dip, dip_caller, daddr,
+                                                &di_rx, &di_rx_arg))
                                continue;
 
                        /*
@@ -695,7 +695,8 @@
                 * Find the first dls_impl_t that will accept the sub-chain.
                 */
                for (dip = dhp->dh_list; dip != NULL; dip = dip->di_nextp)
-                       if (dls_accept_loopback(dip, daddr, &di_rx, &di_rx_arg))
+                       if (dls_accept_loopback(dip, dip_caller, daddr, &di_rx,
+                                               &di_rx_arg))
                                break;
 
                /*
@@ -715,8 +716,9 @@
                         */
                        for (ndip = dip->di_nextp; ndip != NULL;
                            ndip = ndip->di_nextp)
-                               if (dls_accept_loopback(ndip, daddr,
-                                   &ndi_rx, &ndi_rx_arg))
+                               if (dls_accept_loopback(ndip, dip_caller,
+                                                       daddr, &ndi_rx,
+                                                       &ndi_rx_arg))
                                        break;
 
                        /*
--- usr/src/uts/common/io/aggr/aggr_lacp.c.fix_lo       2006-06-14 
21:27:39.000000000 -0700
+++ usr/src/uts/common/io/aggr/aggr_lacp.c      2006-06-30 15:49:14.880545000 
-0700
@@ -569,7 +569,11 @@
         * loading mt_fn and mt_arg.
         */
        mtp = portp->lp_txinfo;
-       mtp->mt_fn(mtp->mt_arg, mp);
+       if ((void*)mtp->mt_fn == (void*)mac_txloop)
+               /* TODO: replace NULL with caller's dls_link_t* */
+               ((mac_tx_lo_t)mtp->mt_fn)(mtp->mt_arg, mp, NULL);
+       else
+               mtp->mt_fn(mtp->mt_arg, mp);
 
        pl->NTT = B_FALSE;
        portp->lp_lacp_stats.LACPDUsTx++;
@@ -901,7 +905,11 @@
         * loading mt_fn and mt_arg.
         */
        mtp = portp->lp_txinfo;
-       mtp->mt_fn(mtp->mt_arg, mp);
+       if ((void*)mtp->mt_fn == (void*)mac_txloop)
+               /* TODO: replace NULL with caller's dls_link_t* */
+               ((mac_tx_lo_t)mtp->mt_fn)(mtp->mt_arg, mp, NULL);
+       else
+               mtp->mt_fn(mtp->mt_arg, mp);
        return;
 
 bail:
--- usr/src/uts/common/io/aggr/aggr_send.c.fix_lo       2006-06-14 
21:27:39.000000000 -0700
+++ usr/src/uts/common/io/aggr/aggr_send.c      2006-06-30 15:50:04.066406000 
-0700
@@ -240,7 +240,14 @@
                 * changes between loading mt_fn and mt_arg.
                 */
                mtp = port->lp_txinfo;
-               if ((mp = mtp->mt_fn(mtp->mt_arg, mp)) != NULL) {
+               if ((void*)mtp->mt_fn == (void*)mac_txloop)
+                       /* TODO: replace NULL with caller's
+                          dls_link_t* */
+                       mp = ((mac_tx_lo_t)mtp->mt_fn)
+                               (mtp->mt_arg, mp, NULL);
+               else
+                       mp = mtp->mt_fn(mtp->mt_arg, mp);
+               if (mp != NULL) {
                        mp->b_next = nextp;
                        break;
                }
--- usr/src/uts/common/io/mac/mac.c.fix_lo      2006-06-14 21:27:39.000000000 
-0700
+++ usr/src/uts/common/io/mac/mac.c     2006-07-05 11:34:02.796287000 -0700
@@ -205,7 +205,7 @@
         */
        mip->mi_txinfo.mt_fn = mp->m_tx;
        mip->mi_txinfo.mt_arg = mp->m_driver;
-       mip->mi_txloopinfo.mt_fn = mac_txloop;
+       mip->mi_txloopinfo.mt_fn = (mac_tx_t) mac_txloop;
        mip->mi_txloopinfo.mt_arg = mip;
 
        /*
@@ -1249,7 +1249,7 @@
  * Transmit function -- ONLY used when there are registered loopback listeners.
  */
 mblk_t *
-mac_txloop(void *arg, mblk_t *bp)
+mac_txloop(void *arg, mblk_t *bp, void *dip_caller)
 {
        mac_impl_t      *mip = arg;
        mac_t           *mp = mip->mi_mp;
@@ -1280,7 +1280,7 @@
                        else
                                loop_bp = NULL;
 
-                       mtfp->mtf_fn(mtfp->mtf_arg, bp);
+                       mtfp->mtf_fn(mtfp->mtf_arg, bp, dip_caller);
                        mtfp = mtfp->mtf_nextp;
                }
                rw_exit(&mip->mi_txloop_lock);
--- usr/src/uts/sun4v/io/vsw.c.fix_lo   2006-06-14 21:27:43.000000000 -0700
+++ usr/src/uts/sun4v/io/vsw.c  2006-06-30 15:50:57.731978000 -0700
@@ -1247,7 +1247,14 @@
                        mp->b_next = NULL;
 
                        mtp = vswp->txinfo;
-                       if ((mp = mtp->mt_fn(mtp->mt_arg, mp)) != NULL) {
+                       if ((void*)mtp->mt_fn == (void*)mac_txloop)
+                               /* TODO: replace NULL with caller's
+                                  dls_link_t* */
+                               mp = ((mac_tx_lo_t)mtp->mt_fn)
+                                       (mtp->mt_arg, mp, NULL);
+                       else
+                               mp = mtp->mt_fn(mtp->mt_arg, mp);
+                       if (mp != NULL) {
                                mp->b_next = nextp;
                                break;
                        }
 
 
This message posted from opensolaris.org
_______________________________________________
networking-discuss mailing list
[email protected]

Reply via email to